IDMapper#
- class pyopenms.IDMapper#
Bases:
DefaultParamHandlerAnnotates an MSExperiment, FeatureMap or ConsensusMap with peptide identifications
- __init__() None#
- __init__(arg: pyopenms.IDMapper, /) None
Methods
__init__()annotate(map, peptide_ids, protein_ids[, ...])Overloaded function.
Returns the default parameters
getName()Returns the name
Returns the parameters
mapPrecursorsToIdentifications(spectra, ids, ...)Mapping of peptide identifications to spectra
setName(name)Sets the name
setParameters(param)Sets the parameters
Attributes
- MEASURE_DA = 1#
- MEASURE_PPM = 0#
- class Measure(*values)#
Bases:
IntEnumMass tolerance measure (PPM or Dalton)
- MEASURE_DA = 1#
- MEASURE_PPM = 0#
- as_integer_ratio()#
Return a pair of integers, whose ratio is equal to the original int.
The ratio is in lowest terms and has a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- conjugate()#
Returns self, the complex conjugate of any int.
- denominator#
the denominator of a rational number in lowest terms
- classmethod from_bytes(bytes, byteorder='big', *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- getMapping()#
Returns a dict mapping int values to enum member name strings.
- imag#
the imaginary part of a complex number
- is_integer()#
Returns True. Exists for duck type compatibility with float.is_integer.
- numerator#
the numerator of a rational number in lowest terms
- real#
the real part of a complex number
- to_bytes(length=1, byteorder='big', *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- annotate(map: pyopenms.AnnotatedMSRun, peptide_ids: pyopenms.PeptideIdentificationList, protein_ids: collections.abc.Sequence[pyopenms.ProteinIdentification], clear_ids: bool = False, map_ms1: bool = False) None#
- annotate(map: pyopenms.AnnotatedMSRun, fmap: pyopenms.FeatureMap, clear_ids: bool = False, map_ms1: bool = False) None
- annotate(map: pyopenms.FeatureMap, ids: pyopenms.PeptideIdentificationList, protein_ids: collections.abc.Sequence[pyopenms.ProteinIdentification], use_centroid_rt: bool = False, use_centroid_mz: bool = False, spectra: pyopenms.MSExperiment = MSExperiment(num_spectra=0, num_chromatograms=0)) None
- annotate(map: pyopenms.ConsensusMap, ids: pyopenms.PeptideIdentificationList, protein_ids: collections.abc.Sequence[pyopenms.ProteinIdentification], measure_from_subelements: bool = False, annotate_ids_with_subelements: bool = False, spectra: pyopenms.MSExperiment = MSExperiment(num_spectra=0, num_chromatograms=0)) None
Overloaded function.
annotate(map: pyopenms.AnnotatedMSRun, peptide_ids: pyopenms.PeptideIdentificationList, protein_ids: collections.abc.Sequence[pyopenms.ProteinIdentification], clear_ids: bool = False, map_ms1: bool = False) -> None
Mapping method using PeptideIdentificationList
The identifications stored in a PeptideIdentificationList instance can be added to the corresponding spectrum
- Parameters:
map – AnnotatedMSRun to receive the identifications
peptide_ids – PeptideIdentificationList 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)
annotate(map: pyopenms.AnnotatedMSRun, fmap: pyopenms.FeatureMap, clear_ids: bool = False, map_ms1: bool = False) -> 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 – AnnotatedMSRun 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)
annotate(map: pyopenms.FeatureMap, ids: pyopenms.PeptideIdentificationList, protein_ids: collections.abc.Sequence[pyopenms.ProteinIdentification], use_centroid_rt: bool = False, use_centroid_mz: bool = False, spectra: pyopenms.MSExperiment = MSExperiment(num_spectra=0, num_chromatograms=0)) -> 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
annotate(map: pyopenms.ConsensusMap, ids: pyopenms.PeptideIdentificationList, protein_ids: collections.abc.Sequence[pyopenms.ProteinIdentification], measure_from_subelements: bool = False, annotate_ids_with_subelements: bool = False, spectra: pyopenms.MSExperiment = MSExperiment(num_spectra=0, num_chromatograms=0)) -> 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() pyopenms.Param#
Returns the default parameters
- getName() str#
Returns the name
- getParameters() pyopenms.Param#
Returns the parameters
- getSubsections() list[str]#
- static mapPrecursorsToIdentifications(spectra: pyopenms.MSExperiment, ids: pyopenms.PeptideIdentificationList, mz_tol: float, rt_tol: float) pyopenms.IDMapper_PeptideIdentificationListState#
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(name: str) None#
Sets the name
- setParameters(param: pyopenms.Param) None#
Sets the parameters