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

A generalized Smith-Waterman aligner.

M(i,j) is the best score such that x[i] and y[j] ends in a match (or substitution)

             .... A   G  x_i
             .... C   G  y_j

I(i,j) is the best score such that x[i] is aligned with a gap

             .... A   G  x_i
             .... G  y_j  -

This is interpreted as an insertion into x w.r.t reference y

D(i,j) is the best score such that y[j] is aligned with a gap

             .... A  x_i  -
             .... G   G  y_j

This is interpreted as a deletion from x w.r.t reference y

S(i,j) is the best score for prefixes x[0..i], y[0..j]

To save space, only two columns of these matrices are stored at any point - the current column and the previous one. Moreover M(i,j) is not explicitly stored

Lx is the optimal x suffix clipping lengths from each position of the sequence y

Ly is the optimal y suffix clipping lengths from each position of the sequence x

Sn is the last column of the matrix. This is needed to keep track of suffix clipping scores

traceback - see bio::alignment::pairwise::TracebackCell

scoring - see bio::alignment::pairwise::Scoring

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 (see also bio::alignment::pairwise::Scoring)

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 (see also bio::alignment::pairwise::Scoring)

Create new aligner instance with given the scoring struct

Arguments
  • scoring - the scoring struct (see bio::alignment::pairwise::Scoring)

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

The core function to compute the alignment

Arguments
  • x - Textslice
  • y - Textslice

Calculate global alignment of x against y.

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

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.