Assemble overlapping paths. */
| 533 | |
| 534 | /** Assemble overlapping paths. */ |
| 535 | static void |
| 536 | assembleOverlappingPaths(Graph& g, Paths& paths, vector<string>& pathIDs) |
| 537 | { |
| 538 | if (paths.empty()) |
| 539 | return; |
| 540 | |
| 541 | // Find overlapping paths. |
| 542 | Overlaps overlaps = findOverlaps(g, paths); |
| 543 | addPathOverlapEdges(g, paths, pathIDs, overlaps); |
| 544 | |
| 545 | // Create a property map of path overlaps. |
| 546 | OverlapMap overlapMap; |
| 547 | for (Overlaps::const_iterator it = overlaps.begin(); it != overlaps.end(); ++it) |
| 548 | overlapMap.insert(OverlapMap::value_type( |
| 549 | OverlapMap::key_type(it->source.descriptor(), it->target.descriptor()), it->overlap)); |
| 550 | |
| 551 | // Assemble unambiguously overlapping paths. |
| 552 | Paths merges; |
| 553 | assemble_if(g, back_inserter(merges), IsPathOverlap(g, overlapMap, IsPositive<Graph>(g))); |
| 554 | |
| 555 | // Merge overlapping paths. |
| 556 | g_contigNames.unlock(); |
| 557 | assert(!pathIDs.empty()); |
| 558 | setNextContigName(pathIDs.back()); |
| 559 | for (Paths::const_iterator it = merges.begin(); it != merges.end(); ++it) { |
| 560 | string name = createContigName(); |
| 561 | if (opt::verbose > 0) |
| 562 | cerr << name << '\t' << *it << '\n'; |
| 563 | Vertex u(paths.size(), false); |
| 564 | put(vertex_name, g, u.descriptor(), name); |
| 565 | pathIDs.push_back(name); |
| 566 | paths.push_back(mergePaths(paths, overlapMap, *it)); |
| 567 | |
| 568 | // Remove the merged paths. |
| 569 | for (ContigPath::const_iterator it2 = it->begin(); it2 != it->end(); ++it2) { |
| 570 | if (isPath(*it2)) |
| 571 | paths[it2->id() - Vertex::s_offset].clear(); |
| 572 | } |
| 573 | } |
| 574 | g_contigNames.lock(); |
| 575 | } |
| 576 | |
| 577 | int |
| 578 | main(int argc, char** argv) |
no test coverage detected