|
vg
tools for working with variation graphs
|
#include <logged_gap_alignment_scorer.hpp>
Public Member Functions | |
| LoggedGapAlignmentScorer (const Alignment &standard, double gc_content=default_gc_content) | |
| int32_t | score_alignment (const Alignment &aln) const override |
| double | get_log_base () const override |
Public Member Functions inherited from vg::AlignmentScorer | |
| virtual | ~AlignmentScorer ()=default |
Public Attributes | |
| const size_t | matches |
| Number of matches in the standard alignment. More... | |
| const size_t | mismatches |
| Number of mismatches in the standard alignment. More... | |
| const std::vector< size_t > | gap_lengths |
| Lengths of all gaps in the standard alignment. More... | |
| const double | match = 1.0 |
| Marginal per-base match score under this scheme. Always 1.0. More... | |
| const double | mismatch |
| Marginal per-base mismatch (and per-gap-open) score under this scheme. More... | |
Private Member Functions | |
| LoggedGapAlignmentScorer (const Alignment &standard, std::tuple< size_t, size_t, std::vector< size_t >> &&operation_counts, double gc_content=default_gc_content) | |
| Build a LoggedGapAlignmentScorer with precomputed operation counts. More... | |
| int32_t | score_from_counts (size_t matches, size_t mismatches, const std::vector< size_t > &gap_lengths) const |
| Score a precomputed set of edit counts under this scheme. More... | |
Static Private Member Functions | |
| static void | count_alignment_operations (const Alignment &aln, size_t &matches, size_t &mismatches, std::vector< size_t > &gap_lengths) |
| Walk an alignment and count matches, mismatches, and per-gap lengths. More... | |
| static std::tuple< size_t, size_t, std::vector< size_t > > | count_alignment_operations (const Alignment &aln) |
| static double | compute_divergence (size_t matches, size_t mismatches, const std::vector< size_t > &gap_lengths) |
| Helper function to compute the divergence estimate from edit information. More... | |
Private Attributes | |
| const double | divergence |
| double | log_base |
| Log base for interpreting scores. More... | |
| const Alignment * | standard_address |
| Address where the standard alignment is, so we can recognize it later. More... | |
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) |
Scorer implementing the minimap2 long-indel rescoring formula (Heng Li, Bioinformatics 2021, doi:10.1093/bioinformatics/btab705).
Constructed from a "standard" alignment that defines the scoring scheme. minimap2 only ever applies the scoring scheme back to that same alignment, but we allow applying it to others.
The case of applying the scoring scheme back to the standard alignment is handled specially for speed; you MUST NOT apply the scorer to a different alignment at the same address as the standard alignment. (An easy way to ensure this is to ensure that the standard alignment outlives this object and is not modified.)
Hides everything about the empirical minimap2 formula inside the class.
|
explicit |
Construct a LoggedGapAlignmentScorer using the scoring scheme defined by standard.
standard must not be deallocated or modified between construction and any call to score_alignment() on any alignment at that address, because pointer identity is used to recognize that operations are on the standard alignment.
|
private |
Build a LoggedGapAlignmentScorer with precomputed operation counts.
|
staticprivate |
Helper function to compute the divergence estimate from edit information.
|
staticprivate |
Walk an alignment and count matches, mismatches, and per-gap lengths. Returns the result in a format usable to construct a LoggedGapAlignmentScorer
|
staticprivate |
Walk an alignment and count matches, mismatches, and per-gap lengths.
|
overridevirtual |
Get the log base value used to probabilistically interpret scores. Implementations probably need to have a stores GC content to implement this.
Implements vg::AlignmentScorer.
|
overridevirtual |
Score an alignment under this scheme. Guaranteed to be O(1) when aln is at the address of standard.
Implements vg::AlignmentScorer.
|
private |
Score a precomputed set of edit counts under this scheme.
|
private |
Estimate of the divergence (what minimap2 calls "d"). This is used to initialize mismatch, and depends on the statistics, and so MUST appear between them.
| const std::vector<size_t> vg::LoggedGapAlignmentScorer::gap_lengths |
Lengths of all gaps in the standard alignment.
|
private |
Log base for interpreting scores.
| const double vg::LoggedGapAlignmentScorer::match = 1.0 |
Marginal per-base match score under this scheme. Always 1.0.
| const size_t vg::LoggedGapAlignmentScorer::matches |
Number of matches in the standard alignment.
| const double vg::LoggedGapAlignmentScorer::mismatch |
Marginal per-base mismatch (and per-gap-open) score under this scheme.
| const size_t vg::LoggedGapAlignmentScorer::mismatches |
Number of mismatches in the standard alignment.
|
private |
Address where the standard alignment is, so we can recognize it later.
1.9.1