vg
tools for working with variation graphs
|
#include <zip_code_tree.hpp>
Classes | |
class | iterator |
struct | oriented_seed_t |
class | reverse_iterator |
struct | seed_result_t |
struct | tree_item_t |
One item in the zip code tree, representing a node or edge of the tree. More... | |
Public Types | |
enum | tree_item_type_t { SEED =0, SNARL_START, SNARL_END, CHAIN_START, CHAIN_END, EDGE, NODE_COUNT } |
The type of an item in the zip code tree. More... | |
Public Member Functions | |
ZipCodeTree () | |
size_t | get_tree_size () const |
Get the number of items in the tree. More... | |
tree_item_t | get_item_at_index (size_t index) const |
Access the values in the zip_code_tree. More... | |
iterator | begin () const |
Get an iterator over indexes of seeds in the tree, left to right. More... | |
iterator | end () const |
Get the end iterator for seeds in the tree, left to right. More... | |
reverse_iterator | look_back (const iterator &from, size_t distance_limit=std::numeric_limits< size_t >::max()) const |
Get a reverse iterator looking left from where a forward iterator is, up to a distance limit. More... | |
reverse_iterator | rend () const |
Get the reverse end iterator for looking back from seeds. More... | |
template<typename Minimizer > | |
void | print_self (const vector< Seed > *seeds, const VectorView< Minimizer > *minimizers) const |
bool | node_is_invalid (nid_t id, const SnarlDistanceIndex &distance_index, size_t distance_limit=std::numeric_limits< size_t >::max()) const |
bool | node_is_in_cyclic_snarl (nid_t id, const SnarlDistanceIndex &distance_index) const |
Is the node in a cyclic (non-dag) snarl? More... | |
void | validate_zip_tree (const SnarlDistanceIndex &distance_index, const vector< Seed > *seeds, size_t distance_limit=std::numeric_limits< size_t >::max()) const |
Check that the tree is correct. More... | |
void | validate_snarl (std::vector< tree_item_t >::const_iterator zip_iterator, const SnarlDistanceIndex &distance_index, const vector< Seed > *seeds, size_t distance_limit=std::numeric_limits< size_t >::max()) const |
Helper function for validate_zip_tree for just a snarl. More... | |
std::pair< size_t, size_t > | dag_and_non_dag_snarl_count (const vector< Seed > &seeds, const SnarlDistanceIndex &distance_index) const |
Static Protected Member Functions | |
static bool | seed_is_reversed_at_depth (const Seed &seed, size_t depth, const SnarlDistanceIndex &distance_index) |
Protected Attributes | |
vector< tree_item_t > | zip_code_tree |
Private Types | |
typedef SnarlDistanceIndexClusterer::Seed | Seed |
Friends | |
class | ZipCodeForest |
A ZipCodeTree represents of set of SnarlDistanceIndexCluserer::Seed's (seed alignments between a read and reference) as a tree structure. The tree represents the connectivity of the seeds, based on the distance index. Edges are labelled with distance values. The tree can be traversed to find distances between seeds
This provides an iterator that, given a seed and a distance limit, iterates through seeds that are reachable within the distance limit
The ZipCodeTree is built by the ZipCodeForest, which represents a collection of trees
|
private |
|
inline |
Empty constructor ZipCodeTree's get filled in by ZipCodeForest's
auto vg::ZipCodeTree::begin | ( | ) | const |
Get an iterator over indexes of seeds in the tree, left to right.
std::pair< size_t, size_t > vg::ZipCodeTree::dag_and_non_dag_snarl_count | ( | const vector< Seed > & | seeds, |
const SnarlDistanceIndex & | distance_index | ||
) | const |
Count the number of snarls involved in the tree Returns a pair of <dag count, non-dag count> Assumes that the tree has already been filled in
auto vg::ZipCodeTree::end | ( | ) | const |
Get the end iterator for seeds in the tree, left to right.
|
inline |
Access the values in the zip_code_tree.
|
inline |
Get the number of items in the tree.
auto vg::ZipCodeTree::look_back | ( | const iterator & | from, |
size_t | distance_limit = std::numeric_limits<size_t>::max() |
||
) | const |
Get a reverse iterator looking left from where a forward iterator is, up to a distance limit.
bool vg::ZipCodeTree::node_is_in_cyclic_snarl | ( | nid_t | id, |
const SnarlDistanceIndex & | distance_index | ||
) | const |
Is the node in a cyclic (non-dag) snarl?
bool vg::ZipCodeTree::node_is_invalid | ( | nid_t | id, |
const SnarlDistanceIndex & | distance_index, | ||
size_t | distance_limit = std::numeric_limits<size_t>::max() |
||
) | const |
Is the given node in a multicomponent chain, looping chain, or anything else that would cause it to not have exact distances? The distances are only guaranteed to be correct up to the given distance limit Cyclic snarls don't count as being invalid
void vg::ZipCodeTree::print_self | ( | const vector< Seed > * | seeds, |
const VectorView< Minimizer > * | minimizers | ||
) | const |
Print the zip code tree to stderr ( and ) are used for the starts and ends of snarls [ and ] are used for the starts and ends of chains seeds are printed as their positions
auto vg::ZipCodeTree::rend | ( | ) | const |
Get the reverse end iterator for looking back from seeds.
|
staticprotected |
void vg::ZipCodeTree::validate_snarl | ( | std::vector< tree_item_t >::const_iterator | zip_iterator, |
const SnarlDistanceIndex & | distance_index, | ||
const vector< Seed > * | seeds, | ||
size_t | distance_limit = std::numeric_limits<size_t>::max() |
||
) | const |
Helper function for validate_zip_tree for just a snarl.
void vg::ZipCodeTree::validate_zip_tree | ( | const SnarlDistanceIndex & | distance_index, |
const vector< Seed > * | seeds, | ||
size_t | distance_limit = std::numeric_limits<size_t>::max() |
||
) | const |
Check that the tree is correct.
|
friend |
|
protected |