Alignment

Struct Alignment 

Source
pub struct Alignment<A, B> { /* private fields */ }
Expand description

An alignment of two reads. It has either a reference to the two sequences to prevent overzealous use of memory, or if needed use Self::to_owned to get a variant that clones the sequences and so can be used in more places.

Implementations§

Source§

impl<A: Clone, B: Clone> Alignment<Cow<'_, A>, Cow<'_, B>>

Source

pub fn to_owned(&self) -> Self

Clone the referenced sequences to make an alignment that owns the sequences. This can be necessary in some context where the references cannot be guaranteed to stay as long as you need the alignment.

Source§

impl<'lifetime, A, B> Alignment<&'lifetime A, &'lifetime B>

Source

pub fn create_from_path( seq_a: &'lifetime A, seq_b: &'lifetime B, start_a: usize, start_b: usize, path: &str, scoring: AlignScoring<'_>, align_type: AlignType, maximal_step: u16, ) -> Option<Self>

Recreate an alignment from a path, the path is Self::short.

Source§

impl<A, B> Alignment<A, B>

Source

pub const fn seq_a(&self) -> &A

The first sequence

Source

pub const fn seq_b(&self) -> &B

The second sequence

Source

pub const fn normalised_score(&self) -> f64

The normalised score, normalised for the alignment length and for the used alphabet. The normalisation is calculated as follows absolute_score / max_score.

Source

pub const fn score(&self) -> Score

All three scores for this alignment.

Source

pub fn path(&self) -> &[Piece]

The path or steps taken for the alignment

Source

pub const fn start(&self) -> (usize, usize)

The position in the sequences where the alignment starts (a, b)

Source

pub const fn start_a(&self) -> usize

The position in the first sequence where the alignment starts

Source

pub const fn start_b(&self) -> usize

The position in the second sequence where the alignment starts

Source

pub const fn align_type(&self) -> AlignType

The alignment type

Source

pub const fn max_step(&self) -> u16

The maximal step size (the const generic STEPS)

Source

pub fn len_a(&self) -> usize

The total number of residues matched on the first sequence

Source

pub fn len_b(&self) -> usize

The total number of residues matched on the second sequence

Source

pub fn stats(&self) -> Stats

Returns statistics for this match.

Source§

impl<A: HasPeptidoform<Linear>, B: HasPeptidoform<Linear>> Alignment<A, B>

Source

pub fn mass_a(&self) -> Multi<MolecularFormula>

The mass(es) for the matched portion of the first sequence TODO: this assumes no terminal mods

Source

pub fn mass_b(&self) -> Multi<MolecularFormula>

The mass(es) for the matched portion of the second sequence

Source

pub fn mass_difference(&self) -> Mass

Get the mass delta for this match, if it is a (partial) local match it will only take the matched amino acids into account. If there are multiple possible masses for any of the stretches it returns the smallest difference.

Source

pub fn ppm(&self) -> Ratio

Get the error in ppm for this match, if it is a (partial) local match it will only take the matched amino acids into account. If there are multiple possible masses for any of the stretches it returns the smallest difference.

Source

pub fn short(&self) -> String

Get a short representation of the alignment in CIGAR like format. It has three additional classes {a}(:{b})?(r|i) and {a}m denoting any special step with the given a and b step size, if b is not given it is the same as a. r is rotation, i is isobaric, and m is identity but mass mismatch (modification).

Trait Implementations§

Source§

impl<A: Clone, B: Clone> Clone for Alignment<A, B>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug, B: Debug> Debug for Alignment<A, B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, A, B> Deserialize<'de> for Alignment<A, B>
where A: Deserialize<'de>, B: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<A: Hash, B: Hash> Hash for Alignment<A, B>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<A: Eq, B: Eq> Ord for Alignment<A, B>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<A: PartialEq, B: PartialEq> PartialEq for Alignment<A, B>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A: Eq, B: Eq> PartialOrd for Alignment<A, B>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<A, B> Serialize for Alignment<A, B>
where A: Serialize, B: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<A: PartialEq + Eq, B: PartialEq + Eq> Eq for Alignment<A, B>

Auto Trait Implementations§

§

impl<A, B> Freeze for Alignment<A, B>
where A: Freeze, B: Freeze,

§

impl<A, B> RefUnwindSafe for Alignment<A, B>

§

impl<A, B> Send for Alignment<A, B>
where A: Send, B: Send,

§

impl<A, B> Sync for Alignment<A, B>
where A: Sync, B: Sync,

§

impl<A, B> Unpin for Alignment<A, B>
where A: Unpin, B: Unpin,

§

impl<A, B> UnwindSafe for Alignment<A, B>
where A: UnwindSafe, B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HighestOf<T> for T

Source§

type HighestLevel = T

This is the highest complexity level out of Self and the type parameter
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AtLeast<T> for T

Source§

impl<T> AtMax<T> for T

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,