vg
tools for working with variation graphs
Classes | Namespaces | Typedefs | Functions
chain_items.hpp File Reference
#include "extract_containing_graph.hpp"
#include "../gbwt_extender.hpp"
#include "../snarl_seed_clusterer.hpp"
#include "../zip_code_tree.hpp"
#include "../handle.hpp"
#include "../explainer.hpp"
#include "../utility.hpp"
#include <bdsg/hash_graph.hpp>

Classes

class  vg::algorithms::Anchor
 
class  vg::algorithms::TracedScore
 

Namespaces

 vg
 
 vg::algorithms
 
 std
 Hash functor to hash NodeSides using std::hash.
 

Typedefs

using vg::algorithms::transition_iteratee = std::function< void(size_t from_anchor, size_t to_anchor, size_t read_distance, size_t graph_distance)>
 
using vg::algorithms::transition_iterator = std::function< void(const VectorView< Anchor > &to_chain, const SnarlDistanceIndex &distance_index, const HandleGraph &graph, size_t max_indel_bases, const transition_iteratee &callback)>
 

Functions

ostream & vg::algorithms::operator<< (ostream &out, const Anchor &anchor)
 Explain an Anchor to the given stream. More...
 
vg::algorithms::TracedScore std::max (const vg::algorithms::TracedScore &a, const vg::algorithms::TracedScore &b)
 Allow maxing TracedScore. More...
 
ostream & vg::algorithms::operator<< (ostream &out, const TracedScore &value)
 Print operator. More...
 
void vg::algorithms::sort_anchor_indexes (const std::vector< Anchor > &items, std::vector< size_t > &indexes)
 
transition_iterator vg::algorithms::lookback_transition_iterator (size_t max_lookback_bases, size_t min_lookback_items, size_t lookback_item_hard_cap)
 
transition_iterator vg::algorithms::zip_tree_transition_iterator (const std::vector< SnarlDistanceIndexClusterer::Seed > &seeds, const ZipCodeTree &zip_code_tree, size_t max_lookback_bases)
 
TracedScore vg::algorithms::chain_items_dp (vector< TracedScore > &chain_scores, const VectorView< Anchor > &to_chain, const SnarlDistanceIndex &distance_index, const HandleGraph &graph, int gap_open, int gap_extension, const transition_iterator &for_each_transition, int item_bonus, double item_scale, double gap_scale, double points_per_possible_match, size_t max_indel_bases, bool show_work)
 
vector< pair< vector< size_t >, int > > vg::algorithms::chain_items_traceback (const vector< TracedScore > &chain_scores, const VectorView< Anchor > &to_chain, const TracedScore &best_past_ending_score_ever, int item_bonus, double item_scale, size_t max_tracebacks)
 
vector< pair< int, vector< size_t > > > vg::algorithms::find_best_chains (const VectorView< Anchor > &to_chain, const SnarlDistanceIndex &distance_index, const HandleGraph &graph, int gap_open, int gap_extension, size_t max_chains, const transition_iterator &for_each_transition, int item_bonus, double item_scale, double gap_scale, double points_per_possible_match, size_t max_indel_bases, bool show_work)
 
pair< int, vector< size_t > > vg::algorithms::find_best_chain (const VectorView< Anchor > &to_chain, const SnarlDistanceIndex &distance_index, const HandleGraph &graph, int gap_open, int gap_extension, const transition_iterator &for_each_transition, int item_bonus, double item_scale, double gap_scale, double points_per_possible_match, size_t max_indel_bases)
 
int vg::algorithms::score_best_chain (const VectorView< Anchor > &to_chain, const SnarlDistanceIndex &distance_index, const HandleGraph &graph, int gap_open, int gap_extension)
 
int vg::algorithms::score_chain_gap (size_t distance_difference, size_t base_seed_length)
 
size_t vg::algorithms::get_graph_distance (const Anchor &from, const Anchor &to, const SnarlDistanceIndex &distance_index, const HandleGraph &graph, size_t distance_limit=std::numeric_limits< size_t >::max())
 Get distance in the graph, or std::numeric_limits<size_t>::max() if unreachable or beyond the limit. More...
 
size_t vg::algorithms::get_read_distance (const Anchor &from, const Anchor &to)
 Get distance in the read, or std::numeric_limits<size_t>::max() if unreachable. More...
 

Detailed Description

Algorithms for chaining subalignments into larger alignments.

To use these algorithms, decide on the type (Anchor) you want to chain up.

Then, make a dynamic programming table: vector<TracedScore>.

Then, call chain_items_dp() to fill in the dynamic programming table and get the score of the best chain.

You can use chain_items_traceback() to get a traceback of the chain's items in order.

Helper entry points are find_best_chain() and score_best_chain() which set up the DP for you and do the traceback if appropriate.