MCPcopy Create free account
hub / github.com/BirolLab/abyss / get_alignment_consensus

Function get_alignment_consensus

Align/dialign.cpp:228–269  ·  view source on GitHub ↗

assume initial sequences contain only a/c/g/t/n

Source from the content-addressed store, hash-verified

226
227// assume initial sequences contain only a/c/g/t/n
228static string get_alignment_consensus(struct alignment *algn)
229{
230 struct seq_col *scol = algn->scol;
231 unsigned int slen = scol->length;
232
233 int j;
234 unsigned int s,max;
235 struct seq* sq;
236 struct algn_pos **ap = algn->algn;
237
238 prepare_alignment(algn);
239 max = algn->max_pos;
240 if (para->DEBUG > 5) printf("slen is %u, max pos is %u\n", slen, max);
241 struct algn_pos *ap1;
242
243 max = algn->max_pos;
244 int* proc = new int[slen];
245 for (j=0; j<(int)slen; j++)
246 proc[j] = 0;
247 string consensus;
248 for (j=0; j<(int)max; j++) {
249 char c = 'X';
250 bool gap = false;
251 for(s=0;s<slen;s++) {
252 sq = &(scol->seqs[s]);
253 if(proc[s] < sq->length) {
254 ap1 = find_eqc(ap,s,proc[s]);
255 if(*ap1->eqcAlgnPos==j) {
256 char cur_char = toupper(sq->data[proc[s]]);
257 c = c == 'X' ? cur_char
258 : ambiguityOr(c, cur_char);
259 proc[s]++;
260 } else
261 gap = true;
262 } else
263 gap = true;
264 }
265 consensus += gap ? tolower(c) : c;
266 }
267 delete[] proc;
268 return consensus;
269}
270
271/** Align multiple sequences using DIALIGN-TX.
272 * @param [out] alignment the alignment

Callers 1

dialignFunction · 0.85

Calls 3

prepare_alignmentFunction · 0.85
find_eqcFunction · 0.85
ambiguityOrFunction · 0.85

Tested by

no test coverage detected