pub struct Fragment {
pub formula: MolecularFormula,
pub charge: Charge,
pub ion: FragmentType,
pub peptide_index: usize,
pub neutral_loss: Option<NeutralLoss>,
pub label: String,
}
Expand description
A theoretical fragment of a peptide
Fields§
§formula: MolecularFormula
The theoretical composition
charge: Charge
The charge
ion: FragmentType
All possible annotations for this fragment saved as a tuple of peptide index and its type
peptide_index: usize
The peptide this fragment comes from, saved as the index into the list of peptides in the overarching crate::ComplexPeptide
struct
neutral_loss: Option<NeutralLoss>
Any neutral losses applied
label: String
Additional description for humans
Implementations§
source§impl Fragment
impl Fragment
sourcepub fn mz(&self, mode: MassMode) -> MassOverCharge
pub fn mz(&self, mode: MassMode) -> MassOverCharge
Get the mz
sourcepub fn ppm(&self, other: &Self, mode: MassMode) -> MassOverCharge
pub fn ppm(&self, other: &Self, mode: MassMode) -> MassOverCharge
Get the ppm difference between two fragments
sourcepub fn new(
theoretical_mass: MolecularFormula,
charge: Charge,
peptide_index: usize,
ion: FragmentType,
label: String
) -> Self
pub fn new( theoretical_mass: MolecularFormula, charge: Charge, peptide_index: usize, ion: FragmentType, label: String ) -> Self
Create a new fragment
sourcepub fn generate_all(
theoretical_mass: &Multi<MolecularFormula>,
peptide_index: usize,
annotation: &FragmentType,
termini: &[(MolecularFormula, String)],
neutral_losses: &[NeutralLoss]
) -> Vec<Self>
pub fn generate_all( theoretical_mass: &Multi<MolecularFormula>, peptide_index: usize, annotation: &FragmentType, termini: &[(MolecularFormula, String)], neutral_losses: &[NeutralLoss] ) -> Vec<Self>
Generate a list of possible fragments from the list of possible preceding termini and neutral losses
sourcepub fn with_charge(&self, charge: &MolecularCharge) -> Self
pub fn with_charge(&self, charge: &MolecularCharge) -> Self
Create a copy of this fragment with the given charge
sourcepub fn with_neutral_loss(&self, neutral_loss: &NeutralLoss) -> Self
pub fn with_neutral_loss(&self, neutral_loss: &NeutralLoss) -> Self
Create a copy of this fragment with the given neutral loss
sourcepub fn with_neutral_losses(&self, neutral_losses: &[NeutralLoss]) -> Vec<Self>
pub fn with_neutral_losses(&self, neutral_losses: &[NeutralLoss]) -> Vec<Self>
Create copies of this fragment with the given neutral losses (and a copy of this fragment itself)
Trait Implementations§
source§impl<'de> Deserialize<'de> for Fragment
impl<'de> Deserialize<'de> for Fragment
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq for Fragment
impl PartialEq for Fragment
source§impl PartialOrd for Fragment
impl PartialOrd for Fragment
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moreimpl StructuralPartialEq for Fragment
Auto Trait Implementations§
impl Freeze for Fragment
impl RefUnwindSafe for Fragment
impl Send for Fragment
impl Sync for Fragment
impl Unpin for Fragment
impl UnwindSafe for Fragment
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more