Attempt to merge the paths specified in mergeQ with path. * @return the number of paths merged */
| 351 | * @return the number of paths merged |
| 352 | */ |
| 353 | static unsigned |
| 354 | mergePaths( |
| 355 | const Lengths& lengths, |
| 356 | ContigPath& path, |
| 357 | deque<ContigNode>& mergeQ, |
| 358 | set<ContigNode>& seen, |
| 359 | const ContigPathMap& paths) |
| 360 | { |
| 361 | unsigned merged = 0; |
| 362 | deque<ContigNode> invalid; |
| 363 | for (ContigNode pivot; !mergeQ.empty(); mergeQ.pop_front()) { |
| 364 | pivot = mergeQ.front(); |
| 365 | ContigPathMap::const_iterator path2It = paths.find(pivot.contigIndex()); |
| 366 | if (path2It == paths.end()) |
| 367 | continue; |
| 368 | |
| 369 | ContigPath path2 = path2It->second; |
| 370 | if (pivot.sense()) |
| 371 | reverseComplement(path2.begin(), path2.end()); |
| 372 | ContigPath consensus = align(lengths, path, path2, pivot); |
| 373 | if (consensus.empty()) { |
| 374 | invalid.push_back(pivot); |
| 375 | continue; |
| 376 | } |
| 377 | |
| 378 | appendToMergeQ(mergeQ, seen, path2); |
| 379 | path.swap(consensus); |
| 380 | if (gDebugPrint) |
| 381 | #pragma omp critical(cout) |
| 382 | cout << get(g_contigNames, pivot) << '\t' << path2 << '\n' << '\t' << path << '\n'; |
| 383 | merged++; |
| 384 | } |
| 385 | mergeQ.swap(invalid); |
| 386 | return merged; |
| 387 | } |
| 388 | |
| 389 | /** Merge the paths of the specified seed path. |
| 390 | * @return the merged contig path |
no test coverage detected