Isotopic Pattern Generation¶
The ms_deisotope.averagine module contains several pre-created isotopic models whose
name is derived from the original peptide averagine [Senko], as well
as isotopic models for other common molecular classes. Isotopic patterns are generated from
a chemical composition using brainpy, which is an implementation of the
Baffling Recursive Algorithm for Isotopic distributioN calculations [Dittwald2014].
import ms_deisotope
# Senko peptide averagine
isotopic_pattern = ms_deisotope.peptide.isotopic_cluster(966.12, 2)
for peak in isotopic_pattern:
    print(peak.mz, peak.intensity)
ms_deisotopeincludes several pre-defined averagines (or “averagoses” as may be more appropriate):Senko’s peptide -
ms_deisotope.peptideNative N- and O-glycan -
ms_deisotope.glycanPermethylated glycan -
ms_deisotope.permethylated_glycanGlycopeptide -
ms_deisotope.glycopeptideSulfated Glycosaminoglycan -
ms_deisotope.heparan_sulfateUnsulfated Glycosaminoglycan -
ms_deisotope.heparin
- class ms_deisotope.averagine.Averagine(base_composition)¶
 An isotopic model which can be used to interpolate the composition of a class of molecule given an average monomer composition and a theoretical polymer mass
Implements the
Mappinginterface.- base_composition¶
 A mapping from element symbol to average count (float) of that element for the average monomer
- Type
 Mapping
- base_mass¶
 The base mass of the average monomer. Calculated from
base_composition- Type
 float
- isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95, double ignore_below=0.0) TheoreticalIsotopicPattern¶
 Generate a theoretical isotopic pattern for the given m/z and charge state, thresholded by theoretical peak height and density.
- Parameters
 mz (float) – The reference m/z to calculate the neutral mass to interpolate from
charge (int, optional) – The reference charge state to calculate the neutral mass. Defaults to 1
charge_carrier (float, optional) – The mass of the charge carrier. Defaults to the mass of a proton.
truncate_after (float, optional) – The percentage of the signal in the theoretical isotopic pattern to include. Defaults to 0.95, including the first 95% of the signal in the generated pattern
ignore_below (float, optional) – Omit theoretical peaks whose intensity is below this number. Defaults to 0.0
- Returns
 The generated and thresholded pattern
- Return type
 
- scale(self, double mz, int charge=1, double charge_carrier=PROTON) dict¶
 Given an m/z and a charge state, interpolate the composition of the polymer with the matching neutral mass
- Parameters
 mz (float) – The reference m/z to calculate the neutral mass to interpolate from
charge (int, optional) – The reference charge state to calculate the neutral mass. Defaults to 1
charge_carrier (float, optional) – The mass of the charge carrier. Defaults to the mass of a proton.
- Returns
 The interpolated composition for the calculated neutral mass, rounded to the nearest integer and hydrogen corrected.
- Return type
 Mapping
References
Senko, M. W., Beu, S. C., & McLafferty, F. W. (1995). Determination of monoisotopic masses and ion populations for large biomolecules from resolved isotopic distributions. Journal of the American Society for Mass Spectrometry, 6(4), 229–233. http://doi.org/10.1016/1044-0305(95)00017-8
- class ms_deisotope.averagine.TheoreticalIsotopicPattern(peaklist, origin, offset=None)¶
 Represent a theoretical isotopic peak list
- peaklist¶
 The theoretical isotopic pattern peak list
- Type
 list of
brainpy.TheoreticalPeak
- origin¶
 The monoisotopic peak’s m/z
- Type
 float
- ignore_below(self, double ignore_below=0.0) TheoreticalIsotopicPattern¶
 Discards peaks whose intensity is below
ignore_below.After discarding peaks, the pattern will be renormalized to sum to
1.0- Parameters
 ignore_below (float, optional) – The threshold below which peaks will be discarded
- Returns
 self
- Return type
 
- scale(self, list experimental_distribution, str method='sum') TheoreticalIsotopicPattern¶
 Scales
self’s intensity to match the intensity distribution of the experimental isotopic pattern inexperimental_distribution.The
methodargument must be one of:- “sum”:
 Scale each peak of the theoretical distribution by the sum of the intensity in the experimental distribution such that the sums of their intensities are equal.
- “max”:
 Select the most abundant peak in the theoretical distribution \(t_i\), find it’s match in the experimental distribution \(e_i\), find the scaling factor \(\alpha = \frac{e_i}{t_i}\) which will make \(e_i == t_i\) and scale all peaks in self by \(\alpha\)
- “basepeak”:
 As in “max”, except the most abundant peak index is taken from the experimental distribution
- “top3”:
 The as in “max”, but the scaling factor is the mean of the scale factors for the top three most abundant theoretical peaks.
- Parameters
 experimental_distribution (list) – The experimental peaks matched
method (str, optional) – The scaling method to use. Defaults to
"sum"
- Returns
 self
- Return type
 
- shift(self, double mz) TheoreticalIsotopicPattern¶
 Shift all the m/z of peaks in the isotopic pattern by
offsetm/z.This will update
originto reflect the new starting monoisotopic m/z.- Parameters
 offset (float) – The amount to shift each peak in the pattern by in m/z
- Returns
 self
- Return type
 
- truncate_after(self, double truncate_after=0.95) TheoreticalIsotopicPattern¶
 Drops peaks from the end of the isotopic pattern which make up the last
1 - truncate_afterpercent of the isotopic pattern.After truncation, the pattern is renormalized to sum to
1- Parameters
 truncate_after (float, optional) – The percentage of the isotopic pattern signal to retain. Defaults to 0.95.
- Returns
 self
- Return type
 
- class ms_deisotope.averagine.AveragineCache(averagine, backend=None, double cache_truncation=1.)¶
 A wrapper around a
Averagineinstance which will cache isotopic patterns produced for new (m/z, charge) pairs and reuses it for nearby m/z values- cache_truncation¶
 Number of decimal places to round off the m/z for caching purposes
- Type
 float
- isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95, double ignore_below=0.0) TheoreticalIsotopicPattern¶
 Generate a theoretical isotopic pattern for the given m/z and charge state, thresholded by theoretical peak height and density.
Mimics
Averagine.isotopic_cluster()but uses the object’s cache throughhas_mz_charge_pair().- Parameters
 mz (float) – The reference m/z to calculate the neutral mass to interpolate from
charge (int, optional) – The reference charge state to calculate the neutral mass. Defaults to 1
charge_carrier (float, optional) – The mass of the charge carrier. Defaults to the mass of a proton.
truncate_after (float, optional) – The percentage of the signal in the theoretical isotopic pattern to include. Defaults to 0.95, including the first 95% of the signal in the generated pattern
ignore_below (float, optional) – Omit theoretical peaks whose intensity is below this number. Defaults to 0.0
- Returns
 The generated and thresholded pattern
- Return type
 
- Senko
 Senko, M. W., Beu, S. C., & McLafferty, F. W. (1995). Determination of monoisotopic masses and ion populations for large biomolecules from resolved isotopic distributions. Journal of the American Society for Mass Spectrometry, 6(4), 229–233. http://doi.org/10.1016/1044-0305(95)00017-8
- Dittwald2014
 Dittwald, P., & Valkenborg, D. (2014). BRAIN 2.0: time and memory complexity improvements in the algorithm for calculating the isotope distribution. Journal of the American Society for Mass Spectrometry, 25(4), 588–94. https://doi.org/10.1007/s13361-013-0796-5