OpenMS
Loading...
Searching...
No Matches
Deisotoper Class Reference

Collapse isotopic clusters in a centroided peak spectrum to one monoisotopic peak per ion. More...

#include <OpenMS/PROCESSING/DEISOTOPING/Deisotoper.h>

Static Public Member Functions

static void deisotopeWithAveragineModel (MSSpectrum &spectrum, double fragment_tolerance, bool fragment_unit_ppm, int number_of_final_peaks=5000, int min_charge=1, int max_charge=3, bool keep_only_deisotoped=false, unsigned int min_isopeaks=2, unsigned int max_isopeaks=10, bool make_single_charged=true, bool annotate_charge=false, bool annotate_iso_peak_count=false, bool add_up_intensity=false)
 Detect isotopic clusters in a mass spectrum.
 
static void deisotopeAndSingleCharge (MSSpectrum &spectrum, double fragment_tolerance, bool fragment_unit_ppm, int min_charge=1, int max_charge=3, bool keep_only_deisotoped=false, unsigned int min_isopeaks=3, unsigned int max_isopeaks=10, bool make_single_charged=true, bool annotate_charge=false, bool annotate_iso_peak_count=false, bool use_decreasing_model=true, unsigned int start_intensity_check=2, bool add_up_intensity=false, bool annotate_features=false)
 Detect isotopic clusters in a mass spectrum.
 
static bool isToleranceSupported (double fragment_tolerance, bool fragment_unit_ppm)
 Whether deisotopeAndSingleCharge() supports this fragment tolerance.
 

Detailed Description

Collapse isotopic clusters in a centroided peak spectrum to one monoisotopic peak per ion.

Deisotoping is the standard pre-processing step for centroided MS/MS spectra in database search: each isotopologue ladder (M, M+1, M+2, ...) belonging to one ion is reduced to a single peak, typically the monoisotopic one. The class exposes two static algorithms that share the same in-place spectrum contract but differ in how aggressively they enforce a chemical model:

  • deisotopeWithAveragineModel — uses a KL-divergence check against the averagine isotope distribution to score candidate clusters, and prefers the cluster with the most peaks (then the highest charge) when several charge states explain the same base peak. Adapted in parts from Guo Ci Teo et al., DOI: 10.1021/acs.jproteome.0c00544, and closely related to the legacy implementation by Timo Sachsenberg.
  • deisotopeAndSingleCharge — uses a simpler model. Peaks are walked in m/z-ascending order; for each peak that has not yet been assigned to a cluster, charges are tried from max_charge down to min_charge, and isotopologues are probed at the C12-C13 spacing for the current charge until either no matching peak is found, max_isopeaks is reached or (only when use_decreasing_model is set) intensities stop decreasing. Faster and less sensitive to deviations from the averagine model, but more vulnerable to spurious chaining.

Both methods operate in-place on the input spectrum (sorted by m/z on entry), drop the consumed isotopologues, optionally collapse charges

‍1 to the equivalent singly-charged monoisotopic m/z, and remove

zero-intensity peaks. Per-peak metadata such as charge and iso_peak_count can be annotated into IntegerDataArrays on demand (see the per-method documentation for the exact set of flags). Existing DataArrays are kept and shrunk in lock-step with the retained peaks.

Typical use cases (in order of frequency in OpenMS):

Note
Both algorithms assume peptide fragment ions in their default configuration (charges 1..3, averagine model). For oligonucleotides, lipids, or other molecule classes the intensity-decreasing assumption used by deisotopeAndSingleCharge can be relaxed via the use_decreasing_model and start_intensity_check parameters.

Member Function Documentation

◆ deisotopeAndSingleCharge()

static void deisotopeAndSingleCharge ( MSSpectrum spectrum,
double  fragment_tolerance,
bool  fragment_unit_ppm,
int  min_charge = 1,
int  max_charge = 3,
bool  keep_only_deisotoped = false,
unsigned int  min_isopeaks = 3,
unsigned int  max_isopeaks = 10,
bool  make_single_charged = true,
bool  annotate_charge = false,
bool  annotate_iso_peak_count = false,
bool  use_decreasing_model = true,
unsigned int  start_intensity_check = 2,
bool  add_up_intensity = false,
bool  annotate_features = false 
)
static

Detect isotopic clusters in a mass spectrum.

Deisotoping is based on C13 abundance and will try to identify a simple model based on the C12-C13 distance and charge state. This is often a good approximation for peptide fragment ion spectra but may not work well for other spectra. The algorithm will consider each peak (starting from the right of a spectrum) and, for each peak, attempt to add isotopic peaks to its envelope until either no peak is found, the maximum number of isotopic peaks is reached or (only when using use_decreasing_model) the intensity of the peak is higher than the previous peak.

Deisotoping is done in-place and if annotate_charge is true, an additional IntegerDataArray "charge" will be appended. If annotate_iso_peak_count is true, an additional IntegerDataArray "iso_peak_count" containing the number of isotopic peaks will be appended. If annotate_features is true, an addtional IntegerData Array "feature_number" containing the feature index will be appended. Existing DataArrays are kept and shrunken to the peaks which remain in the spectrum.

Parameters
[spectrum]Input spectrum (sorted by m/z)
[fragment_tolerance]The tolerance used to match isotopic peaks
[fragment_unit_ppm]Whether ppm or m/z is used as tolerance
[min_charge]The minimum charge considered
[max_charge]The maximum charge considered
[keep_only_deisotoped]Only monoisotopic peaks of fragments with isotopic pattern are retained
[min_isopeaks]The minimum number of isotopic peaks (at least 2) required for an isotopic cluster
[max_isopeaks]The maximum number of isotopic peaks (at least 2) considered for an isotopic cluster
[make_single_charged]Convert deisotoped monoisotopic peak to single charge
[annotate_charge]Annotate the charge to the peaks in the IntegerDataArray: "charge" (0 for unknown charge)
[annotate_iso_peak_count]Annotate the number of isotopic peaks in a pattern for each monoisotopic peak in the IntegerDataArray: "iso_peak_count"
[use_decreasing_model]Use a simple averagine model that expects heavier isotopes to have less intensity. If false, no intensity checks are applied.
[start_intensity_check]Number of the isotopic peak from which the decreasing model should be applied. <= 1 will force the monoisotopic peak to be the most intense. 2 will allow the monoisotopic peak to be less intense than the second peak. 3 will allow the monoisotopic and the second peak to be less intense than the third, etc. A number higher than max_isopeaks will effectively disable use_decreasing_model completely.
[add_up_intensity]Sum up the total intensity of each isotopic pattern into the intensity of the reported monoisotopic peak
[annotate_features]Annotates the feature index in the IntegerDataArray: "feature_number".

Note: If make_single_charged is selected, the original charge (>=1) gets annotated.

◆ deisotopeWithAveragineModel()

static void deisotopeWithAveragineModel ( MSSpectrum spectrum,
double  fragment_tolerance,
bool  fragment_unit_ppm,
int  number_of_final_peaks = 5000,
int  min_charge = 1,
int  max_charge = 3,
bool  keep_only_deisotoped = false,
unsigned int  min_isopeaks = 2,
unsigned int  max_isopeaks = 10,
bool  make_single_charged = true,
bool  annotate_charge = false,
bool  annotate_iso_peak_count = false,
bool  add_up_intensity = false 
)
static

Detect isotopic clusters in a mass spectrum.

This algorithm is in parts taken from Guo Ci Teo et al, DOI: 10.1021/acs.jproteome.0c00544 and is closely related to deisotopeAndSingleCharge by Timo Sachsenberg.

Deisotoping is based on C13 abundance and will try to identify isotopic clusters fitting to an averagine model, taking in account the corresponding charge state. This only makes sense for peptide fragment ion spectra. The algorithm considers each peak in the spectrum and will try to form isotopic clusters for every charge state from min_charge to max_charge. Of the clusters that pass an averaginge check based on KL-divergence (for all subclusters starting at the base peak as well), the cluster with most peaks (and in case of equality, also highest charge) is kept.

Deisotoping is done in-place, and the algorithm removes peaks with intensity 0. If rem_low_intensity is true, peaks not belonging to the highest 1000/5000 peaks are removed (see used_for_open_search). If annotate_charge is true, an additional IntegerDataArray "charge" will be appended. If annotate_iso_peak_count is true, an additional IntegerDataArray "iso_peak_count" containing the number of isotopic peaks will be appended. Existing DataArrays are kept and shrunken to the peaks which remain in the spectrum.

Parameters
[spectrum]Input spectrum (sorted by m/z)
[fragment_tolerance]The tolerance used to match isotopic peaks
[fragment_unit_ppm]Whether ppm or m/z is used as tolerance
[number_of_final_peaks]Only the largest number_of_final_peaks peaks are kept in any spectrum. If 0, no filtering is performed. For open search, 1000 is recommended, else 5000.
[min_charge]The minimum charge considered
[max_charge]The maximum charge considered
[keep_only_deisotoped]Only monoisotopic peaks of fragments with isotopic pattern are retained
[min_isopeaks]The minimum number of isotopic peaks (at least 2) required for an isotopic cluster
[max_isopeaks]The maximum number of isotopic peaks (at least 2) considered for an isotopic cluster
[make_single_charged]Convert deisotoped monoisotopic peak to single charge, the original charge (>=1) gets annotated
[annotate_charge]Annotate the charge to the peaks in the IntegerDataArray: "charge" (0 for unknown charge)
[annotate_iso_peak_count]Annotate the number of isotopic peaks in a pattern for each monoisotopic peak in the IntegerDataArray: "iso_peak_count"
[add_up_intensity]Sum up the total intensity of each isotopic pattern into the intensity of the reported monoisotopic peak

◆ isToleranceSupported()

static bool isToleranceSupported ( double  fragment_tolerance,
bool  fragment_unit_ppm 
)
static

Whether deisotopeAndSingleCharge() supports this fragment tolerance.

deisotopeAndSingleCharge() throws Exception::IllegalArgument for a fragment tolerance greater than 100 ppm or 0.1 Da (isotope spacing cannot be resolved at lower resolution). This non-throwing predicate exposes that same limit so callers can choose to skip deisotoping (e.g. for low-resolution ion-trap CID data) instead of triggering the throw – important when the call sits inside an OpenMP region, where an escaping exception calls std::terminate() (OpenMS#9619).

Returns
true iff (fragment_unit_ppm ? fragment_tolerance <= 100 : fragment_tolerance <= 0.1)