logo
pub struct Aligner<F: MatchFunc> { /* private fields */ }
Expand description

A banded implementation of Smith-Waterman aligner (SWA). Unlike the full SWA, this implementation computes the alignment between a pair of sequences only inside a ‘band’ withing the dynamic programming matrix. The band is constructed using the Sparse DP routine (see sparse::sdpkpp), which uses kmer matches to build the best common subsequence (including gap penalties) between the two strings. The band is constructed around this subsequence (using the window length ‘w’), filling in the gaps.

In the case where there are no k-mer matches, the aligner will fall back to a full alignment, by setting the band to contain the full matrix.

Banded aligner will proceed to compute the alignment only when the total number of cells in the band is less than MAX_CELLS (currently set to 10 million), otherwise it returns an empty alignment

Implementations

Create new aligner instance with given gap open and gap extend penalties and the score function.

Arguments
  • gap_open - the score for opening a gap (should be negative)
  • gap_extend - the score for extending a gap (should be negative)
  • match_fn - function that returns the score for substitutions (also see bio::scores)
  • k - kmer length used in constructing the band
  • w - width of the band

Create new aligner instance. The size hints help to avoid unnecessary memory allocations.

Arguments
  • m - the expected size of x
  • n - the expected size of y
  • gap_open - the score for opening a gap (should be negative)
  • gap_extend - the score for extending a gap (should be negative)
  • match_fn - function that returns the score for substitutions (also see bio::scores)
  • k - kmer length used in constructing the band
  • w - width of the band

Create new aligner instance with scoring and size hint. The size hints help to avoid unnecessary memory allocations.

Arguments
  • m - the expected size of x
  • n - the expected size of y
  • scoring - the scoring struct
  • k - kmer length used in constructing the band
  • w - width of the band

Create new aligner instance with scoring and size hint. The size hints help to avoid unnecessary memory allocations.

Arguments
  • m - the expected size of x
  • n - the expected size of y
  • scoring - the scoring struct
  • k - kmer length used in constructing the band
  • w - width of the band

Return a mutable reference to scoring. Useful if you want to have a single aligner object but want to modify the scores within it for different cases

Compute the alignment with custom clip penalties

Arguments
  • x - Textslice
  • y - Textslice

Compute the alignment with custom clip penalties with ‘y’ being pre-hashed (see sparse::hash_kmers)

Arguments
  • x - Textslice
  • y - Textslice

Compute the alignment with custom clip penalties with the kmer matches between x and y being pre-computed as a Vector of pairs (xpos, ypos) and sorted.

Arguments
  • x - Textslice
  • y - Textslice
  • matches - Vector of kmer matching pairs (xpos, ypos)

Compute the alignment with custom clip penalties with the kmer matches between x and y being pre-computed as a Vector of pairs (xpos, ypos) and sorted. The matches are expanded diagonally in both directions allowing upto a user specified number of mismatches. This is useful in constructing the band correctly, particularly when a higher frequency of mismatches are expected.

Arguments
  • x - Textslice
  • y - Textslice
  • matches - Vector of kmer matching pairs (xpos, ypos)
  • allowed_mismatches - Extend the matches diagonally allowing upto the specified number of mismatches (Option)
  • use_lcskpp_union - Extend the results from sdpkpp using lcskpp

Compute the alignment with custom clip penalties by constructing a band along the matches as defined by path. This is only for advanced uses, where one would want to control the kmer backbone that is used for creating the band.

Arguments
  • x - Textslice
  • y - Textslice
  • matches - Vector of kmer matching pairs (xpos, ypos)
  • path - Vector of indices pointing to matches vector which defines a path. The validity of the path is not checked.

Calculate global alignment of x against y.

Calculate semiglobal alignment of x against y (x is global, y is local).

Calculate semiglobal alignment of x against y (x is global, y is local). This function accepts the hash map of the kmers of y. This is useful in cases where we are interested in repeated alignment of different queries against the same reference. The user can precompute the HashMap using sparse::hash_kmers and invoke this function to speed up the alignment computation.

Calculate local alignment of x against y.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.