vg
tools for working with variation graphs
|
#include <genome_state.hpp>
Public Member Functions | |
SnarlState (const NetGraph *graph) | |
Create a SnarlState that uses the given net graph. More... | |
void | dump () const |
Dump internal state to cerr. More... | |
size_t | size () const |
How many haplotypes traverse this snarl? More... | |
void | trace (size_t overall_lane, bool backward, const function< void(const handle_t &, size_t)> &iteratee) const |
void | insert (const vector< pair< handle_t, size_t >> &haplotype) |
const vector< pair< handle_t, size_t > > & | append (const vector< handle_t > &haplotype, bool backward=false) |
const vector< pair< handle_t, size_t > > & | insert (size_t overall_lane, const vector< handle_t > &haplotype, bool backward=false) |
vector< pair< handle_t, size_t > > | erase (size_t overall_lane) |
void | swap (size_t lane1, size_t lane2) |
Protected Attributes | |
vector< vector< pair< handle_t, size_t > > > | haplotypes |
unordered_map< handle_t, vector< decltype(haplotypes)::value_type::iterator > > | net_node_lanes |
const NetGraph * | graph |
Represents the state of a snarl: zero or more haplotypes traversing its NetGraph.
Only admits full-length traversals of a snarl from start to end.
Every traversing haplotype is assigned a "lane" number at which it traverses the snarl. Lane is the same looking backward or forward through the snarl. Within each child snarl or child node, the traversal is also assigned a lane. The lane assignments at the start and end nodes are the same, and define the lane assignments for the overall snarl. Traversals can be inserted at any lane number in any internal node.
vg::SnarlState::SnarlState | ( | const NetGraph * | graph | ) |
Create a SnarlState that uses the given net graph.
const vector< pair< handle_t, size_t > > & vg::SnarlState::append | ( | const vector< handle_t > & | haplotype, |
bool | backward = false |
||
) |
Insert the given traversal of this snarl from start to end or end to start (as determined by the backward flag), assigning each visit to a handle to the next available lane. Returns the haplotype annotated with lane assignments. If handles to the same node or child snarl appear more than once, their lane numbers will be strictly increasing.
void vg::SnarlState::dump | ( | ) | const |
Dump internal state to cerr.
vector< pair< handle_t, size_t > > vg::SnarlState::erase | ( | size_t | overall_lane | ) |
Erase the traversal of this haplotype in the given overall lane. Shifts everything in a higher lane 1 rank down. Returns the erased haplotype and its old lane assignments.
void vg::SnarlState::insert | ( | const vector< pair< handle_t, size_t >> & | haplotype | ) |
Insert the given traversal of this snarl from start to end, with the given lane assignments for each oriented handle. If handles to the same node or child snarl appear more than once, their lane numbers must be strictly increasing.
const vector< pair< handle_t, size_t > > & vg::SnarlState::insert | ( | size_t | overall_lane, |
const vector< handle_t > & | haplotype, | ||
bool | backward = false |
||
) |
Insert the given traversal of this snarl from start to end or end to start (as determined by the backward flag), assigning it to the given overall lane. Returns the haplotype annotated with lane assignments for all the internal handles. If the internal handles represent child snarls, this can be used to recurse down and insert traversals of them at the right lanes. If handles to the same node or child snarl appear more than once, their assigned lane numbers will be strictly increasing. Returns the haplotype annotated with lane assignments.
size_t vg::SnarlState::size | ( | ) | const |
How many haplotypes traverse this snarl?
void vg::SnarlState::swap | ( | size_t | lane1, |
size_t | lane2 | ||
) |
Swap the traversals of this haplotype in the two given overall lanes. Internal lane assignments (as are used by child snarls) are not affected.
void vg::SnarlState::trace | ( | size_t | overall_lane, |
bool | backward, | ||
const function< void(const handle_t &, size_t)> & | iteratee | ||
) | const |
Trace the haplotype int eh given overall lane in the given orientation. Yields the oriented handles visited and the per-forward-handle lane assignments.
|
protected |
We need to keep track of the net graph, because we may need to traverse haplotypes forward or reverse and we need to flip things.
|
protected |
|
protected |