vg
tools for working with variation graphs
|
#include <min_distance.hpp>
Public Member Functions | |
SnarlIndex (id_t parent_id, bool rev_in_parent, id_t id_in_parent, id_t end_id, bool is_unary_snarl, size_t depth, size_t num_nodes, bool in_chain) | |
SnarlIndex () | |
void | load (istream &in, bool include_component) |
void | serialize (ostream &out) const |
Serialize the snarl. More... | |
int64_t | snarl_distance (size_t start, size_t end) const |
int64_t | node_length (size_t i) const |
int64_t | snarl_length () const |
pair< int64_t, int64_t > | dist_to_ends (size_t rank, int64_t distL, int64_t distR) const |
void | insert_distance (size_t start, size_t end, int64_t dist) |
bool | is_trivial_snarl () const |
void | print_self () const |
json_t * | snarl_to_json () |
Protected Member Functions | |
size_t | index (size_t start, size_t end) const |
The index into distances for distance start->end. More... | |
Protected Attributes | |
int_vector | distances |
bool | in_chain |
True if this snarl is in a chain. More... | |
id_t | parent_id |
bool | rev_in_parent |
id_t | id_in_parent |
id_t | end_id |
size_t | num_nodes |
Number of nodes in the snarl. More... | |
size_t | depth |
Depth in the snarl tree - 0 for root. More... | |
bool | is_unary_snarl |
bool | is_simple_snarl |
True if all children are nodes (not snarls or chains) and for every child node,. More... | |
int64_t | max_width |
The maximum width of the snarl - the maximum of all minimum distance paths from each node to. More... | |
Friends | |
class | MinimumDistanceIndex |
class | SnarlSeedClusterer |
Index for calculating minimum distances among nodes in a snarl Stores minimum distances between nodes in the netgraph of a snarl Also keeps track of the parent of the snarl
vg::MinimumDistanceIndex::SnarlIndex::SnarlIndex | ( | id_t | parent_id, |
bool | rev_in_parent, | ||
id_t | id_in_parent, | ||
id_t | end_id, | ||
bool | is_unary_snarl, | ||
size_t | depth, | ||
size_t | num_nodes, | ||
bool | in_chain | ||
) |
Constructor for the snarl index if inChain is true, parent_id and rev_in_parent are for the chain chain the snarl participates in. otherwise, for the parent snarl
vg::MinimumDistanceIndex::SnarlIndex::SnarlIndex | ( | ) |
pair< int64_t, int64_t > vg::MinimumDistanceIndex::SnarlIndex::dist_to_ends | ( | size_t | rank, |
int64_t | distL, | ||
int64_t | distR | ||
) | const |
Given distances from a position to either end of a node, find the shortest distance from that position to the start and end nodes of the snarl rank is in the forward direction, but checks both forward and reverse
|
protected |
The index into distances for distance start->end.
void vg::MinimumDistanceIndex::SnarlIndex::insert_distance | ( | size_t | start, |
size_t | end, | ||
int64_t | dist | ||
) |
For use during construction, add the distance from start to end to the index
bool vg::MinimumDistanceIndex::SnarlIndex::is_trivial_snarl | ( | ) | const |
void vg::MinimumDistanceIndex::SnarlIndex::load | ( | istream & | in, |
bool | include_component | ||
) |
|
inline |
Length of a node in the netgraph of the snarl If it is a node, then the length of the node. If it is a snarl or chain, then the shortest distance between the boundaries i is the rank of the node in the snarl
void vg::MinimumDistanceIndex::SnarlIndex::print_self | ( | ) | const |
void vg::MinimumDistanceIndex::SnarlIndex::serialize | ( | ostream & | out | ) | const |
Serialize the snarl.
|
inline |
Distance between start and end, not including the lengths of the two nodes start and end are the ranks of the node+direction, given by primary_snarls and secondary_snarl Only works for nodes heading their chains (which represent the chains), or snarl boundaries. Rank 0 is the start node and rank num_nodes*2-1 is the end node, both pointing into the snarl
int64_t vg::MinimumDistanceIndex::SnarlIndex::snarl_length | ( | ) | const |
Total length of the snarl-shortest distance from start to end including the lengths of boundary nodes
json_t * vg::MinimumDistanceIndex::SnarlIndex::snarl_to_json | ( | ) |
|
friend |
|
friend |
|
protected |
Depth in the snarl tree - 0 for root.
|
protected |
Store the distance between every pair nodes, not including the lengths of the nodes. The lengths of each of the nodes are stored as the first n entries Distances stored are 1 greater than actual distances -1 (stored as 0) indicates no path For child snarls that are unary or only connected to one node in the snarl, distances between that node leaving the snarl and any other node is -1
|
protected |
|
protected |
id of this snarl in the parent. If the parent is a chain, then the id of the boundary node that occurs first in the order of the chain
|
protected |
True if this snarl is in a chain.
|
protected |
True if all children are nodes (not snarls or chains) and for every child node,.
|
protected |
True if this snarl is a unary snarl Since the start and end node are the same, the last ranking node is no longer the end node if this is true
|
protected |
The maximum width of the snarl - the maximum of all minimum distance paths from each node to.
|
protected |
Number of nodes in the snarl.
|
protected |
id of the parent snarl or chain of this snarl 0 if this is a top level snarl with no chain
|
protected |