Struct rustyms::LinearPeptide

source ·
pub struct LinearPeptide {
    pub labile: Vec<Modification>,
    pub n_term: Option<Modification>,
    pub c_term: Option<Modification>,
    pub sequence: Vec<SequenceElement>,
    pub ambiguous_modifications: Vec<Vec<usize>>,
    pub charge_carriers: Option<MolecularCharge>,
    /* private fields */
}
Expand description

A peptide with all data as provided by pro forma. Preferably generated by using the crate::ComplexPeptide::pro_forma function.

Fields§

§labile: Vec<Modification>

Labile modifications, which will not be found in the actual spectrum.

§n_term: Option<Modification>

N terminal modification

§c_term: Option<Modification>

C terminal modification

§sequence: Vec<SequenceElement>

The sequence of this peptide (includes local modifications)

§ambiguous_modifications: Vec<Vec<usize>>

For each ambiguous modification list all possible positions it can be placed on. Indexed by the ambiguous modification id.

§charge_carriers: Option<MolecularCharge>

The adduct ions, if specified

Implementations§

source§

impl LinearPeptide

Builder style methods to create a LinearPeptide

source

pub fn new(sequence: impl IntoIterator<Item = SequenceElement>) -> Self

Create a new LinearPeptide, if you want an empty peptide look at LinearPeptide::default. Potentially the .collect() or .into() methods can be useful as well.

source

pub fn global( self, global: impl IntoIterator<Item = (Element, Option<u16>)> ) -> Option<Self>

Add global isotope modifications, if any is invalid it returns None

source

pub fn labile(self, labile: impl IntoIterator<Item = Modification>) -> Self

Add labile modifications

source

pub fn n_term(self, term: Option<Modification>) -> Self

Add the N terminal modification

source

pub fn c_term(self, term: Option<Modification>) -> Self

Add the C terminal modification

source

pub fn charge_carriers(self, charge: Option<MolecularCharge>) -> Self

Add the charge carriers

source§

impl LinearPeptide

source

pub fn pro_forma(value: &str) -> Result<Self, CustomError>

Convenience wrapper to parse a linear peptide in pro forma notation, to handle all possible pro forma sequences look at ComplexPeptide::pro_forma.

§Errors

It gives an error when the peptide is not correctly formatted. (Also see the ComplexPeptide main function for this.) It additionally gives an error if the peptide specified was multimeric (see ComplexPeptide::singular).

source

pub fn sloppy_pro_forma( line: &str, location: Range<usize> ) -> Result<Self, CustomError>

Read sloppy pro forma like sequences. Defined by the use of square or round braces to indicate modifications and missing any particular method of defining the N or C terminal modifications. Additionally any underscores will be ignored both on the ends and inside the sequence.

All modifications follow the same definitions as the strict pro forma syntax, if it cannot be parsed as a strict pro forma modification it falls back to Modification::sloppy_modification.

§Errors

If it does not fit the above description.

source

pub fn len(&self) -> usize

Get the number of amino acids making up this peptide

source

pub fn is_empty(&self) -> bool

Check if there are any amino acids in this peptide

source

pub fn get_n_term(&self) -> MolecularFormula

The mass of the N terminal modifications. The global isotope modifications are NOT applied.

source

pub fn get_c_term(&self) -> MolecularFormula

The mass of the C terminal modifications. The global isotope modifications are NOT applied.

source

pub fn get_global(&self) -> &[(Element, Option<u16>)]

Get the global isotope modifications

source

pub fn reverse(&self) -> Self

Get the reverse of this peptide

source

pub fn assume_simple(&self)

Assume that the underlying peptide does not use fancy parts of the Pro Forma spec. This is the common lower bound for support in all functions of rustyms. If you want to be even more strict on the kind of peptides you want to take take a look at Self::assume_very_simple.

§Panics

When any of these functions are used:

  • Labile modifications
  • Global isotope modifications
  • Charge carriers, use of charged ions apart from protons
  • or when the sequence is empty.
source

pub fn assume_very_simple(&self)

Assume that the underlying peptide does not use fancy parts of the Pro Forma spec.

§Panics

When any of these functions are used:

  • Ambiguous modifications
  • Labile modifications
  • Global isotope modifications
  • Ambiguous amino acids (B/Z)
  • Ambiguous amino acid sequence (?AA)
  • Charge carriers, use of charged ions apart from protons
  • or when the sequence is empty.
source

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

Gives all the formulas for the whole peptide with no C and N terminal modifications. With the global isotope modifications applied.

source

pub fn generate_theoretical_fragments( &self, max_charge: Charge, model: &Model ) -> Vec<Fragment>

Generate the theoretical fragments for this peptide, with the given maximal charge of the fragments, and the given model. With the global isotope modifications applied.

§Panics

If max_charge outside the range 1..=u64::MAX.

source

pub fn sub_peptide(&self, index: impl RangeBounds<usize>) -> Self

Get a region of this peptide as a new peptide (with all terminal/global/ambiguous modifications).

source

pub fn digest( &self, protease: &Protease, max_missed_cleavages: usize ) -> Vec<Self>

Digest this sequence with the given protease and the given maximal number of missed cleavages.

Trait Implementations§

source§

impl Clone for LinearPeptide

source§

fn clone(&self) -> LinearPeptide

Returns a copy 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 Debug for LinearPeptide

source§

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

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

impl Default for LinearPeptide

source§

fn default() -> LinearPeptide

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for LinearPeptide

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 Display for LinearPeptide

source§

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

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

impl<Collection, Item> From<Collection> for LinearPeptide
where Collection: IntoIterator<Item = Item>, Item: Into<SequenceElement>,

source§

fn from(value: Collection) -> Self

Converts to this type from the input type.
source§

impl<Item> FromIterator<Item> for LinearPeptide
where Item: Into<SequenceElement>,

source§

fn from_iter<T: IntoIterator<Item = Item>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Hash for LinearPeptide

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<I: SliceIndex<[SequenceElement]>> Index<I> for LinearPeptide

§

type Output = <I as SliceIndex<[SequenceElement]>>::Output

The returned type after indexing.
source§

fn index(&self, index: I) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl MultiChemical for LinearPeptide

source§

fn formulas(&self) -> Multi<MolecularFormula>

Gives the formulas for the whole peptide. With the global isotope modifications applied. (Any B/Z will result in multiple possible formulas.)

source§

fn charge(&self) -> Option<i16>

Get the charge of this chemical, it returns None if no charge is defined.
source§

impl Ord for LinearPeptide

source§

fn cmp(&self, other: &LinearPeptide) -> 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 + PartialOrd,

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

impl PartialEq for LinearPeptide

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for LinearPeptide

source§

fn partial_cmp(&self, other: &LinearPeptide) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for LinearPeptide

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 Eq for LinearPeptide

source§

impl StructuralPartialEq for LinearPeptide

Auto Trait Implementations§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

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

§

type Output = T

Should always be Self
source§

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

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,