MRMFeature#

class pyopenms.MRMFeature#

Bases: object

Cython implementation of _MRMFeature

Original C++ documentation is available here

– Inherits from [‘Feature’]

A multi-chromatogram MRM (Multiple Reaction Monitoring) feature representing a peak group

An MRMFeature represents a detected signal across multiple chromatograms in targeted proteomics experiments (MRM/SRM). It contains corresponding features from individual transitions, where each transition is represented as a Feature object. This class is essential for analyzing peak groups in targeted MS experiments.

The MRMFeature stores:

  • Individual transition features (via addFeature/getFeature)

  • Precursor features for MS1 data (via addPrecursorFeature/getPrecursorFeature)

  • Quality scores for the peak group (via getScores/setScores)

Example usage:

mrm_feature = oms.MRMFeature()
# Add a transition feature with its native ID
feature = oms.Feature()
feature.setRT(100.5)
feature.setMZ(500.25)
feature.setIntensity(10000.0)
mrm_feature.addFeature(feature, "transition_1")
# Retrieve the feature by its ID
retrieved_feature = mrm_feature.getFeature("transition_1")
print(retrieved_feature.getRT())  # Should print 100.5
__init__()#

Overload:

__init__(self) None

Overload:

__init__(self, in_0: MRMFeature) None

Methods

__init__

addFeature(self, f, key)

Adds a transition feature to this MRM feature

addPrecursorFeature(self, f, key)

Adds a precursor feature to this MRM feature

clearMetaInfo(self)

Removes all meta values

clearUniqueId(self)

Clear the unique id.

encloses(self, rt, mz)

Checks if the feature's convex hulls enclose a given position

ensureUniqueId(self)

Assigns a valid unique id, but only if the present one is invalid.

getAnnotationState(self)

Returns the annotation state of the feature

getCharge(self)

Returns the charge state of the feature

getConvexHull(self)

Returns the overall convex hull of the feature

getConvexHulls(self)

Returns the convex hulls of individual mass traces

getFeature(self, key)

Retrieves a transition feature by its native ID

getFeatureIDs(self, result)

Retrieves the native IDs of all transition features

getFeatures(self)

Returns all transition features in this MRM feature

getIntensity(self)

Returns the data point intensity (height)

getKeys(self, keys)

Fills the given vector with a list of all keys for which a value is set

getMZ(self)

Returns the m/z coordinate (index 1)

getMetaValue(self, in_0)

Returns the value corresponding to a string, or

getOverallQuality(self)

Returns the overall quality score of the feature

getPeptideIdentifications(self)

Returns the peptide identifications associated with this feature

getPrecursorFeature(self, key)

Retrieves a precursor feature by its native ID

getPrecursorFeatureIDs(self, result)

Retrieves the native IDs of all precursor features

getQuality(self, index)

Returns the quality score in a specific dimension

getRT(self)

Returns the RT coordinate (index 0)

getScores(self)

Returns the peak group quality scores

getSubordinates(self)

Returns subordinate features (e.g., isotopic peaks)

getUniqueId(self)

Returns the unique id

getWidth(self)

Returns the width (FWHM) of the feature in RT dimension

hasInvalidUniqueId(self)

Returns whether the unique id is invalid.

hasValidUniqueId(self)

Returns whether the unique id is valid.

isMetaEmpty(self)

Returns if the MetaInfo is empty

isValid(self, unique_id)

Returns true if the unique_id is valid, false otherwise

metaRegistry(self)

Returns a reference to the MetaInfoRegistry

metaValueExists(self, in_0)

Returns whether an entry with the given name exists

removeMetaValue(self, in_0)

Removes the DataValue corresponding to name if it exists

setCharge(self, q)

Sets the charge state of the feature

setConvexHulls(self, in_0)

Sets the convex hulls for individual mass traces

setIntensity(self, in_0)

Returns the data point intensity (height)

setMZ(self, in_0)

Returns the m/z coordinate (index 1)

setMetaValue(self, in_0, in_1)

Sets the DataValue corresponding to a name

setOverallQuality(self, q)

Sets the overall quality score of the feature

setPeptideIdentifications(self, peptides)

Sets the peptide identifications for this feature

setQuality(self, index, q)

Sets the quality score for a specific dimension

setRT(self, in_0)

Returns the RT coordinate (index 0)

setScores(self, s)

Sets the peak group quality scores

setSubordinates(self, in_0)

Sets the subordinate features

setUniqueId(self, rhs)

Assigns a new, valid unique id.

setWidth(self, q)

Sets the width (FWHM) of the feature in RT dimension

addFeature(self, f: Feature, key: bytes | str | String) None#

Adds a transition feature to this MRM feature

Parameters:
  • f – A Feature object representing the signal from a single transition chromatogram

  • key – The native ID for this transition (should match the transition ID from your method)

Each transition in an MRM experiment produces one chromatogram, which is represented as a Feature

addPrecursorFeature(self, f: Feature, key: bytes | str | String) None#

Adds a precursor feature to this MRM feature

Parameters:
  • f – A Feature object representing the MS1 precursor signal

  • key – The native ID for this precursor

Precursor features are optional and represent MS1-level information

clearMetaInfo(self) None#

Removes all meta values

clearUniqueId(self) int#

Clear the unique id. The new unique id will be invalid. Returns 1 if the unique id was changed, 0 otherwise

encloses(self, rt: float, mz: float) bool#

Checks if the feature’s convex hulls enclose a given position

Parameters:
  • rt – Retention time in seconds

  • mz – Mass-to-charge ratio

Returns:

True if the position (rt, mz) is within the feature’s convex hulls, False otherwise

This uses the feature’s convex hull representation to determine spatial containment

ensureUniqueId(self) int#

Assigns a valid unique id, but only if the present one is invalid. Returns 1 if the unique id was changed, 0 otherwise

getAnnotationState(self) int#

Returns the annotation state of the feature

Returns:

Enum indicating the annotation status of this feature

getCharge(self) int#

Returns the charge state of the feature

Returns:

Charge state (e.g., 2 for doubly charged ions, 0 if unknown)

getConvexHull(self) ConvexHull2D#

Returns the overall convex hull of the feature

Returns:

The overall 2D convex hull encompassing all mass traces

This is the union of all individual mass trace convex hulls

getConvexHulls(self) List[ConvexHull2D]#

Returns the convex hulls of individual mass traces

Returns:

List of convex hulls, one for each isotopic mass trace

Each isotopic peak typically has its own convex hull in RT-m/z space

getFeature(self, key: bytes | str | String) Feature#

Retrieves a transition feature by its native ID

Parameters:

key – The native ID of the transition (e.g., “transition_1” or a TRAML identifier)

Returns:

The Feature object corresponding to this transition

Raises an exception if the key is not found

getFeatureIDs(self, result: List[bytes]) None#

Retrieves the native IDs of all transition features

Parameters:

result – Output parameter that will be filled with the native IDs of all transitions

This is an output parameter. Pass an empty list and it will be populated with IDs

getFeatures(self) List[Feature]#

Returns all transition features in this MRM feature

Returns:

A list of all transition features that have been added to this peak group

getIntensity(self) float#

Returns the data point intensity (height)

getKeys(self, keys: List[bytes]) None#

Fills the given vector with a list of all keys for which a value is set

getMZ(self) float#

Returns the m/z coordinate (index 1)

getMetaValue(self, in_0: bytes | str | String) int | float | bytes | str | List[int] | List[float] | List[bytes]#

Returns the value corresponding to a string, or

getOverallQuality(self) float#

Returns the overall quality score of the feature

Returns:

Overall quality score (typically 0-1, where 1 is highest quality)

This score represents the overall confidence in the feature detection

getPeptideIdentifications(self) PeptideIdentificationList#

Returns the peptide identifications associated with this feature

Returns:

List of peptide identifications from database search

Only relevant for peptide features. Contains results from peptide identification tools

getPrecursorFeature(self, key: bytes | str | String) Feature#

Retrieves a precursor feature by its native ID

Parameters:

key – The native ID of the precursor

Returns:

The Feature object for the precursor (MS1 signal)

Precursor features represent the MS1 signal for the peptide, if available

getPrecursorFeatureIDs(self, result: List[bytes]) None#

Retrieves the native IDs of all precursor features

Parameters:

result – Output parameter that will be filled with precursor IDs

This is an output parameter. Pass an empty list and it will be populated with IDs

getQuality(self, index: int) float#

Returns the quality score in a specific dimension

Parameters:

index – The dimension index (0 for RT, 1 for m/z)

Returns:

Quality score for the specified dimension (typically 0-1 range)

getRT(self) float#

Returns the RT coordinate (index 0)

getScores(self) OpenSwath_Scores#

Returns the peak group quality scores

Returns:

An object containing various quality metrics for the peak group, such as library correlation, signal-to-noise ratio, and other OpenSWATH scoring metrics

getSubordinates(self) List[Feature]#

Returns subordinate features (e.g., isotopic peaks)

Returns:

List of subordinate features associated with this feature

Subordinate features often represent individual isotopic peaks of the same compound

getUniqueId(self) int#

Returns the unique id

getWidth(self) float#

Returns the width (FWHM) of the feature in RT dimension

Returns:

Full Width at Half Maximum (FWHM) in seconds

Represents the elution peak width

hasInvalidUniqueId(self) int#

Returns whether the unique id is invalid. Returns 1 if the unique id is invalid, 0 otherwise

hasValidUniqueId(self) int#

Returns whether the unique id is valid. Returns 1 if the unique id is valid, 0 otherwise

isMetaEmpty(self) bool#

Returns if the MetaInfo is empty

isValid(self, unique_id: int) bool#

Returns true if the unique_id is valid, false otherwise

metaRegistry(self) MetaInfoRegistry#

Returns a reference to the MetaInfoRegistry

metaValueExists(self, in_0: bytes | str | String) bool#

Returns whether an entry with the given name exists

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

Removes the DataValue corresponding to name if it exists

setCharge(self, q: int) None#

Sets the charge state of the feature

Parameters:

q – Charge state (e.g., 2 for doubly charged ions)

setConvexHulls(self, in_0: List[ConvexHull2D]) None#

Sets the convex hulls for individual mass traces

Parameters:

hulls – List of convex hulls to set for this feature

setIntensity(self, in_0: float) None#

Returns the data point intensity (height)

setMZ(self, in_0: float) None#

Returns the m/z coordinate (index 1)

setMetaValue(self, in_0: bytes | str | String, in_1: int | float | bytes | str | List[int] | List[float] | List[bytes]) None#

Sets the DataValue corresponding to a name

setOverallQuality(self, q: float) None#

Sets the overall quality score of the feature

Parameters:

q – Overall quality score (typically 0-1, where 1 is highest quality)

setPeptideIdentifications(self, peptides: PeptideIdentificationList) None#

Sets the peptide identifications for this feature

Parameters:

peptides – List of peptide identifications to associate with this feature

setQuality(self, index: int, q: float) None#

Sets the quality score for a specific dimension

Parameters:
  • index – The dimension index (0 for RT, 1 for m/z)

  • q – Quality score to set (typically 0-1 range)

setRT(self, in_0: float) None#

Returns the RT coordinate (index 0)

setScores(self, s: OpenSwath_Scores) None#

Sets the peak group quality scores

Parameters:

s – An OpenSwath_Scores object containing quality metrics for this peak group

setSubordinates(self, in_0: List[Feature]) None#

Sets the subordinate features

Parameters:

subordinates – List of subordinate features to associate with this feature

setUniqueId(self, rhs: int) None#

Assigns a new, valid unique id. Always returns 1

setWidth(self, q: float) None#

Sets the width (FWHM) of the feature in RT dimension

Parameters:

q – Full Width at Half Maximum in seconds