Deconvoluted Peak Sets

class ms_deisotope.peak_set.DeconvolutedPeak(neutral_mass, intensity, charge, signal_to_noise, index, full_width_at_half_max, a_to_a2_ratio=0, most_abundant_mass=0, average_mass=0, score=0, envelope=(), mz=0, fit=None, chosen_for_msms=False, area=0)

Represent a single deconvoluted peak which represents an aggregated isotopic pattern collapsed to its monoisotopic peak, with a known charge state

a_to_a2_ratio

Ratio of intensities of A peak to A+2 peak

Type

float

average_mass

The averaged neutral mass of the composition, the weighted average of the envelope peaks.

Type

float

charge

The signed charge state of the isotopic pattern

Type

int

envelope

The sequence of (mz, intensity) pairs which map to this peak

Type

Envelope

full_width_at_half_max

The averaged full width at half max of this isotopic pattern

Type

float

index

The position of this peak in different orderings

Type

_Index

intensity

The summed height of the peaks in the isotopic pattern this peak captures

Type

float

most_abundant_mass

The neutral mass of the most abundant peak in the isotopic pattern this peak captures

Type

float

mz

The mass-charge-ratio of the monoisotopic peak

Type

float

neutral_mass

The neutral mass of the monoisotopic peak

Type

float

score

An assigned value describing the quality of this peak’s fit. The semantics of this score depends upon the scoring function

Type

float

signal_to_noise

The average signal-to-noise ratio of the peaks in the isotopic pattern this peak captures

Type

float

class ms_deisotope.peak_set.DeconvolutedPeakSet

A Sequence of DeconvolutedPeak objects, ordered by neutral mass. This class is intended to support fast searches by mass.

The recommended query method is all_peaks_for() when you care about all distinct charge states, while has_peak() can be used when you only care about the closest peak matching the query mass.

Note

has_peak() and between() support searching for m/z values instead of intensity values, but this is purely for convenience. The PPM error scale on m/z is different than on neutral mass, and should not be assumed to give identical results as the neutral mass query methods.

If you wish to use the resulting peaks in another tool that assumes all peaks are singly charged, see decharge().

has_peak(self, double neutral_mass, double error_tolerance=1e-5, bool use_mz=False) DeconvolutedPeak

Find the peak that best matches neutral_mass within error_tolerance mass accuracy ppm.

If use_mz is True, instead of matching neutral masses, match peaks using m/z instead.

If indexed is not True, then reindex() will be called.

Parameters
  • neutral_mass (double) – The mass to search for

  • error_tolerance (double) – The PPM error tolerance to apply

  • use_mz (bool) – Whether to search using m/z instead of neutral mass

Returns

The found peak, or None if no peak is found

Return type

DeconvolutedPeak

all_peaks_for(self, double neutral_mass, double tolerance=1e-5) tuple

Find all peaks that match neutral_mass within error_tolerance mass accuracy ppm.

Parameters
  • neutral_mass (double) – The mass to search for

  • error_tolerance (double) – The PPM error tolerance to apply

Returns

The found peaks

Return type

tuple of DeconvolutedPeak

between(self, m1, m2, tolerance=1e-5, use_mz=False)

Retrieve a DeconvolutedPeakSet containing all the peaks whose mass is between m1 and m2.

If use_mz is True then search by m/z instead of mass

Parameters
  • m1 (float) – The lower mass limit

  • m2 (float) – The upper mass limit

  • use_mz (bool) – Whether to search for m/z instead of neutral mass

Returns

Return type

DeconvolutedPeakSet

Transformations

ms_deisotope.peak_set.decharge(self, include_envelopes=True, charge_carrier=1.00727646677, new_charge=1)[source]

Transfomr multiply charged deconvoluted peaks into singly charged deconvoluted peaks.

This operation returns a copy of the peak set, the input peak set is unchanged.

Parameters
  • include_envelopes (bool, optional) – Whether or not to charge-transform the isotopic envelope fitted in DeconvolutedPeak.envelope (the default is True)

  • charge_carrier (float, optional) – The charge carrier mass to use when recalculating m/z (the default is PROTON)

  • new_charge (int, optional) – The new charge to set all peaks to, the default being +1

Returns

Return type

DeconvolutedPeakSet

ms_deisotope.peak_set.merge(peaks_a, *peaks_b, **kwargs)[source]

Combine two DeconvolutedPeakSet objects.

Parameters
  • peaks_a (DeconvolutedPeakSet) –

  • peaks_b (DeconvolutedPeakSet) –

  • copy (bool) – Whether or not to copy the peaks first. If not, the two input peak sets should not be used again as their indices will have been corrupted.

Returns

Return type

DeconvolutedPeakSet

ms_deisotope.peak_set.envelopes_to_peak_set(self)[source]

Convert a set of deconvoluted peaks with fitted isotopic envelopes into a set of centroids representing those envelope peaks.

Returns

Return type

ms_peak_picker.PeakSet

ms_deisotope.peak_set.window_peak_set(peak_set: ms_deisotope._c.peak_set.DeconvolutedPeakSetIndexed, window_size: float = 100.0, peaks_per_window: int = 10) List[List[ms_deisotope._c.peak_set.DeconvolutedPeak]][source]

Generate non-overlapping windows over a DeconvolutedPeakSet, selecting the most abundant peaks in each window.

Parameters
  • peak_set (DeconvolutedPeakSet) – The peak set to generate windows from.

  • window_size (float) – The width of the window in daltons. The default is 100.

  • peaks_per_window (int) – The number of peaks to retain per window, by intensity. Default is 10.

Returns

Return type

List[List[DeconvolutedPeak]]

Peak Components

Deconvoluted peaks may contain extra information beyond point-estimates from the raw spectrum. These data structures hold some of that information.

class ms_deisotope.peak_set.Envelope(pairs)

Represents a sequence of (mz, intensity) pairs which store peak positions that were matched. Since these peaks may later be mutated by subtraction, this structure stores copies of the numbers

Supports the Sequence protocol, and is read-only.

pairs

list of (mz, intensity) pairs

Type

tuple of tuple of (float, float)

class ms_deisotope.peak_set._Index(neutral_mass=0, mz=0)

Stores the ordered index of an object under sort by mz and sort by neutral_mass

mz

Index of this object (or its parent), ordered by mz

Type

int

neutral_mass

Index of this object (or its parent), ordered by neutral mass

Type

int

Other Deconvolution Product Types

class ms_deisotope.peak_set.DeconvolutedPeakSolution(solution, fit, *args, **kwargs)

Extends DeconvolutedPeak to also include a reference to the IsotopicFitRecord instance it is derived from, and optionally an object which the fit derives from.

fit

The isotopic pattern fit used to construct this peak

Type

IsotpicFitRecord

solution

Representation of the “source” of the isotopic fit

Type

object