Align multiple sequences using DIALIGN-TX. * @param [out] alignment the alignment * @param [out] matches the minimum number of matches * @return the consensus sequence */
| 274 | * @return the consensus sequence |
| 275 | */ |
| 276 | string dialign(const vector<string>& amb_seqs, |
| 277 | string& alignment, unsigned& matches) |
| 278 | { |
| 279 | int i; |
| 280 | struct seq_col *in_seq_col = NULL; |
| 281 | double tim = clock(); |
| 282 | |
| 283 | in_seq_col = read_seqs(amb_seqs); |
| 284 | |
| 285 | // fast mode has higher threshold weights |
| 286 | struct parameters *dialign_para = para; |
| 287 | if(dialign_para->FAST_MODE) |
| 288 | dialign_para->PROT_SIM_SCORE_THRESHOLD += 0.25; |
| 289 | |
| 290 | // Consider Anchors -> default for DNA: DO_ANCHOR = 0; |
| 291 | struct alignment *algn = NULL; |
| 292 | if (!dialign_para->FAST_MODE) |
| 293 | algn = create_empty_alignment(in_seq_col); |
| 294 | struct alignment *salgn = create_empty_alignment(in_seq_col); |
| 295 | if (dialign_para->DEBUG > 1) |
| 296 | printf("empty alignments created\n"); |
| 297 | |
| 298 | // Compute pairwise diagonals |
| 299 | struct diag_col *all_diags = find_all_diags(smatrix, pdist, |
| 300 | in_seq_col, salgn, 1); |
| 301 | double duration = (clock()-tim)/CLOCKS_PER_SEC; |
| 302 | if (dialign_para->DEBUG > 1) |
| 303 | printf("Found %i diags in %f secs\n", |
| 304 | all_diags->diag_amount, duration); |
| 305 | int diag_amount = all_diags->diag_amount; |
| 306 | |
| 307 | // Compute alignment |
| 308 | double tim2 = clock(); |
| 309 | if (!dialign_para->FAST_MODE) { |
| 310 | vector<diag*> cp_diags(all_diags->diag_amount); |
| 311 | for(i = 0; i < diag_amount; i++) { |
| 312 | cp_diags[i] = (diag*)malloc(sizeof(struct diag)); |
| 313 | *(cp_diags[i]) = *(all_diags->diags[i]); |
| 314 | } |
| 315 | guided_aligner(algn, in_seq_col, all_diags, smatrix, |
| 316 | pdist, all_diags->gt_root, 1); |
| 317 | |
| 318 | for(i = 0; i < diag_amount; i++) |
| 319 | all_diags->diags[i] = cp_diags[i]; |
| 320 | |
| 321 | all_diags->diag_amount = diag_amount; |
| 322 | } |
| 323 | simple_aligner(in_seq_col, all_diags, smatrix, pdist, |
| 324 | salgn, 1); |
| 325 | duration = (clock()-tim2)/CLOCKS_PER_SEC; |
| 326 | |
| 327 | if (!dialign_para->FAST_MODE) { |
| 328 | if (dialign_para->DEBUG > 1) |
| 329 | printf("First alignment after %f secs. " |
| 330 | "simple: %f guided: %f\n", |
| 331 | duration, salgn->total_weight, algn->total_weight); |
| 332 | else |
| 333 | if (dialign_para->DEBUG > 1) |
no test coverage detected