vg
tools for working with variation graphs
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
vg::BandedGlobalAligner< IntType >::AltTracebackStack Class Reference

#include <banded_global_aligner.hpp>

Classes

class  Deflection
 

Public Member Functions

 AltTracebackStack (const HandleGraph &graph, int64_t max_multi_alns, int32_t empty_score, unordered_set< BAMatrix * > &source_node_matrices, unordered_set< BAMatrix * > &sink_node_matrices, int8_t gap_open, int8_t gap_extend, IntType min_inf)
 
 ~AltTracebackStack ()
 
void get_alignment_start (int64_t &node_id, matrix_t &matrix)
 Get the start position of the current alignment and advance deflection pointer to the first deflection. More...
 
bool has_next ()
 Are there any more alternate alignments in the stack? More...
 
void next_traceback_alignment ()
 Advance to the next alternate trac. More...
 
bool next_is_empty ()
 Is the next highest scoring alignment an empty path with no DP matrices? More...
 
void next_empty_alignment (Alignment &alignment)
 Get the next empty path alignment. More...
 
void propose_deflection (const IntType score, const int64_t from_node_id, const int64_t row_idx, const int64_t col_idx, const int64_t to_node_id, const matrix_t to_matrix)
 
IntType current_traceback_score ()
 Score of the current traceback. More...
 
const list< int64_t > & current_empty_prefix ()
 The prefix of the current traceback that consists of only empty nodes. More...
 
bool at_next_deflection (int64_t node_id, int64_t row_idx, int64_t col_idx)
 Are these the coordinates of the next deflection? More...
 
BandedGlobalAligner::matrix_t deflect_to_matrix ()
 Get the matrix to deflect to and advance to the next deflection. More...
 
BandedGlobalAligner::matrix_t deflect_to_matrix (int64_t &to_node_id)
 Get the matrix and the node id to deflect to (for use at a node boundary) More...
 

Private Member Functions

void insert_traceback (const vector< Deflection > &traceback_prefix, const IntType score, const int64_t from_node_id, const int64_t row_idx, const int64_t col_idx, const int64_t to_node_id, const matrix_t to_matrix, const list< int64_t > &empty_node_prefix)
 Internal method for propose_deflection. More...
 

Private Attributes

int64_t max_multi_alns
 Maximum number of alternate alignments to keep track of (including the optimal alignment) More...
 
list< tuple< vector< Deflection >, IntType, list< int64_t > > > alt_tracebacks
 
list< list< int64_t > > empty_full_paths
 All of the paths through the graph that take only empty nodes. More...
 
int32_t empty_score
 
const HandleGraphgraph
 
list< tuple< vector< Deflection >, IntType, list< int64_t > > >::iterator curr_traceback
 Pointer to the traceback directions for the alignment we are currently tracing back. More...
 
vector< Deflection >::iterator curr_deflxn
 Pointer to the next deviation from the optimal traceback we will take. More...
 

Detailed Description

template<class IntType>
class vg::BandedGlobalAligner< IntType >::AltTracebackStack

Specialized linked list stack that finds and keeps track of the top-scoring non-optimal alignments. Sub-optimal alignments are represented by the locations where their traceback deviates from the optimal traceback, with other steps of the traceback implicitly following the optimal path. New tracebacks can be discovered while performing any of the tracebacks and added to the stack.

Constructor & Destructor Documentation

◆ AltTracebackStack()

template<class IntType >
vg::BandedGlobalAligner< IntType >::AltTracebackStack::AltTracebackStack ( const HandleGraph graph,
int64_t  max_multi_alns,
int32_t  empty_score,
unordered_set< BAMatrix * > &  source_node_matrices,
unordered_set< BAMatrix * > &  sink_node_matrices,
int8_t  gap_open,
int8_t  gap_extend,
IntType  min_inf 
)

◆ ~AltTracebackStack()

template<class IntType >
vg::BandedGlobalAligner< IntType >::AltTracebackStack::~AltTracebackStack

Member Function Documentation

◆ at_next_deflection()

template<class IntType >
bool vg::BandedGlobalAligner< IntType >::AltTracebackStack::at_next_deflection ( int64_t  node_id,
int64_t  row_idx,
int64_t  col_idx 
)
inline

Are these the coordinates of the next deflection?

◆ current_empty_prefix()

template<class IntType >
const list< int64_t > & vg::BandedGlobalAligner< IntType >::AltTracebackStack::current_empty_prefix
inline

The prefix of the current traceback that consists of only empty nodes.

◆ current_traceback_score()

template<class IntType >
IntType vg::BandedGlobalAligner< IntType >::AltTracebackStack::current_traceback_score
inline

Score of the current traceback.

◆ deflect_to_matrix() [1/2]

template<class IntType >
BandedGlobalAligner< IntType >::matrix_t vg::BandedGlobalAligner< IntType >::AltTracebackStack::deflect_to_matrix
inline

Get the matrix to deflect to and advance to the next deflection.

◆ deflect_to_matrix() [2/2]

template<class IntType >
BandedGlobalAligner< IntType >::matrix_t vg::BandedGlobalAligner< IntType >::AltTracebackStack::deflect_to_matrix ( int64_t &  to_node_id)
inline

Get the matrix and the node id to deflect to (for use at a node boundary)

◆ get_alignment_start()

template<class IntType >
void vg::BandedGlobalAligner< IntType >::AltTracebackStack::get_alignment_start ( int64_t &  node_id,
matrix_t matrix 
)
inline

Get the start position of the current alignment and advance deflection pointer to the first deflection.

◆ has_next()

template<class IntType >
bool vg::BandedGlobalAligner< IntType >::AltTracebackStack::has_next
inline

Are there any more alternate alignments in the stack?

◆ insert_traceback()

template<class IntType >
void vg::BandedGlobalAligner< IntType >::AltTracebackStack::insert_traceback ( const vector< Deflection > &  traceback_prefix,
const IntType  score,
const int64_t  from_node_id,
const int64_t  row_idx,
const int64_t  col_idx,
const int64_t  to_node_id,
const matrix_t  to_matrix,
const list< int64_t > &  empty_node_prefix 
)
inlineprivate

Internal method for propose_deflection.

◆ next_empty_alignment()

template<class IntType >
void vg::BandedGlobalAligner< IntType >::AltTracebackStack::next_empty_alignment ( Alignment alignment)
inline

Get the next empty path alignment.

◆ next_is_empty()

template<class IntType >
bool vg::BandedGlobalAligner< IntType >::AltTracebackStack::next_is_empty
inline

Is the next highest scoring alignment an empty path with no DP matrices?

◆ next_traceback_alignment()

template<class IntType >
void vg::BandedGlobalAligner< IntType >::AltTracebackStack::next_traceback_alignment
inline

Advance to the next alternate trac.

◆ propose_deflection()

template<class IntType >
void vg::BandedGlobalAligner< IntType >::AltTracebackStack::propose_deflection ( const IntType  score,
const int64_t  from_node_id,
const int64_t  row_idx,
const int64_t  col_idx,
const int64_t  to_node_id,
const matrix_t  to_matrix 
)
inline

Check if a deflection from the current traceback is better than any alignments currently in the stack and if so insert it in the correct position

Member Data Documentation

◆ alt_tracebacks

template<class IntType >
list<tuple<vector<Deflection>, IntType, list<int64_t> > > vg::BandedGlobalAligner< IntType >::AltTracebackStack::alt_tracebacks
private

List of tuples that contain the scores of alternate alignments, the places where their traceback deviates from the optimum (Deflections), and all empty nodes that occur at the suffix of the traceback (if any). Maintains an invariant where stack is sorted in descending score order.

◆ curr_deflxn

template<class IntType >
vector<Deflection>::iterator vg::BandedGlobalAligner< IntType >::AltTracebackStack::curr_deflxn
private

Pointer to the next deviation from the optimal traceback we will take.

◆ curr_traceback

template<class IntType >
list<tuple<vector<Deflection>, IntType, list<int64_t> > >::iterator vg::BandedGlobalAligner< IntType >::AltTracebackStack::curr_traceback
private

Pointer to the traceback directions for the alignment we are currently tracing back.

◆ empty_full_paths

template<class IntType >
list<list<int64_t> > vg::BandedGlobalAligner< IntType >::AltTracebackStack::empty_full_paths
private

All of the paths through the graph that take only empty nodes.

◆ empty_score

template<class IntType >
int32_t vg::BandedGlobalAligner< IntType >::AltTracebackStack::empty_score
private

◆ graph

template<class IntType >
const HandleGraph& vg::BandedGlobalAligner< IntType >::AltTracebackStack::graph
private

◆ max_multi_alns

template<class IntType >
int64_t vg::BandedGlobalAligner< IntType >::AltTracebackStack::max_multi_alns
private

Maximum number of alternate alignments to keep track of (including the optimal alignment)


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