MCPcopy Create free account
hub / github.com/BirolLab/abyss / addMissingEdges

Function addMissingEdges

MergePaths/MergePaths.cpp:631–669  ·  view source on GitHub ↗

Add missing overlap edges. For each vertex u with at least two * outgoing edges, (u,v1) and (u,v2), add the edge (v1,v2) if v1 < v2, * and add the edge (v2,v1) if v2 < v1. */

Source from the content-addressed store, hash-verified

629 * and add the edge (v2,v1) if v2 < v1.
630 */
631static void
632addMissingEdges(const Lengths& lengths, PathGraph& g, const ContigPathMap& paths)
633{
634 typedef graph_traits<PathGraph>::adjacency_iterator Vit;
635 typedef graph_traits<PathGraph>::vertex_iterator Uit;
636 typedef graph_traits<PathGraph>::vertex_descriptor V;
637
638 unsigned numAdded = 0;
639 pair<Uit, Uit> urange = vertices(g);
640 for (Uit uit = urange.first; uit != urange.second; ++uit) {
641 V u = *uit;
642 if (out_degree(u, g) < 2)
643 continue;
644 pair<Vit, Vit> vrange = adjacent_vertices(u, g);
645 for (Vit vit1 = vrange.first; vit1 != vrange.second;) {
646 V v1 = *vit1;
647 ++vit1;
648 assert(v1 != u);
649 ContigPath path1 = getPath(paths, v1);
650 if (find(path1.begin(), path1.end(), ContigPath::value_type(u)) == path1.end())
651 continue;
652 for (Vit vit2 = vit1; vit2 != vrange.second; ++vit2) {
653 V v2 = *vit2;
654 assert(v2 != u);
655 assert(v1 != v2);
656 if (edge(v1, v2, g).second || edge(v2, v1, g).second)
657 continue;
658 ContigPath path2 = getPath(paths, v2);
659 if (find(path2.begin(), path2.end(), ContigPath::value_type(u)) == path2.end())
660 continue;
661 numAdded += addOverlapEdge(lengths, g, u, v1, path1, v2, path2);
662 }
663 }
664 }
665 if (opt::verbose > 0)
666 cout << "Added " << numAdded << " missing edges.\n";
667 if (!opt::db.empty())
668 addToDb(db, "addedMissingEdges", numAdded);
669}
670
671/** Remove transitive edges. */
672static void

Callers 1

buildPathGraphFunction · 0.85

Calls 11

findFunction · 0.85
addOverlapEdgeFunction · 0.85
addToDbFunction · 0.85
getPathFunction · 0.70
verticesFunction · 0.50
out_degreeFunction · 0.50
adjacent_verticesFunction · 0.50
edgeFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected