annotate alignCustomAmplicon/utils.cpp @ 2:413ba6d9cc46 draft

Uploaded
author fcaramia
date Wed, 09 Jan 2013 00:35:38 -0500
parents d32bddcff685
children 0aaf65fbb48a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
1 #include <stdio.h>
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
2 #include <string>
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
3 #include <vector>
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
4
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
5 #define max(a,b,c) a > b ? ( a > c ? a : c ) : ( b > c ? b : c ) ;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
6 #define min(a,b,c) a < b ? ( a < c ? a : c ) : ( b < c ? b : c ) ;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
7 using namespace std;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
8
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
9 void printMatrix (double* m, int rows, int cols)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
10 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
11 for(int i = 0; i < rows; i++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
12 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
13 for(int j = 0; j < cols; j++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
14 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
15 printf("%.2f ", *(m + i*cols +j));
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
16 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
17 printf("\n");
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
18 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
19
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
20 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
21
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
22 int levenshteinDistance(string s, string t)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
23 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
24 //Calculate Edit distance of 2 strings
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
25 if(s == t)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
26 return 0;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
27 int size1 = s.length()+1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
28 int size2 = t.length()+1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
29 int d[size1][size2];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
30
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
31 for (int i=0; i<size1; i++)d[i][0] = i;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
32 for (int i=0; i<size2; i++)d[0][i] = i;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
33
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
34 for (int i=1; i<size1; i++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
35 for (int j=1; j<size2; j++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
36 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
37 if(s[i-1] == t[j-1] )
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
38 d[i][j] = d[i-1][j-1]; //if equeal no operation
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
39 else
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
40 d[i][j] = min(d[i-1][j] + 1,d[i][j-1] + 1,d[i-1][j-1] + 1 ); //Addition, deletion or substitution
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
41
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
42 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
43
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
44 return d[size1-1][size2-1]; // return edit distance
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
45 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
46
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
47 double nw_align2 (string &seq1, string &seq2, double matchScore, double missmatch_penalty, double gapPenOpen, double gapPenExt, bool noFrontGapPenalty, bool noEndGapPenalty, bool debug)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
48 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
49 //Do NW alignment of 2 strings...
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
50 int size1 = seq1.length();
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
51 int size2 = seq2.length();
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
52
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
53 double scores[size1+1][size2+1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
54 char dir[size1+1][size2+1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
55 char gaps[size1+1][size2+1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
56
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
57 for(int i = 0; i <= size1; i++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
58 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
59 scores[i][0] = (double)(i-1)*gapPenExt + gapPenOpen;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
60 dir[i][0] = 'U';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
61 gaps[i][0] = 'O';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
62 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
63 for(int j = 0; j <= size2; j++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
64 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
65 scores[0][j] = (double)(j-1)*gapPenExt + gapPenOpen;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
66 dir[0][j] = 'L';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
67 gaps[0][j] = 'O';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
68 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
69
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
70 scores[0][0] = 0;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
71 gaps[0][0] = 'N';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
72
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
73 if (noFrontGapPenalty)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
74 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
75 for(int i = 0; i <= size1; i++) scores[i][0] = 0;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
76 for(int j = 0; j <= size2; j++) scores[0][j] = 0;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
77 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
78
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
79 double match;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
80 double del;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
81 double insert;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
82
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
83 for(int i = 1; i <= size1; i++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
84 for(int j = 1; j <= size2; j++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
85 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
86 if (seq1[i-1] == 'N' || seq2[j-1] == 'N')
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
87 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
88 match = scores[i-1][j-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
89 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
90 else
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
91 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
92 match = scores[i-1][j-1] + (double)(seq1[i-1] == seq2[j-1]? matchScore : missmatch_penalty); //1.9f clustalw
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
93 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
94 del = scores[i-1][j] + (gaps[i-1][j] == 'N'? gapPenOpen:gapPenExt);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
95 insert = scores[i][j-1] + (gaps[i][j-1] == 'N'? gapPenOpen:gapPenExt);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
96 //debug
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
97 //printf("I:%d J:%d match = %f del %f insert:%f\n",i,j,match,del,insert);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
98
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
99 if (match>del && match > insert)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
100 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
101 scores[i][j] = match;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
102 dir[i][j] = 'D';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
103 gaps[i][j] = 'N';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
104 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
105 else if(del > insert)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
106 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
107 scores[i][j] = del;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
108 dir[i][j] = 'U';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
109 gaps[i][j] = 'O';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
110 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
111 else
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
112 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
113 scores[i][j] = insert;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
114 dir[i][j] = 'L';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
115 gaps[i][j] = 'O';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
116 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
117 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
118
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
119 //debug
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
120 //if (debug)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
121 // printMatrix(*scores, size1+1, size2+1);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
122 //printMatrix(*dir, size1+1, size2+1);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
123
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
124 string alignment1="";
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
125 string alignment2="";
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
126
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
127
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
128 int cont1 = size1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
129 int cont2 = size2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
130 int max1 = size1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
131 int max2 = size2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
132 double num = scores[size1][size2];;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
133
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
134 if (noEndGapPenalty)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
135 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
136 //Search Maxes
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
137
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
138 for(int i = 1; i <= size1; i++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
139 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
140 if(num<scores[i][size2])
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
141 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
142 num = scores[i][size2];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
143 max1 = i;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
144 max2 = size2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
145 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
146 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
147 for(int j = 1; j <= size2; j++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
148 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
149 if(num<scores[size1][j])
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
150 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
151 num = scores[size1][j];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
152 max1 = size1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
153 max2 = j;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
154 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
155 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
156 cont1 = max1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
157 cont2 = max2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
158 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
159
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
160 while (cont1 > 0 && cont2 > 0)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
161 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
162 if(dir[cont1][cont2] == 'D')
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
163 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
164 alignment1+= seq1[cont1-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
165 alignment2+= seq2[cont2-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
166 cont1--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
167 cont2--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
168
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
169 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
170 else if(dir[cont1][cont2] == 'L')
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
171 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
172 alignment1+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
173 alignment2+= seq2[cont2-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
174 cont2--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
175 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
176 else
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
177 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
178 alignment1+= seq1[cont1-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
179 alignment2+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
180 cont1--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
181
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
182 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
183 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
184
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
185 while (cont1 > 0)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
186 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
187 alignment1+= seq1[cont1-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
188 alignment2+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
189 cont1--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
190 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
191
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
192 while (cont2 > 0)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
193 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
194 alignment1+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
195 alignment2+= seq2[cont2-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
196 cont2--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
197 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
198
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
199 alignment1 = string (alignment1.rbegin(),alignment1.rend());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
200 alignment2 = string (alignment2.rbegin(),alignment2.rend());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
201
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
202
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
203 if (noEndGapPenalty)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
204 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
205 //Need to fill out rest of alignment...
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
206 if (max1 != size1)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
207 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
208 for (int i=max1; i<size1; ++i )
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
209 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
210 alignment1+= seq1 [i];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
211 alignment2+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
212
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
213 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
214 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
215
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
216 if (max2 != size2)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
217 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
218
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
219 for (int i=max2; i<size2; ++i )
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
220 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
221 alignment2+= seq2 [i];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
222 alignment1+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
223
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
224 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
225 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
226
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
227 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
228 if (debug)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
229 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
230 printf("Seq1: %s\n", alignment1.c_str());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
231 printf("Seq2: %s\n\n", alignment2.c_str());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
232
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
233 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
234
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
235 //Returns
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
236 seq1 = alignment1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
237 seq2 = alignment2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
238
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
239 return num;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
240
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
241 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
242
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
243 vector <string> nw_alignAlignments (vector<string> a1, vector<string> a2, double matchScore, double missmatch_penalty, double gapPenOpen, double gapPenExt, bool noFrontGapPenalty, bool noEndGapPenalty, bool debug)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
244 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
245 //Do NW alignment of 2 strings...
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
246 int size1 = a1[0].length();
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
247 int size2 = a2[0].length();
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
248 int v1 = a1.size();
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
249 int v2 = a2.size();
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
250 int combs = v1 * v2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
251
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
252 vector<string> msa;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
253 msa.clear();
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
254 vector<string> alignment1, alignment2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
255
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
256 for (int i=0;i<v1;++i)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
257 alignment1.push_back(string());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
258 for (int i=0;i<v2;++i)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
259 alignment2.push_back(string());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
260
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
261
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
262
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
263 double scores[size1+1][size2+1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
264 char dir[size1+1][size2+1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
265 char gaps[size1+1][size2+1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
266
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
267 for(int i = 0; i <= size1; i++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
268 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
269 scores[i][0] = (double)(i-1)*gapPenExt + gapPenOpen;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
270 dir[i][0] = 'U';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
271 gaps[i][0] = 'O';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
272 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
273 for(int j = 0; j <= size2; j++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
274 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
275 scores[0][j] = (double)(j-1)*gapPenExt + gapPenOpen;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
276 dir[0][j] = 'L';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
277 gaps[0][j] = 'O';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
278 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
279
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
280 scores[0][0] = 0;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
281 gaps[0][0] = 'N';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
282
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
283 if (noFrontGapPenalty)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
284 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
285 for(int i = 0; i <= size1; i++) scores[i][0] = 0;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
286 for(int j = 0; j <= size2; j++) scores[0][j] = 0;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
287 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
288
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
289 double match;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
290 double del;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
291 double insert;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
292
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
293 for(int i = 1; i <= size1; i++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
294 for(int j = 1; j <= size2; j++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
295 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
296
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
297 match = del = insert = 0.0f;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
298 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
299 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
300 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
301 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
302 if (a1[z][i-1] == 'N' || a2[w][j-1] == 'N')
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
303 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
304 match += scores[i-1][j-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
305 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
306 else
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
307 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
308 match += scores[i-1][j-1] + (double)(a1[z][i-1] == a2[w][j-1]? matchScore:missmatch_penalty);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
309 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
310 del += scores[i-1][j] + (gaps[i-1][j] == 'N'? gapPenOpen:gapPenExt);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
311 insert += scores[i][j-1] + (gaps[i][j-1] == 'N'? gapPenOpen:gapPenExt);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
312 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
313 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
314
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
315 match /= combs;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
316 del /= combs;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
317 insert /= combs;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
318
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
319 if (match > del && match > insert)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
320 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
321 scores[i][j] = match;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
322 dir[i][j] = 'D';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
323 gaps[i][j] = 'N';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
324 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
325 else if(del > insert)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
326 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
327 scores[i][j] = del;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
328 dir[i][j] = 'U';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
329 gaps[i][j] = 'O';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
330 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
331 else
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
332 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
333 scores[i][j] = insert;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
334 dir[i][j] = 'L';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
335 gaps[i][j] = 'O';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
336 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
337 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
338
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
339 //debug
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
340 // if (debug)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
341 // printMatrix(*scores, size1+1, size2+1);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
342 //printMatrix(*dir, size1+1, size2+1);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
343
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
344
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
345 int cont1 = size1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
346 int cont2 = size2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
347 int max1 = size1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
348 int max2 = size2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
349 double num = scores[size1][size2];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
350
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
351 if (noEndGapPenalty)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
352 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
353 //Search Maxes
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
354
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
355 for(int i = 1; i <= size1; i++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
356 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
357 if(num<scores[i][size2])
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
358 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
359 num = scores[i][size2];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
360 max1 = i;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
361 max2 = size2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
362 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
363 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
364 for(int j = 1; j <= size2; j++)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
365 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
366 if(num<scores[size1][j])
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
367 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
368 num = scores[size1][j];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
369 max1 = size1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
370 max2 = j;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
371 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
372 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
373 cont1 = max1;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
374 cont2 = max2;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
375 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
376
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
377 while (cont1 > 0 && cont2 > 0)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
378 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
379 if(dir[cont1][cont2] == 'D')
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
380 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
381
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
382 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
383 alignment1[z]+= a1[z][cont1-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
384
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
385 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
386 alignment2[w]+= a2[w][cont2-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
387
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
388 cont1--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
389 cont2--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
390
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
391 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
392 else if(dir[cont1][cont2] == 'L')
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
393 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
394 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
395 alignment1[z]+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
396 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
397 alignment2[w]+= a2[w][cont2-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
398
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
399 cont2--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
400 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
401 else
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
402 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
403 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
404 alignment1[z]+= a1[z][cont1-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
405
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
406 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
407 alignment2[w]+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
408
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
409 cont1--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
410
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
411 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
412 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
413
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
414 while (cont1 > 0)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
415 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
416 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
417 alignment1[z]+= a1[z][cont1-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
418 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
419 alignment2[w]+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
420
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
421 cont1--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
422 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
423
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
424 while (cont2 > 0)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
425 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
426 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
427 alignment1[z]+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
428 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
429 alignment2[w]+= a2[w][cont2-1];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
430
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
431 cont2--;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
432 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
433
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
434
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
435
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
436
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
437 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
438 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
439 alignment1[z] = string (alignment1[z].rbegin(),alignment1[z].rend());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
440 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
441 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
442 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
443 alignment2[w] = string (alignment2[w].rbegin(),alignment2[w].rend());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
444 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
445
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
446
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
447
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
448 if (noEndGapPenalty)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
449 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
450 //Need to fill out rest of alignment...
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
451 if (max1 != size1)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
452 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
453 for (int i=max1; i<size1; ++i )
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
454 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
455 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
456 alignment1[z]+= a1[z][i];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
457 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
458 alignment2[w]+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
459
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
460 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
461 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
462
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
463 if (max2 != size2)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
464 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
465
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
466 for (int i=max2; i<size2; ++i )
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
467 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
468 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
469 alignment1[z]+= '-';
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
470 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
471 alignment2[w]+= a2[w][i];
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
472
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
473 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
474 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
475
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
476 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
477
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
478 //returns
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
479 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
480 msa.push_back(alignment1[z]);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
481 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
482 msa.push_back(alignment2[w]);
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
483
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
484 if (debug)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
485 {
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
486 for(int z=0;z<v1;++z)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
487 printf("%s\n",alignment1[z].c_str());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
488 for(int w=0;w<v2;++w)
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
489 printf("%s\n",alignment2[w].c_str());
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
490
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
491 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
492
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
493 return msa;
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
494
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
495 }
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
496
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
497
d32bddcff685 Uploaded
fcaramia
parents:
diff changeset
498