IDMapper#

class pyopenms.IDMapper#

Bases: object

Cython implementation of _IDMapper

Original C++ documentation is available here

– Inherits from [‘DefaultParamHandler’]

__init__()#

Overload:

__init__(self) None

Annotates an MSExperiment, FeatureMap or ConsensusMap with peptide identifications

Overload:

__init__(self, in_0: IDMapper) None

Methods

__init__

Overload:

annotate

Overload:

getDefaults(self)

Returns the default parameters

getName(self)

Returns the name

getParameters(self)

Returns the parameters

getSubsections(self)

mapPrecursorsToIdentifications(self, ...)

Mapping of peptide identifications to spectra

setName(self, in_0)

Sets the name

setParameters(self, param)

Sets the parameters

annotate()#

Overload:

annotate(self, map_: MSExperiment, ids: List[PeptideIdentification], protein_ids: List[ProteinIdentification], clear_ids: bool, mapMS1: bool) None

Mapping method for peak maps

The identifications stored in a PeptideIdentification instance can be added to the corresponding spectrum Note that a PeptideIdentication is added to ALL spectra which are within the allowed RT and MZ boundaries

Parameters:
  • map – MSExperiment to receive the identifications

  • peptide_ids – PeptideIdentification for the MSExperiment

  • protein_ids – ProteinIdentification for the MSExperiment

  • clear_ids – Reset peptide and protein identifications of each scan before annotating

  • map_ms1 – Attach Ids to MS1 spectra using RT mapping only (without precursor, without m/z)

Raises:

Exception: MissingInformation is thrown if entries of ‘peptide_ids’ do not contain ‘MZ’ and ‘RT’ information

Overload:

annotate(self, map_: MSExperiment, fmap: FeatureMap, clear_ids: bool, mapMS1: bool) None

Mapping method for peak maps

Add peptide identifications stored in a feature map to their corresponding spectrum This function converts the feature map to a vector of peptide identifications (all peptide IDs from each feature are taken) and calls the respective annotate() function RT and m/z are taken from the peptides, or (if missing) from the feature itself

Parameters:
  • map – MSExperiment to receive the identifications

  • fmap – FeatureMap with PeptideIdentifications for the MSExperiment

  • clear_ids – Reset peptide and protein identifications of each scan before annotating

  • map_ms1 – Attach Ids to MS1 spectra using RT mapping only (without precursor, without m/z)

Overload:

annotate(self, map_: FeatureMap, ids: List[PeptideIdentification], protein_ids: List[ProteinIdentification], use_centroid_rt: bool, use_centroid_mz: bool, spectra: MSExperiment) None

Mapping method for peak maps

If all features have at least one convex hull, peptide positions are matched against the bounding boxes of the convex hulls by default. If not, the positions of the feature centroids are used. The respective coordinates of the centroids are also used for matching (in place of the corresponding ranges from the bounding boxes) if ‘use_centroid_rt’ or ‘use_centroid_mz’ are true

In any case, tolerance in RT and m/z dimension is applied according to the global parameters ‘rt_tolerance’ and ‘mz_tolerance’. Tolerance is understood as “plus or minus x”, so the matching range is actually increased by twice the tolerance value

If several features (incl. tolerance) overlap the position of a peptide identification, the identification is annotated to all of them

Parameters:
  • map – MSExperiment to receive the identifications

  • ids – PeptideIdentification for the MSExperiment

  • protein_ids – ProteinIdentification for the MSExperiment

  • use_centroid_rt – Whether to use the RT value of feature centroids even if convex hulls are present

  • use_centroid_mz – Whether to use the m/z value of feature centroids even if convex hulls are present

  • spectra – Whether precursors not contained in the identifications are annotated with an empty PeptideIdentification object containing the scan index

Raises:

Exception: MissingInformation is thrown if entries of ‘ids’ do not contain ‘MZ’ and ‘RT’ information

Overload:

annotate(self, map_: ConsensusMap, ids: List[PeptideIdentification], protein_ids: List[ProteinIdentification], measure_from_subelements: bool, annotate_ids_with_subelements: bool, spectra: MSExperiment) None

Mapping method for peak maps

If all features have at least one convex hull, peptide positions are matched against the bounding boxes of the convex hulls by default. If not, the positions of the feature centroids are used. The respective coordinates of the centroids are also used for matching (in place of the corresponding ranges from the bounding boxes) if ‘use_centroid_rt’ or ‘use_centroid_mz’ are true

In any case, tolerance in RT and m/z dimension is applied according to the global parameters ‘rt_tolerance’ and ‘mz_tolerance’. Tolerance is understood as “plus or minus x”, so the matching range is actually increased by twice the tolerance value

If several features (incl. tolerance) overlap the position of a peptide identification, the identification is annotated to all of them

Parameters:
  • map – MSExperiment to receive the identifications

  • ids – PeptideIdentification for the MSExperiment

  • protein_ids – ProteinIdentification for the MSExperiment

  • measure_from_subelements – Boolean operator set to true if distance estimate from FeatureHandles instead of Centroid

  • annotate_ids_with_subelements – Boolean operator set to true if store map index of FeatureHandle in peptide identification

  • spectra – Whether precursors not contained in the identifications are annotated with an empty PeptideIdentification object containing the scan index

Raises:

Exception: MissingInformation is thrown if entries of ‘ids’ do not contain ‘MZ’ and ‘RT’ information

getDefaults(self) Param#

Returns the default parameters

getName(self) bytes | str | String#

Returns the name

getParameters(self) Param#

Returns the parameters

getSubsections(self) List[bytes]#
mapPrecursorsToIdentifications(self, spectra: MSExperiment, ids: List[PeptideIdentification], mz_tol: float, rt_tol: float) IDMapper_SpectraIdentificationState#

Mapping of peptide identifications to spectra

This helper function partitions all spectra into those that had: - no precursor (e.g. MS1 spectra), - at least one identified precursor, - or only unidentified precursor

Parameters:
  • spectra – The mass spectra

  • ids – The peptide identifications

  • mz_tol – Tolerance used to map to precursor m/z

  • rt_tol – Tolerance used to map to spectrum retention time

Returns:

A struct of vectors holding spectra indices of the partitioning

setName(self, in_0: bytes | str | String) None#

Sets the name

setParameters(self, param: Param) None#

Sets the parameters