Add the path overlap edges to the specified graph. */
| 425 | |
| 426 | /** Add the path overlap edges to the specified graph. */ |
| 427 | static void |
| 428 | addPathOverlapEdges( |
| 429 | Graph& g, |
| 430 | const Paths& paths, |
| 431 | const vector<string>& pathIDs, |
| 432 | const Overlaps& overlaps) |
| 433 | { |
| 434 | typedef graph_traits<Graph>::vertex_descriptor V; |
| 435 | const bool allowParallelEdge = opt::mode == opt::ASSEMBLE; |
| 436 | |
| 437 | // Add the path vertices. |
| 438 | g_contigNames.unlock(); |
| 439 | for (Paths::const_iterator it = paths.begin(); it != paths.end(); ++it) { |
| 440 | const ContigPath& path = *it; |
| 441 | const string& id = pathIDs[it - paths.begin()]; |
| 442 | if (!path.empty()) { |
| 443 | V u = merge(g, path.begin(), path.end()); |
| 444 | put(vertex_name, g, u, id); |
| 445 | } |
| 446 | } |
| 447 | g_contigNames.lock(); |
| 448 | |
| 449 | // Remove the single-end contigs that are in paths. |
| 450 | for (Paths::const_iterator it = paths.begin(); it != paths.end(); ++it) |
| 451 | remove_vertex_if( |
| 452 | g, it->begin(), it->end(), [](const ContigNode& c) { return !c.ambiguous(); }); |
| 453 | |
| 454 | // Add the path edges. |
| 455 | for (Overlaps::const_iterator it = overlaps.begin(); it != overlaps.end(); ++it) { |
| 456 | V u = it->source.descriptor(); |
| 457 | V v = it->target.descriptor(); |
| 458 | if (allowParallelEdge || !edge(u, v, g).second) |
| 459 | add_edge(u, v, it->distance, static_cast<DG&>(g)); |
| 460 | else if (opt::verbose > 0) |
| 461 | cerr << "ambiguous overlap: " << get(vertex_name, g, u) << " -> " |
| 462 | << get(vertex_name, g, v) << '\n'; |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | typedef graph_traits<Graph>::edge_descriptor edge_descriptor; |
| 467 |