vg
tools for working with variation graphs
Classes | Public Types | Public Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Friends | List of all members
vg::ZipCodeTree Class Reference

#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_tzip_code_tree
 

Private Types

typedef SnarlDistanceIndexClusterer::Seed Seed
 

Friends

class ZipCodeForest
 

Detailed Description

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

Member Typedef Documentation

◆ Seed

Member Enumeration Documentation

◆ tree_item_type_t

The type of an item in the zip code tree.

Enumerator
SEED 
SNARL_START 
SNARL_END 
CHAIN_START 
CHAIN_END 
EDGE 
NODE_COUNT 

Constructor & Destructor Documentation

◆ ZipCodeTree()

vg::ZipCodeTree::ZipCodeTree ( )
inline

Empty constructor ZipCodeTree's get filled in by ZipCodeForest's

Member Function Documentation

◆ begin()

auto vg::ZipCodeTree::begin ( ) const

Get an iterator over indexes of seeds in the tree, left to right.

◆ dag_and_non_dag_snarl_count()

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

◆ end()

auto vg::ZipCodeTree::end ( ) const

Get the end iterator for seeds in the tree, left to right.

◆ get_item_at_index()

tree_item_t vg::ZipCodeTree::get_item_at_index ( size_t  index) const
inline

Access the values in the zip_code_tree.

◆ get_tree_size()

size_t vg::ZipCodeTree::get_tree_size ( ) const
inline

Get the number of items in the tree.

◆ look_back()

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.

◆ node_is_in_cyclic_snarl()

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?

◆ node_is_invalid()

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

◆ print_self()

template<typename Minimizer >
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

◆ rend()

auto vg::ZipCodeTree::rend ( ) const

Get the reverse end iterator for looking back from seeds.

◆ seed_is_reversed_at_depth()

bool vg::ZipCodeTree::seed_is_reversed_at_depth ( const Seed seed,
size_t  depth,
const SnarlDistanceIndex &  distance_index 
)
staticprotected

◆ validate_snarl()

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.

◆ validate_zip_tree()

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.

Friends And Related Function Documentation

◆ ZipCodeForest

friend class ZipCodeForest
friend

Member Data Documentation

◆ zip_code_tree

vector<tree_item_t> vg::ZipCodeTree::zip_code_tree
protected

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