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

#include <surjector.hpp>

Inheritance diagram for vg::Surjector:
vg::AlignerClient

Public Types

using path_chunk_t = pair< pair< string::const_iterator, string::const_iterator >, Path >
 a local type that represents a read interval matched to a portion of the alignment path More...
 

Public Member Functions

 Surjector (const PathPositionHandleGraph *graph)
 
Alignment surject (const Alignment &source, const set< string > &path_names, string &path_name_out, int64_t &path_pos_out, bool &path_rev_out, bool allow_negative_scores=false, bool preserve_deletions=false) const
 
Alignment surject (const Alignment &source, const set< string > &path_names, bool allow_negative_scores=false, bool preserve_deletions=false) const
 
- Public Member Functions inherited from vg::AlignerClient
void set_alignment_scores (int8_t match, int8_t mismatch, int8_t gap_open, int8_t gap_extend, int8_t full_length_bonus)
 Set all the aligner scoring parameters and create the stored aligner instances. More...
 
void set_alignment_scores (std::istream &matrix_stream, int8_t gap_open, int8_t gap_extend, int8_t full_length_bonus)
 
void set_alignment_scores (const int8_t *score_matrix, int8_t gap_open, int8_t gap_extend, int8_t full_length_bonus)
 

Private Member Functions

Alignment realigning_surject (const PathPositionHandleGraph *graph, const Alignment &source, const path_handle_t &path_handle, const vector< path_chunk_t > &path_chunks, bool allow_negative_scores, bool preserve_N_alignments=false, bool preserve_tail_indel_anchors=false) const
 
Alignment spliced_surject (const PathPositionHandleGraph *path_position_graph, const Alignment &source, const path_handle_t &path_handle, const vector< path_chunk_t > &path_chunks, const vector< pair< step_handle_t, step_handle_t >> &ref_chunks, bool allow_negative_scores) const
 
unordered_map< path_handle_t, pair< vector< path_chunk_t >, vector< pair< step_handle_t, step_handle_t > > > > extract_overlapping_paths (const PathPositionHandleGraph *graph, const Alignment &source, const unordered_set< path_handle_t > &surjection_paths) const
 get the chunks of the alignment path that follow the given reference paths More...
 
pair< size_t, size_t > compute_path_interval (const PathPositionHandleGraph *graph, const Alignment &source, path_handle_t path_handle, const vector< path_chunk_t > &path_chunks) const
 compute the widest interval of path positions that the realigned sequence could align to More...
 
unordered_map< id_t, pair< id_t, bool > > extract_linearized_path_graph (const PathPositionHandleGraph *graph, MutableHandleGraph *into, path_handle_t path_handle, size_t first, size_t last) const
 make a linear graph that corresponds to a path interval, possibly duplicating nodes in case of cycles More...
 
void set_path_position (const PathPositionHandleGraph *graph, const Alignment &surjected, path_handle_t best_path_handle, string &path_name_out, int64_t &path_pos_out, bool &path_rev_out) const
 associate a path position and strand to a surjected alignment against this path More...
 
void set_path_position_inexact (const PathPositionHandleGraph *graph, const Alignment &surjected, path_handle_t best_path_handle, string &path_name_out, int64_t &path_pos_out, bool &path_rev_out) const
 another algorithm that doesn't blow up if the alignment preserved deletions More...
 
vector< vector< size_t > > reverse_adjacencies (const vector< vector< size_t >> &adj) const
 reverses an adjacency list More...
 
vector< size_t > connected_components (const vector< vector< size_t >> &adj, const vector< vector< size_t >> &rev_adj, size_t *num_comps_out) const
 
vector< vector< size_t > > transitive_reduction (const vector< vector< size_t >> &adj) const
 returns the transitive reduction of a topologically sorted DAG's adjacency list More...
 
vector< size_t > find_constriction_edges (const vector< vector< size_t >> &adj) const
 

Static Private Member Functions

static Alignment make_null_alignment (const Alignment &source)
 make a sentinel meant to indicate an unmapped read More...
 

Private Attributes

const PathPositionHandleGraphgraph = nullptr
 the graph we're surjecting onto More...
 
size_t min_splice_length = 20
 the minimum length deletion that the spliced algorithm will interpret as a splice event More...
 

Additional Inherited Members

- Static Public Member Functions inherited from vg::AlignerClient
static int8_t * parse_matrix (std::istream &matrix_stream)
 Allocates an array to hold a 4x4 substitution matrix and returns it. More...
 
- Public Attributes inherited from vg::AlignerClient
bool adjust_alignments_for_base_quality = false
 
- Protected Member Functions inherited from vg::AlignerClient
 AlignerClient (double gc_content_estimate=vg::default_gc_content)
 
const GSSWAlignerget_aligner (bool have_qualities=true) const
 
const QualAdjAlignerget_qual_adj_aligner () const
 
const Alignerget_regular_aligner () const
 

Member Typedef Documentation

◆ path_chunk_t

using vg::Surjector::path_chunk_t = pair<pair<string::const_iterator, string::const_iterator>, Path>

a local type that represents a read interval matched to a portion of the alignment path

Constructor & Destructor Documentation

◆ Surjector()

vg::Surjector::Surjector ( const PathPositionHandleGraph graph)

Member Function Documentation

◆ compute_path_interval()

pair< size_t, size_t > vg::Surjector::compute_path_interval ( const PathPositionHandleGraph graph,
const Alignment source,
path_handle_t  path_handle,
const vector< path_chunk_t > &  path_chunks 
) const
private

compute the widest interval of path positions that the realigned sequence could align to

◆ connected_components()

vector< size_t > vg::Surjector::connected_components ( const vector< vector< size_t >> &  adj,
const vector< vector< size_t >> &  rev_adj,
size_t *  num_comps_out 
) const
private

returns a vector assignming each node to a connectd component, requires both the forward and reverse adjacency lists. optionally also returns the total number of components

◆ extract_linearized_path_graph()

unordered_map< id_t, pair< id_t, bool > > vg::Surjector::extract_linearized_path_graph ( const PathPositionHandleGraph graph,
MutableHandleGraph into,
path_handle_t  path_handle,
size_t  first,
size_t  last 
) const
private

make a linear graph that corresponds to a path interval, possibly duplicating nodes in case of cycles

◆ extract_overlapping_paths()

unordered_map< path_handle_t, pair< vector< Surjector::path_chunk_t >, vector< pair< step_handle_t, step_handle_t > > > > vg::Surjector::extract_overlapping_paths ( const PathPositionHandleGraph graph,
const Alignment source,
const unordered_set< path_handle_t > &  surjection_paths 
) const
private

get the chunks of the alignment path that follow the given reference paths

◆ find_constriction_edges()

vector< size_t > vg::Surjector::find_constriction_edges ( const vector< vector< size_t >> &  adj) const
private

returns the nodes in an adjacency list that have an outgoing edge through which all of their component's source-to-sink paths flow

◆ make_null_alignment()

Alignment vg::Surjector::make_null_alignment ( const Alignment source)
staticprivate

make a sentinel meant to indicate an unmapped read

◆ realigning_surject()

Alignment vg::Surjector::realigning_surject ( const PathPositionHandleGraph graph,
const Alignment source,
const path_handle_t path_handle,
const vector< path_chunk_t > &  path_chunks,
bool  allow_negative_scores,
bool  preserve_N_alignments = false,
bool  preserve_tail_indel_anchors = false 
) const
private

◆ reverse_adjacencies()

vector< vector< size_t > > vg::Surjector::reverse_adjacencies ( const vector< vector< size_t >> &  adj) const
private

reverses an adjacency list

◆ set_path_position()

void vg::Surjector::set_path_position ( const PathPositionHandleGraph graph,
const Alignment surjected,
path_handle_t  best_path_handle,
string &  path_name_out,
int64_t &  path_pos_out,
bool &  path_rev_out 
) const
private

associate a path position and strand to a surjected alignment against this path

◆ set_path_position_inexact()

void vg::Surjector::set_path_position_inexact ( const PathPositionHandleGraph graph,
const Alignment surjected,
path_handle_t  best_path_handle,
string &  path_name_out,
int64_t &  path_pos_out,
bool &  path_rev_out 
) const
private

another algorithm that doesn't blow up if the alignment preserved deletions

◆ spliced_surject()

Alignment vg::Surjector::spliced_surject ( const PathPositionHandleGraph path_position_graph,
const Alignment source,
const path_handle_t path_handle,
const vector< path_chunk_t > &  path_chunks,
const vector< pair< step_handle_t, step_handle_t >> &  ref_chunks,
bool  allow_negative_scores 
) const
private

◆ surject() [1/2]

Alignment vg::Surjector::surject ( const Alignment source,
const set< string > &  path_names,
bool  allow_negative_scores = false,
bool  preserve_deletions = false 
) const

Extract the portions of an alignment that are on a chosen set of paths and try to align realign the portions that are off of the chosen paths to the intervening path segments to obtain an alignment that is fully restricted to the paths.

Replaces the alignment's refpos with the path name, position, and strand the alignment has been surjected to.

Optionally either allow softclips so that the alignment has a nonnegative score on the path or require the full-length alignment, possibly creating a negative score.

Also optionally leaves deletions against the reference path in the final alignment (useful for splicing).

◆ surject() [2/2]

Alignment vg::Surjector::surject ( const Alignment source,
const set< string > &  path_names,
string &  path_name_out,
int64_t &  path_pos_out,
bool &  path_rev_out,
bool  allow_negative_scores = false,
bool  preserve_deletions = false 
) const

Extract the portions of an alignment that are on a chosen set of paths and try to align realign the portions that are off of the chosen paths to the intervening path segments to obtain an alignment that is fully restricted to the paths.

Also returns the path name, position, and strand of the new alignment.

Optionally either allow softclips so that the alignment has a nonnegative score on the path or require the full-length alignment, possibly creating a negative score.

Also optionally leaves deletions against the reference path in the final alignment (useful for splicing).

◆ transitive_reduction()

vector< vector< size_t > > vg::Surjector::transitive_reduction ( const vector< vector< size_t >> &  adj) const
private

returns the transitive reduction of a topologically sorted DAG's adjacency list

Member Data Documentation

◆ graph

const PathPositionHandleGraph* vg::Surjector::graph = nullptr
private

the graph we're surjecting onto

◆ min_splice_length

size_t vg::Surjector::min_splice_length = 20
private

the minimum length deletion that the spliced algorithm will interpret as a splice event


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