-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbnw_extend.h
140 lines (119 loc) · 4.95 KB
/
bnw_extend.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#ifndef __BNW_EXTEND_H__
#define __BNW_EXTEND_H__
#include "sequence.h"
#include "score_system.h"
//
// Structures
//
struct glocalSearchResult
{
int score; // Score (could be complex adjusted) of the result
int query_start; // Query start position relative to the query sequence provided
int query_end; // Query end position relative to the query sequence provided
uint64_t subj_start; // Subject start position relative to the sequenceLibrary used
uint64_t subj_end; // Subject end position relative to the sequenceLibrary used
};
//
// Signatures
//
int ****
allocate_score(int num_align, int bandwidth);
void
free_score(int num_align, int bandwidth, int ****score);
int
pair_seed_extend( int orient,
uint64_t seq1_start, uint64_t seq1_end, uint64_t seq1_seed,
uint64_t seq2_start, uint64_t seq2_end, uint64_t seq2_seed,
int ****score, int l, struct sequenceLibrary *seqLib,
struct scoringSystem *scoreParams, int bandwidth,
struct glocalSearchResult *result, int use_complexity_adjust, int y_drop );
int
cons_seed_extend(char *query_seq, int query_len, int query_seed_start, int query_seed_end,
struct sequenceLibrary *subj_lib, uint64_t subj_seed_start,
uint64_t subj_seed_end, int orient, int ****score,
struct scoringSystem *scoreParams, int bandwidth,
struct glocalSearchResult *result, int use_complexity_adjust, int y_drop );
int
global_align(int orient, uint64_t seq1_start, uint64_t seq1_end, uint64_t seq1_seed,
uint64_t seq2_start, uint64_t seq2_end, uint64_t seq2_seed,
int ****score, int l, struct sequenceLibrary *seqLib,
struct scoringSystem *scoreParams, int bandwidth);
int
compute_nw_row(int direction, int row_idx, int n, char cons_base, struct coreAlignment *coreAlign,
int ****score, uint64_t lower_seq_bound,
uint64_t upper_seq_bound, char *sequence,
int *max_score_sequence_idx,
struct scoringSystem *dMatrix, int bandwidth, int L, int VERBOSE,
char *pathString);
struct coreAlignment *
fisher_yates_shuffle_calign(struct coreAlignment *coreAlign);
int
complexityAdjust(int score, int *comp, double lambda, double *matrix_freqs);
//
// UNIT TESTS
//
/*
MU_TEST(test_global_align)
{
char alu_seqs[] ="ATATGGATAGCTAGCGTGCGACGTACGGCGATTGGTATATGAGCGATATC"
//ALU Portion
"TAAAAATAAAAATAGGCTTGGGCGCGGTGGCTCACGCCTGTAATCCCAGC"
"ACTTAGGGAGGCCGAGGCGGGCGGATCACTTGAGGTCAGGAGTTCGAGAC"
"CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT"
"AGCCGGGCATGGTGGCACGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA"
"GGCAGGAGATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT"
"CGCGCCACTGCACTCCAGCCTGGGCAACAGAGCGAGACTCCGTCTCAAAA"
"AAAAAAAAAAAAAAAAAA"
// End ALU Portion
"GTAGTAGCATGCGAGCGTTAGCGATATATTAA"
"ATATGAGATGCGGGCTAATGCATATATTTTATGCGCGAGCACAAACGATT"
"GATTAGCGCGCATCACGATTAGGAGGATATGAATTATGCGGCGAGAAGAT"
//ALU Portion
"TAAAAATAAAAATAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA"
"CTTTGGGAGGCCGAGGCGGGCGGATCACTTGAGGTCAGGAGTTCGAGACC"
"AGCCTGGCCAACATGTGAAACCCCGTGCTCTACTAAAAATACAAAAATTA"
"GCCGGGCATGGTGGCACGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG"
"GCAGGAGTAATCGCTTGAACCCGGGAGGCGAGGTTGCAGTGAGCCGAGAT"
"CGCGCCACTGCACTCCAGCCTGGGCAACAGAGCGAGACTCCGTCTCAAAA"
"AAAAAAATAAAAAAAAA"
// End ALU Portion
"GATATCTACTATCATCTATAAATCTATTATTTA"
"ACGATTGGGCGGCGCTTTATTGCAGTAGTATCTAGCTCTCTCAGGCAAAC";
int idx = 0;
while ( alu_seqs[idx] != '\0' ){
alu_seqs[idx] = char_to_num(alu_seqs[idx]);
idx++;
}
struct sequenceLibrary seqLib;
seqLib.sequence = alu_seqs;
seqLib.boundaries = (uint64_t *) malloc(2 * sizeof(uint64_t));
seqLib.boundaries[0] = 900;
seqLib.boundaries[1] = 0;
char *predef_id[] = { "seq1" };
seqLib.identifiers = predef_id;
seqLib.count = 1;
seqLib.length = 900;
int bandwidth = 10;
int ****scores = allocate_score(1, bandwidth);
struct scoringSystem *scoreParams = getMatrix("20p43g");
int orient = 0;
uint64_t seq1_start = 50;
uint64_t seq1_end = 368;
uint64_t seq1_seed = 60;
uint64_t seq2_start = 500;
uint64_t seq2_end = 820;
uint64_t seq2_seed = 510;
int l = 8;
int align_score = global_align(orient, seq1_start, seq1_end, seq1_seed,
seq2_start, seq2_end, seq2_seed,
scores, l, &seqLib, scoreParams, bandwidth);
free(seqLib.boundaries);
free(scores);
freeScoringSystem(scoreParams);
mu_check( align_score == 2746 );
}
*/
//MU_TEST(test_global_align);
//void test_global_align(void);
void bnw_extend_test();
#endif