vg
tools for working with variation graphs
Public Member Functions | Protected Attributes | List of all members
vg::FlowTraversalFinder Class Reference

#include <traversal_finder.hpp>

Inheritance diagram for vg::FlowTraversalFinder:
vg::TraversalFinder

Public Member Functions

 FlowTraversalFinder (const HandleGraph &graph, SnarlManager &snarl_manager, size_t K, function< double(handle_t)> node_weight_callback, function< double(edge_t)> edge_weight_callback, size_t max_traversal_length=numeric_limits< size_t >::max())
 
virtual vector< SnarlTraversalfind_traversals (const Snarl &site)
 
virtual pair< vector< SnarlTraversal >, vector< double > > find_weighted_traversals (const Snarl &site, bool greedy_avg=false, const HandleGraph *overlay=nullptr)
 
void setK (size_t k)
 Set K. More...
 
- Public Member Functions inherited from vg::TraversalFinder
virtual ~TraversalFinder ()=default
 
virtual vector< Traversalfind_traversals (const handle_t &snarl_start, const handle_t &snarl_end)
 

Protected Attributes

const HandleGraphgraph
 
SnarlManagersnarl_manager
 
size_t K
 The K-best traversals are returned. More...
 
function< double(handle_t)> node_weight_callback
 Callbacks to get supports. More...
 
function< double(edge_t)> edge_weight_callback
 
size_t max_traversal_length
 Call off the search as soon as a traversal of this length (bp) is encountered. More...
 

Detailed Description

Finds traversals with the most flow. Node and edge weights are specified using the callbacks and can be used, ex, to yield read supports.
If one traversal is requested, then the path with the highest flow (whose node or edge with the minimum weight is maximum) is returned. If K traversals are specified, then the K highest flow traversals are returned. This is designed to be a replacement for RepresentativeTraversalFinder. It should do a better job of enumerating off-reference traversals, and will of course guarantee to return all the optimal traversals (in the context of max flow). Unlike RepresentativeTraversalFinder, it does not currently support nested snarls, so all traversals returned are explicit.
It is possible that it will blow up on massive snarls, espeically for large Ks.

Constructor & Destructor Documentation

◆ FlowTraversalFinder()

vg::FlowTraversalFinder::FlowTraversalFinder ( const HandleGraph graph,
SnarlManager snarl_manager,
size_t  K,
function< double(handle_t)>  node_weight_callback,
function< double(edge_t)>  edge_weight_callback,
size_t  max_traversal_length = numeric_limits<size_t>::max() 
)

Member Function Documentation

◆ find_traversals()

vector< SnarlTraversal > vg::FlowTraversalFinder::find_traversals ( const Snarl site)
virtual

Return the K widest (most flow) traversals through the site The reference traversal will be returned first (regardless of its flow). After, the traversals are listed in decreasing order

Implements vg::TraversalFinder.

◆ find_weighted_traversals()

pair< vector< SnarlTraversal >, vector< double > > vg::FlowTraversalFinder::find_weighted_traversals ( const Snarl site,
bool  greedy_avg = false,
const HandleGraph overlay = nullptr 
)
virtual

Return the K widest traversals, along with their flows

◆ setK()

void vg::FlowTraversalFinder::setK ( size_t  k)

Set K.

Member Data Documentation

◆ edge_weight_callback

function<double(edge_t)> vg::FlowTraversalFinder::edge_weight_callback
protected

◆ graph

const HandleGraph& vg::FlowTraversalFinder::graph
protected

◆ K

size_t vg::FlowTraversalFinder::K
protected

The K-best traversals are returned.

◆ max_traversal_length

size_t vg::FlowTraversalFinder::max_traversal_length
protected

Call off the search as soon as a traversal of this length (bp) is encountered.

◆ node_weight_callback

function<double(handle_t)> vg::FlowTraversalFinder::node_weight_callback
protected

Callbacks to get supports.

◆ snarl_manager

SnarlManager& vg::FlowTraversalFinder::snarl_manager
protected

The documentation for this class was generated from the following files: