vg
tools for working with variation graphs
|
#include <mapper.hpp>
Public Member Functions | |
Mapper (PathPositionHandleGraph *xidex, gcsa::GCSA *g, gcsa::LCPArray *a, haplo::ScoreProvider *haplo_score_provider=nullptr) | |
Mapper (void) | |
~Mapper (void) | |
bool | alignments_consistent (const map< string, double > &pos1, const map< string, double > &pos2, int fragment_size_bound) |
bool | pair_consistent (Alignment &aln1, Alignment &aln2, double pval) |
use the fragment length annotations to assess if the pair is consistent or not More... | |
pair< bool, bool > | pair_rescue (Alignment &mate1, Alignment &mate2, bool &tried1, bool &tried2, int match_score, int full_length_bonus, bool traceback, bool xdrop_alignment) |
use the fragment configuration statistics to rescue more precisely More... | |
vector< Alignment > | mems_id_clusters_to_alignments (const Alignment &alignment, vector< MaximalExactMatch > &mems, int additional_multimaps) |
set< const vector< MaximalExactMatch > * > | clusters_to_drop (const vector< vector< MaximalExactMatch > > &clusters) |
int32_t | score_alignment (const Alignment &aln, bool use_approx_distance=false) |
void | remove_full_length_bonuses (Alignment &aln) |
Given an alignment scored with full length bonuses on, subtract out the full length bonus if it was applied. More... | |
Alignment | patch_alignment (const Alignment &aln, int max_patch_length, bool trim_internal_deletions=true, bool xdrop_alignment=false) |
Alignment | align_cluster (const Alignment &aln, const vector< MaximalExactMatch > &mems, bool traceback, bool xdrop_alignment=false) |
double | compute_uniqueness (const Alignment &aln, const vector< MaximalExactMatch > &mems) |
Alignment | align_maybe_flip (const Alignment &base, HandleGraph &graph, bool flip, bool traceback, bool banded_global=false, bool xdrop_alignment=false) |
Alignment | align_maybe_flip (const Alignment &base, HandleGraph &graph, const vector< MaximalExactMatch > &mems, bool flip, bool traceback, bool banded_global=false, bool xdrop_alignment=false) |
bool | adjacent_positions (const Position &pos1, const Position &pos2) |
int64_t | get_node_length (int64_t node_id) |
bool | check_alignment (const Alignment &aln) |
Alignment | align (const string &seq, int kmer_size=0, int stride=0, int max_mem_length=0, int band_width=1000, int band_overlap=500, bool xdrop_alignment=false) |
Alignment | align (const Alignment &read, int kmer_size=0, int stride=0, int max_mem_length=0, int band_width=1000, int band_overlap=500, bool xdrop_alignment=false) |
vector< Alignment > | align_multi (const Alignment &aln, int kmer_size=0, int stride=0, int max_mem_length=0, int band_width=1000, int band_overlap=500, bool xdrop_alignment=false) |
pair< vector< Alignment >, vector< Alignment > > | align_paired_multi (const Alignment &read1, const Alignment &read2, bool &queued_resolve_later, int max_mem_length=0, bool only_top_scoring_pair=false, bool retrying=false, bool xdrop_alignment=false) |
double | compute_cluster_mapping_quality (const vector< vector< MaximalExactMatch > > &clusters, int read_length) |
double | estimate_max_possible_mapping_quality (int length, double min_diffs, double next_min_diffs) |
double | max_possible_mapping_quality (int length) |
int64_t | graph_mixed_distance_estimate (pos_t pos1, pos_t pos2, int64_t maximum) |
int64_t | approx_distance (pos_t pos1, pos_t pos2) |
int64_t | approx_position (pos_t pos) |
int64_t | approx_alignment_position (const Alignment &aln) |
Position | alignment_end_position (const Alignment &aln) |
int64_t | approx_fragment_length (const Alignment &aln1, const Alignment &aln2) |
vector< pos_t > | likely_mate_positions (const Alignment &aln, bool is_first) |
unordered_map< path_handle_t, int64_t > | min_pair_fragment_length (const Alignment &aln1, const Alignment &aln2) |
Public Member Functions inherited from vg::BaseMapper | |
BaseMapper (PathPositionHandleGraph *xidex, gcsa::GCSA *g, gcsa::LCPArray *a, haplo::ScoreProvider *haplo_score_provider=nullptr) | |
BaseMapper (void) | |
int | random_match_length (double chance_random) |
void | set_alignment_scores (int8_t match, int8_t mismatch, int8_t gap_open, int8_t gap_extend, int8_t full_length_bonus, double haplotype_consistency_exponent=1) |
Override alignment score setting to support haplotype consistency exponent. More... | |
void | set_alignment_scores (istream &matrix_stream, int8_t gap_open, int8_t gap_extend, int8_t full_length_bonus, double haplotype_consistency_exponent=1) |
Same, but loading a 4x4 substitution score matrix from a stream. More... | |
vector< MaximalExactMatch > | find_mems_deep (string::const_iterator seq_begin, string::const_iterator seq_end, double &lcp_avg, double &fraction_filtered, int max_mem_length=0, int min_mem_length=1, int reseed_length=0, bool use_lcp_reseed_heuristic=false, bool use_diff_based_fast_reseed=false, bool include_parent_in_sub_mem_count=false, bool record_max_lcp=false, int reseed_below_count=0) |
vector< MaximalExactMatch > | find_mems_simple (string::const_iterator seq_begin, string::const_iterator seq_end, int max_mem_length=0, int min_mem_length=1, int reseed_length=0) |
vector< MaximalExactMatch > | find_stripped_matches (string::const_iterator seq_begin, string::const_iterator seq_end, size_t strip_length, size_t max_match_length, size_t target_count) |
vector< MaximalExactMatch > | find_fanout_mems (string::const_iterator seq_begin, string::const_iterator seq_end, string::const_iterator qual_begin, int max_fans_out, char max_fanout_base_quality, vector< deque< pair< string::const_iterator, char >>> *mem_fanout_breaks=nullptr) |
vector< pos_t > | walk_fanout_path (string::const_iterator begin, string::const_iterator end, const deque< pair< string::const_iterator, char >> &fanout_breaks, gcsa::node_type pos) |
void | rescue_high_count_order_length_mems (vector< MaximalExactMatch > &mems, size_t max_rescue_hit_count) |
void | precollapse_order_length_runs (string::const_iterator seq_begin, vector< MaximalExactMatch > &mems) |
void | prefilter_redundant_sub_mems (vector< MaximalExactMatch > &mems, vector< pair< int, vector< size_t >>> &sub_mem_containment_graph) |
void | find_sub_mems (const vector< MaximalExactMatch > &mems, int parent_layer_begin, int parent_layer_end, int mem_idx, string::const_iterator next_mem_end, int min_mem_length, vector< pair< MaximalExactMatch, vector< size_t >>> &sub_mems_out) |
void | find_sub_mems_fast (const vector< MaximalExactMatch > &mems, int parent_layer_begin, int parent_layer_end, int mem_idx, string::const_iterator leftmost_guaranteed_disjoint_bound, string::const_iterator leftmost_seeding_bound, int min_sub_mem_length, vector< pair< MaximalExactMatch, vector< size_t >>> &sub_mems_out) |
gcsa::range_type | accelerate_mem_query (string::const_iterator begin, string::const_iterator &cursor) const |
set< pos_t > | sequence_positions (const string &seq) |
size_t | get_adaptive_min_reseed_length (size_t parent_mem_length) |
void | apply_haplotype_consistency_scores (const vector< Alignment * > &alns) |
Public Member Functions inherited from vg::AlignerClient | |
virtual 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... | |
virtual void | set_alignment_scores (std::istream &matrix_stream, int8_t gap_open, int8_t gap_extend, int8_t full_length_bonus) |
virtual void | set_alignment_scores (const int8_t *score_matrix, int8_t gap_open, int8_t gap_extend, int8_t full_length_bonus) |
Public Member Functions inherited from vg::PairedEndMapper | |
void | set_fragment_length_distr_params (size_t maximum_sample_size=1000, size_t reestimation_frequency=1000, double robust_estimation_fraction=0.95) |
bool | has_fixed_fragment_length_distr () |
Returns true if fragment length distribution has been fixed. More... | |
void | force_fragment_length_distr (double mean, double stddev) |
Protected Member Functions | |
Alignment | align_to_graph (const Alignment &aln, HandleGraph &graph, bool do_flip, bool traceback, bool pinned_alignment=false, bool pin_left=false, bool banded_global=false, bool keep_bonuses=true) |
Alignment | align_to_graph (const Alignment &aln, HandleGraph &graph, const vector< MaximalExactMatch > &mems, bool do_flip, bool traceback, bool pinned_alignment=false, bool pin_left=false, bool banded_global=false, int xdrop_alignment=0, bool keep_bonuses=true) |
vector< Alignment > | make_bands (const Alignment &read, int band_width, int band_overlap, vector< pair< int, int >> &to_strip) |
Protected Member Functions inherited from vg::AlignerClient | |
AlignerClient (double gc_content_estimate=vg::default_gc_content) | |
const GSSWAligner * | get_aligner (bool have_qualities=true) const |
const QualAdjAligner * | get_qual_adj_aligner () const |
const Aligner * | get_regular_aligner () const |
Private Member Functions | |
vector< Alignment > | align_multi_internal (bool compute_unpaired_qualities, const Alignment &aln, int kmer_size, int stride, int max_mem_length, int band_width, int band_overlap, double &cluster_mq, int keep_multimaps=0, int additional_multimaps=0, vector< MaximalExactMatch > *restricted_mems=nullptr, bool xdrop_alignment=false) |
void | compute_mapping_qualities (vector< Alignment > &alns, double cluster_mq, double mq_estimate, double mq_cap) |
void | compute_mapping_qualities (pair< vector< Alignment >, vector< Alignment >> &pair_alns, double cluster_mq, double mq_estmate1, double mq_estimate2, double mq_cap1, double mq_cap2) |
vector< Alignment > | score_sort_and_deduplicate_alignments (vector< Alignment > &all_alns, const Alignment &original_alignment) |
void | filter_and_process_multimaps (vector< Alignment > &all_alns, int total_multimaps) |
vector< Alignment > | align_banded (const Alignment &read, int kmer_size=0, int stride=0, int max_mem_length=0, int band_width=1000, int band_overlap=500, bool xdrop_alignment=false) |
vector< Alignment > | align_mem_multi (const Alignment &aln, vector< MaximalExactMatch > &mems, double &cluster_mq, double lcp_avg, double fraction_filtered, int max_mem_length, int keep_multimaps, int additional_multimaps, bool xdrop_alignment=false) |
Additional Inherited Members | |
Static Public Member Functions inherited from vg::BaseMapper | |
static double | estimate_gc_content (const gcsa::GCSA *gcsa) |
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... | |
Static Public Attributes inherited from vg::BaseMapper | |
static thread_local vector< size_t > | adaptive_reseed_length_memo |
Protected Attributes inherited from vg::PairedEndMapper | |
FragmentLengthDistribution | fragment_length_distr |
Holds the actual fragment length distribution and estimation information. More... | |
vg::Mapper::Mapper | ( | PathPositionHandleGraph * | xidex, |
gcsa::GCSA * | g, | ||
gcsa::LCPArray * | a, | ||
haplo::ScoreProvider * | haplo_score_provider = nullptr |
||
) |
vg::Mapper::Mapper | ( | void | ) |
vg::Mapper::~Mapper | ( | void | ) |
Alignment vg::Mapper::align | ( | const Alignment & | read, |
int | kmer_size = 0 , |
||
int | stride = 0 , |
||
int | max_mem_length = 0 , |
||
int | band_width = 1000 , |
||
int | band_overlap = 500 , |
||
bool | xdrop_alignment = false |
||
) |
Alignment vg::Mapper::align | ( | const string & | seq, |
int | kmer_size = 0 , |
||
int | stride = 0 , |
||
int | max_mem_length = 0 , |
||
int | band_width = 1000 , |
||
int | band_overlap = 500 , |
||
bool | xdrop_alignment = false |
||
) |
|
private |
Alignment vg::Mapper::align_cluster | ( | const Alignment & | aln, |
const vector< MaximalExactMatch > & | mems, | ||
bool | traceback, | ||
bool | xdrop_alignment = false |
||
) |
Alignment vg::Mapper::align_maybe_flip | ( | const Alignment & | base, |
HandleGraph & | graph, | ||
bool | flip, | ||
bool | traceback, | ||
bool | banded_global = false , |
||
bool | xdrop_alignment = false |
||
) |
Alignment vg::Mapper::align_maybe_flip | ( | const Alignment & | base, |
HandleGraph & | graph, | ||
const vector< MaximalExactMatch > & | mems, | ||
bool | flip, | ||
bool | traceback, | ||
bool | banded_global = false , |
||
bool | xdrop_alignment = false |
||
) |
|
private |
vector< Alignment > vg::Mapper::align_multi | ( | const Alignment & | aln, |
int | kmer_size = 0 , |
||
int | stride = 0 , |
||
int | max_mem_length = 0 , |
||
int | band_width = 1000 , |
||
int | band_overlap = 500 , |
||
bool | xdrop_alignment = false |
||
) |
|
private |
pair< vector< Alignment >, vector< Alignment > > vg::Mapper::align_paired_multi | ( | const Alignment & | read1, |
const Alignment & | read2, | ||
bool & | queued_resolve_later, | ||
int | max_mem_length = 0 , |
||
bool | only_top_scoring_pair = false , |
||
bool | retrying = false , |
||
bool | xdrop_alignment = false |
||
) |
|
protected |
|
protected |
bool vg::Mapper::alignments_consistent | ( | const map< string, double > & | pos1, |
const map< string, double > & | pos2, | ||
int | fragment_size_bound | ||
) |
int64_t vg::Mapper::approx_alignment_position | ( | const Alignment & | aln | ) |
returns approximate position of alignnment start in xindex or -1.0 if alignment is unmapped
returns approximate distance between alignment starts or -1.0 if not possible to determine
int64_t vg::Mapper::approx_position | ( | pos_t | pos | ) |
bool vg::Mapper::check_alignment | ( | const Alignment & | aln | ) |
set< const vector< MaximalExactMatch > * > vg::Mapper::clusters_to_drop | ( | const vector< vector< MaximalExactMatch > > & | clusters | ) |
double vg::Mapper::compute_cluster_mapping_quality | ( | const vector< vector< MaximalExactMatch > > & | clusters, |
int | read_length | ||
) |
|
private |
|
private |
double vg::Mapper::compute_uniqueness | ( | const Alignment & | aln, |
const vector< MaximalExactMatch > & | mems | ||
) |
double vg::Mapper::estimate_max_possible_mapping_quality | ( | int | length, |
double | min_diffs, | ||
double | next_min_diffs | ||
) |
|
private |
int64_t vg::Mapper::get_node_length | ( | int64_t | node_id | ) |
|
protected |
double vg::Mapper::max_possible_mapping_quality | ( | int | length | ) |
vector<Alignment> vg::Mapper::mems_id_clusters_to_alignments | ( | const Alignment & | alignment, |
vector< MaximalExactMatch > & | mems, | ||
int | additional_multimaps | ||
) |
unordered_map< path_handle_t, int64_t > vg::Mapper::min_pair_fragment_length | ( | const Alignment & | aln1, |
const Alignment & | aln2 | ||
) |
use the fragment length annotations to assess if the pair is consistent or not
pair< bool, bool > vg::Mapper::pair_rescue | ( | Alignment & | mate1, |
Alignment & | mate2, | ||
bool & | tried1, | ||
bool & | tried2, | ||
int | match_score, | ||
int | full_length_bonus, | ||
bool | traceback, | ||
bool | xdrop_alignment | ||
) |
use the fragment configuration statistics to rescue more precisely
Alignment vg::Mapper::patch_alignment | ( | const Alignment & | aln, |
int | max_patch_length, | ||
bool | trim_internal_deletions = true , |
||
bool | xdrop_alignment = false |
||
) |
void vg::Mapper::remove_full_length_bonuses | ( | Alignment & | aln | ) |
Given an alignment scored with full length bonuses on, subtract out the full length bonus if it was applied.
int32_t vg::Mapper::score_alignment | ( | const Alignment & | aln, |
bool | use_approx_distance = false |
||
) |
Use the scoring provided by the internal aligner to re-score the alignment, scoring gaps between nodes using graph distance from the PathPositionHandleGraph index. Can use either approximate or exact (with approximate fallback) PathPositionHandleGraph-based distance estimation. Will strip out bonuses if the appropriate Mapper flag is set. Does not apply a haplotype consistency bonus, as this function is intended for alignments with large gaps.
|
private |
bool vg::Mapper::always_rescue |
int vg::Mapper::band_multimaps |
float vg::Mapper::drop_chain |
int vg::Mapper::extra_multimaps |
FragmentLengthStatistics vg::Mapper::frag_stats |
double vg::Mapper::identity_weight |
bool vg::Mapper::include_full_length_bonuses |
int vg::Mapper::mate_rescues |
int vg::Mapper::max_attempts |
int vg::Mapper::max_band_jump |
int vg::Mapper::max_cluster_mapping_quality |
int vg::Mapper::max_multimaps |
int vg::Mapper::max_softclip_iterations |
int vg::Mapper::max_target_factor |
int vg::Mapper::max_xdrop_gap_length |
double vg::Mapper::maybe_mq_threshold |
int vg::Mapper::min_banded_mq |
int vg::Mapper::min_cluster_length |
float vg::Mapper::min_identity |
int vg::Mapper::min_multimaps |
float vg::Mapper::mq_overlap |
double vg::Mapper::pair_rescue_hang_threshold |
double vg::Mapper::pair_rescue_retry_threshold |
bool vg::Mapper::patch_alignments |
bool vg::Mapper::simultaneous_pair_alignment |
int vg::Mapper::softclip_threshold |
int vg::Mapper::thread_extension |
bool vg::Mapper::use_cluster_mq |
atomic<int> vg::Mapper::warned_about_chunking {0} |