src/c++/lib/genotyping/BreakpointFinder.cpp
/**
 * Create a map of all breakpoints in a graph
 * @param wgraph the graph
 * @return a breakpoint map for the graph
 */
Create a map of all breakpoints in a graph
@param wgraph the graph
@return a breakpoint map for the graph
Create a map of all breakpoints in a graph @param wgraph the graph @return a breakpoint map for the graph
BreakpointMap createBreakpointMap(graphtools::Graph const& wgraph)
{
    BreakpointMap breakpoint_map;
    const auto source_node = static_cast<NodeId>(0);
    const auto sink_node = static_cast<NodeId>(wgraph.numNodes() - 1);
    const bool has_source_and_sink = wgraph.nodeName(source_node) == "source" && wgraph.nodeName(sink_node) == "sink";
    for (auto node = source_node; node <= sink_node; ++node)
    {
        if (has_source_and_sink && (node == source_node || node == sink_node))
        {
            continue;
        }
        const string& node_name = wgraph.nodeName(node);
        if (wgraph.successors(node).size() > 1)
        {
            breakpoint_map.emplace(node_name + "_", BreakpointStatistics(wgraph, node, true));
        }
        if (wgraph.predecessors(node).size() > 1)
        {
            breakpoint_map.emplace(string("_") + node_name, BreakpointStatistics(wgraph, node, false));
        }
    }
    return breakpoint_map;
}
BreakpointMap createBreakpointMap ( graphtools :: Graph const & wgraph ) { BreakpointMap breakpoint_map ; const auto source_node = static_cast < NodeId > ( 0 ) ; const auto sink_node = static_cast < NodeId > ( wgraph . numNodes ( ) - 1 ) ; const bool has_source_and_sink = wgraph . nodeName ( source_node ) == " " && wgraph . nodeName ( sink_node ) == " " ; for ( auto node = source_node ; node <= sink_node ; ++ node ) { if ( has_source_and_sink && ( node == source_node || node == sink_node ) ) { continue ; } const string & node_name = wgraph . nodeName ( node ) ; if ( wgraph . successors ( node ) . size ( ) > 1 ) { breakpoint_map . emplace ( node_name + " " , BreakpointStatistics ( wgraph , node , true ) ) ; } if ( wgraph . predecessors ( node ) . size ( ) > 1 ) { breakpoint_map . emplace ( string ( " " ) + node_name , BreakpointStatistics ( wgraph , node , false ) ) ; } } return breakpoint_map ; }
Create a map of all breakpoints in a graph
 @param wgraph the graph
 @return a breakpoint map for the graph
Create a map of all breakpoints in a graph @param wgraph the graph @return a breakpoint map for the graph