Merge the paths of the specified seed path. * @return the merged contig path */
| 390 | * @return the merged contig path |
| 391 | */ |
| 392 | static ContigPath |
| 393 | mergePath(const Lengths& lengths, const ContigPathMap& paths, const ContigPath& seedPath) |
| 394 | { |
| 395 | assert(!seedPath.empty()); |
| 396 | ContigNode seed1 = seedPath.front(); |
| 397 | ContigPathMap::const_iterator path1It = paths.find(seed1.contigIndex()); |
| 398 | assert(path1It != paths.end()); |
| 399 | ContigPath path(path1It->second); |
| 400 | if (seedPath.front().sense()) |
| 401 | reverseComplement(path.begin(), path.end()); |
| 402 | if (opt::verbose > 1) |
| 403 | #pragma omp critical(cout) |
| 404 | cout << "\n* " << seedPath << '\n' |
| 405 | << get(g_contigNames, seedPath.front()) << '\t' << path << '\n'; |
| 406 | for (ContigPath::const_iterator it = seedPath.begin() + 1; it != seedPath.end(); ++it) { |
| 407 | ContigNode seed2 = *it; |
| 408 | ContigPathMap::const_iterator path2It = paths.find(seed2.contigIndex()); |
| 409 | assert(path2It != paths.end()); |
| 410 | ContigPath path2 = path2It->second; |
| 411 | if (seed2.sense()) |
| 412 | reverseComplement(path2.begin(), path2.end()); |
| 413 | |
| 414 | ContigNode pivot = find(path.begin(), path.end(), seed2) != path.end() ? seed2 : seed1; |
| 415 | ContigPath consensus = align(lengths, path, path2, pivot); |
| 416 | if (consensus.empty()) { |
| 417 | // This seed could be removed from the seed path. |
| 418 | if (opt::verbose > 1) |
| 419 | #pragma omp critical(cout) |
| 420 | cout << get(g_contigNames, seed2) << '\t' << path2 << '\n' << "\tinvalid\n"; |
| 421 | } else { |
| 422 | path.swap(consensus); |
| 423 | if (opt::verbose > 1) |
| 424 | #pragma omp critical(cout) |
| 425 | cout << get(g_contigNames, seed2) << '\t' << path2 << '\n' << '\t' << path << '\n'; |
| 426 | } |
| 427 | seed1 = seed2; |
| 428 | } |
| 429 | return path; |
| 430 | } |
| 431 | |
| 432 | /** A collection of contig paths. */ |
| 433 | typedef vector<ContigPath> ContigPaths; |
no test coverage detected