vg
tools for working with variation graphs
Public Member Functions | Public Attributes | List of all members
vg::EditAlignmentScorer Class Referenceabstract

#include <alignment_scorer.hpp>

Inheritance diagram for vg::EditAlignmentScorer:
vg::AlignmentScorer vg::MatrixAlignmentScorer vg::QualAdjAlignmentScorer

Public Member Functions

 EditAlignmentScorer (int8_t match=default_match, int8_t mismatch=default_mismatch, int8_t gap_open=default_gap_open, int8_t gap_extension=default_gap_extension, int8_t full_length_bonus=default_full_length_bonus)
 
int32_t score_alignment (const Alignment &aln) const override
 Score an alignment as a contiguous alignment, including full-length bonuses. More...
 
virtual int32_t score_exact_match (const Alignment &aln, size_t read_offset, size_t length) const =0
 
virtual int32_t score_exact_match (const std::string &sequence, const std::string &base_quality) const =0
 
virtual int32_t score_exact_match (std::string::const_iterator seq_begin, std::string::const_iterator seq_end, std::string::const_iterator base_qual_begin) const =0
 
virtual int32_t score_mismatch (std::string::const_iterator seq_begin, std::string::const_iterator seq_end, std::string::const_iterator base_qual_begin) const =0
 
virtual int32_t score_full_length_bonus (bool left_side, std::string::const_iterator seq_begin, std::string::const_iterator seq_end, std::string::const_iterator base_qual_begin) const =0
 
virtual int32_t score_full_length_bonus (bool left_side, const Alignment &alignment) const =0
 
virtual int32_t score_partial_alignment (const Alignment &alignment, const HandleGraph &graph, const path_t &path, std::string::const_iterator seq_begin, bool no_read_end_scoring=false) const =0
 
virtual int32_t score_gap (size_t gap_length) const
 Returns the score of an insert or deletion of the given length. More...
 
virtual int32_t score_discontiguous_alignment (const Alignment &aln, const std::function< size_t(pos_t, pos_t, size_t)> &estimate_distance, bool allow_left_bonus=true, bool allow_right_bonus=true) const
 
virtual int32_t score_contiguous_alignment (const Alignment &aln, bool allow_left_bonus=true, bool allow_right_bonus=true) const
 Score the given alignment assuming there are no gaps between Mappings. More...
 
virtual int32_t remove_bonuses (const Alignment &aln, bool pinned=false, bool pin_left=false) const
 
size_t longest_detectable_gap (const Alignment &alignment, const std::string::const_iterator &read_pos) const
 The longest gap detectable from a read position without soft-clipping. More...
 
size_t longest_detectable_gap (size_t read_length, size_t read_pos) const
 The longest gap detectable from a read position without soft-clipping, for a generic read. More...
 
size_t longest_detectable_gap (const Alignment &alignment) const
 The longest gap detectable from any read position without soft-clipping. More...
 
size_t longest_detectable_gap (size_t read_length) const
 The longest gap detectable from any read position without soft-clipping, for a generic read. More...
 
- Public Member Functions inherited from vg::AlignmentScorer
virtual ~AlignmentScorer ()=default
 
virtual double get_log_base () const =0
 

Public Attributes

int8_t match
 
int8_t mismatch
 
int8_t gap_open
 
int8_t gap_extension
 
int8_t full_length_bonus
 

Additional Inherited Members

- Static Protected Member Functions inherited from vg::AlignmentScorer
static double recover_log_base (const double matrix[16], double gc_content, double tol=1e-12)
 

Detailed Description

An abstract AlignmentScorer that can score individual edits independently.

Constructor & Destructor Documentation

◆ EditAlignmentScorer()

vg::EditAlignmentScorer::EditAlignmentScorer ( int8_t  match = default_match,
int8_t  mismatch = default_mismatch,
int8_t  gap_open = default_gap_open,
int8_t  gap_extension = default_gap_extension,
int8_t  full_length_bonus = default_full_length_bonus 
)

Member Function Documentation

◆ longest_detectable_gap() [1/4]

size_t vg::EditAlignmentScorer::longest_detectable_gap ( const Alignment alignment) const

The longest gap detectable from any read position without soft-clipping.

◆ longest_detectable_gap() [2/4]

size_t vg::EditAlignmentScorer::longest_detectable_gap ( const Alignment alignment,
const std::string::const_iterator &  read_pos 
) const

The longest gap detectable from a read position without soft-clipping.

◆ longest_detectable_gap() [3/4]

size_t vg::EditAlignmentScorer::longest_detectable_gap ( size_t  read_length) const

The longest gap detectable from any read position without soft-clipping, for a generic read.

◆ longest_detectable_gap() [4/4]

size_t vg::EditAlignmentScorer::longest_detectable_gap ( size_t  read_length,
size_t  read_pos 
) const

The longest gap detectable from a read position without soft-clipping, for a generic read.

◆ remove_bonuses()

int32_t vg::EditAlignmentScorer::remove_bonuses ( const Alignment aln,
bool  pinned = false,
bool  pin_left = false 
) const
virtual

Without necessarily rescoring the entire alignment, return the score of the given alignment with bonuses removed. Assumes that bonuses are actually included in the score. Needs to know if the alignment was pinned-end or not, and, if so, which end was pinned.

◆ score_alignment()

int32_t vg::EditAlignmentScorer::score_alignment ( const Alignment aln) const
overridevirtual

Score an alignment as a contiguous alignment, including full-length bonuses.

Implements vg::AlignmentScorer.

◆ score_contiguous_alignment()

int32_t vg::EditAlignmentScorer::score_contiguous_alignment ( const Alignment aln,
bool  allow_left_bonus = true,
bool  allow_right_bonus = true 
) const
virtual

Score the given alignment assuming there are no gaps between Mappings.

◆ score_discontiguous_alignment()

int32_t vg::EditAlignmentScorer::score_discontiguous_alignment ( const Alignment aln,
const std::function< size_t(pos_t, pos_t, size_t)> &  estimate_distance,
bool  allow_left_bonus = true,
bool  allow_right_bonus = true 
) const
virtual

Use the score values in the scorer to score the given alignment, scoring gaps caused by jumping between nodes using a custom gap length estimation function (which takes the from position, the to position, and a search limit in bp that happens to be the read length).

May include full length bonus or not. TODO: bool flags are bad..

◆ score_exact_match() [1/3]

virtual int32_t vg::EditAlignmentScorer::score_exact_match ( const Alignment aln,
size_t  read_offset,
size_t  length 
) const
pure virtual

Compute the score of an exact match in the given alignment, from the given offset, of the given length.

Implemented in vg::QualAdjAlignmentScorer, and vg::MatrixAlignmentScorer.

◆ score_exact_match() [2/3]

virtual int32_t vg::EditAlignmentScorer::score_exact_match ( const std::string &  sequence,
const std::string &  base_quality 
) const
pure virtual

Compute the score of an exact match of the given sequence with the given qualities. Qualities may be ignored by some implementations.

Implemented in vg::QualAdjAlignmentScorer, and vg::MatrixAlignmentScorer.

◆ score_exact_match() [3/3]

virtual int32_t vg::EditAlignmentScorer::score_exact_match ( std::string::const_iterator  seq_begin,
std::string::const_iterator  seq_end,
std::string::const_iterator  base_qual_begin 
) const
pure virtual

Compute the score of an exact match of the given range of sequence with the given qualities. Qualities may be ignored by some implementations.

Implemented in vg::QualAdjAlignmentScorer, and vg::MatrixAlignmentScorer.

◆ score_full_length_bonus() [1/2]

virtual int32_t vg::EditAlignmentScorer::score_full_length_bonus ( bool  left_side,
const Alignment alignment 
) const
pure virtual

Compute the score bonus that would be achieved by a full-length alignment of the given end of the given read. Does not check whether that end actually has a full-lenght alignment.

Implemented in vg::QualAdjAlignmentScorer, and vg::MatrixAlignmentScorer.

◆ score_full_length_bonus() [2/2]

virtual int32_t vg::EditAlignmentScorer::score_full_length_bonus ( bool  left_side,
std::string::const_iterator  seq_begin,
std::string::const_iterator  seq_end,
std::string::const_iterator  base_qual_begin 
) const
pure virtual

Compute the score bonus that would be achieved by a full-length alignment of the given end of the given read.

Implemented in vg::QualAdjAlignmentScorer, and vg::MatrixAlignmentScorer.

◆ score_gap()

int32_t vg::EditAlignmentScorer::score_gap ( size_t  gap_length) const
virtual

Returns the score of an insert or deletion of the given length.

◆ score_mismatch()

virtual int32_t vg::EditAlignmentScorer::score_mismatch ( std::string::const_iterator  seq_begin,
std::string::const_iterator  seq_end,
std::string::const_iterator  base_qual_begin 
) const
pure virtual

Compute the score of a mismatch of the given range of sequence with the given qualities. Qualities may be ignored by some implementations. Note that the return value is SIGNED, and almost certainly NEGATIVE, because mismatches are bad.

Implemented in vg::QualAdjAlignmentScorer, and vg::MatrixAlignmentScorer.

◆ score_partial_alignment()

virtual int32_t vg::EditAlignmentScorer::score_partial_alignment ( const Alignment alignment,
const HandleGraph graph,
const path_t path,
std::string::const_iterator  seq_begin,
bool  no_read_end_scoring = false 
) const
pure virtual

Compute the score of a path against the given range of subsequence with the given qualities. The Alignment is just to find the sequence begin and end to compare to seq_begin. seq_begin is the first read base involved in the provided path to be scored.

Implemented in vg::QualAdjAlignmentScorer, and vg::MatrixAlignmentScorer.

Member Data Documentation

◆ full_length_bonus

int8_t vg::EditAlignmentScorer::full_length_bonus

◆ gap_extension

int8_t vg::EditAlignmentScorer::gap_extension

◆ gap_open

int8_t vg::EditAlignmentScorer::gap_open

◆ match

int8_t vg::EditAlignmentScorer::match

◆ mismatch

int8_t vg::EditAlignmentScorer::mismatch

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