AbsoluteQuantitation#

class pyopenms.AbsoluteQuantitation#

Bases: DefaultParamHandler

Absolute quantitation using calibration curves and internal standards

This class supports absolute or relative quantitation for targeted workflows using Isotope Dilution Mass Spectrometry (IDMS). A transformation model is fitted using standards with known concentrations, then applied to quantify unknown samples.

Workflow: 1. Set quantitation methods with setQuantMethods() 2. Fit calibration curves with optimizeCalibrationCurves() or fitCalibration() 3. Quantify unknowns with quantifyComponents()

Example usage:

from pyopenms import *

# Set up quantitation method
method = AbsoluteQuantitationMethod()
method.setComponentName("glucose")
method.setFeatureName("peak_apex_int")
method.setISName("glucose_13C6")
method.setTransformationModel("linear")
method.setLLOQ(1.0)
method.setULOQ(500.0)

aq = AbsoluteQuantitation()
aq.setQuantMethods([method])

# Quantify unknowns
unknowns = FeatureMap()
FeatureXMLFile().load("unknowns.featureXML", unknowns)
aq.quantifyComponents(unknowns)

# Results stored as metavalues
for f in unknowns:
    if f.metaValueExists("calculated_concentration"):
        print(f.getMetaValue("PeptideRef"), f.getMetaValue("calculated_concentration"))
__init__() → None#
__init__(arg: pyopenms.AbsoluteQuantitation, /) → None

Methods

__init__()

applyCalibration(component, IS_component, ...)

Apply calibration to calculate concentration

calculateBias(actual_concentration, ...)

Calculate the bias between actual and calculated concentration

calculateBiasAndR(component_concentrations, ...)

Calculate bias values and R for calibration

calculateRatio(component_1, component_2, ...)

Calculate the ratio between two features (e.g., analyte/IS)

fitCalibration(component_concentrations, ...)

Fit a calibration curve

getDefaults()

Returns the default parameters

getName()

Returns the name

getParameters()

Returns the parameters

getQuantMethods()

Get the quantitation methods

getSubsections()

optimizeCalibrationCurveIterative(...)

Iteratively optimize calibration curve with outlier removal

optimizeSingleCalibrationCurve(...)

Optimize calibration curve for a single component

quantifyComponents(unknowns)

Quantify all components in a FeatureMap

setName(name)

Sets the name

setParameters(param)

Sets the parameters

setQuantMethods(quant_methods)

Set the quantitation methods

applyCalibration(component: pyopenms.Feature, IS_component: pyopenms.Feature, feature_name: str, transformation_model: str, transformation_model_params: pyopenms.Param) → float#

Apply calibration to calculate concentration

Parameters:
  • component – Analyte feature

  • IS_component – Internal standard feature

  • feature_name – Feature to use

  • transformation_model – Model type

  • transformation_model_params – Fitted model parameters

Returns:

Calculated concentration

calculateBias(actual_concentration: float, calculated_concentration: float) → float#

Calculate the bias between actual and calculated concentration

Bias = (calculated - actual) / actual * 100%

Parameters:
  • actual_concentration – Known concentration

  • calculated_concentration – Calculated concentration from calibration

Returns:

Bias as a percentage

calculateBiasAndR(component_concentrations: collections.abc.Sequence[pyopenms.AQS_featureConcentration], feature_name: str, transformation_model: str, transformation_model_params: pyopenms.Param) → tuple#

Calculate bias values and R for calibration

calculateRatio(component_1: pyopenms.Feature, component_2: pyopenms.Feature, feature_name: str) → float#

Calculate the ratio between two features (e.g., analyte/IS)

Parameters:
  • component_1 – First feature (numerator)

  • component_2 – Second feature (denominator, e.g., internal standard)

  • feature_name – Name of the feature to use (e.g., “peak_apex_int”)

Returns:

The ratio component_1 / component_2

fitCalibration(component_concentrations: collections.abc.Sequence[pyopenms.AQS_featureConcentration], feature_name: str, transformation_model: str, transformation_model_params: pyopenms.Param) → pyopenms.Param#

Fit a calibration curve

getDefaults() → pyopenms.Param#

Returns the default parameters

getName() → str#

Returns the name

getParameters() → pyopenms.Param#

Returns the parameters

getQuantMethods() → list[pyopenms.AbsoluteQuantitationMethod]#

Get the quantitation methods

getSubsections() → list[str]#
optimizeCalibrationCurveIterative(component_concentrations: collections.abc.Sequence[pyopenms.AQS_featureConcentration], feature_name: str, transformation_model: str, transformation_model_params: pyopenms.Param, optimized_params: pyopenms.Param) → tuple#

Iteratively optimize calibration curve with outlier removal

Uses jackknife or residual-based outlier detection to iteratively remove points that degrade the calibration fit.

Parameters:
  • component_concentrations – Standards (outliers will be removed)

  • feature_name – Feature to use

  • transformation_model – Model type

  • transformation_model_params – Initial model parameters

  • optimized_params – Output optimized parameters (modified in-place)

Returns:

Tuple of (success_bool, updated_component_concentrations)

In/out compatibility (pyOpenMS 3.5 behaviour): a Python list passed as component_concentrations is also updated in place with the returned contents.

optimizeSingleCalibrationCurve(component_name: str, component_concentrations: collections.abc.Sequence[pyopenms.AQS_featureConcentration]) → list[pyopenms.AQS_featureConcentration]#

Optimize calibration curve for a single component

Note: optimizeCalibrationCurves taking map<std::string, vector<featureConcentration>> is not wrapped due to complex nested container type. Use optimizeSingleCalibrationCurve instead.

Parameters:
  • component_name – Name of the component

  • component_concentrations – Standards for this component (outliers will be removed)

Returns:

Updated component_concentrations after optimization

In/out compatibility (pyOpenMS 3.5 behaviour): a Python list passed as component_concentrations is also updated in place with the returned contents.

quantifyComponents(unknowns: pyopenms.FeatureMap) → None#

Quantify all components in a FeatureMap

Applies the calibration curves to calculate concentrations for all features. Results are stored as metavalues:

  • “calculated_concentration”: The calculated concentration

  • “concentration_units”: Units from the quantitation method

Parameters:

unknowns – FeatureMap to quantify (modified in place)

setName(name: str) → None#

Sets the name

setParameters(param: pyopenms.Param) → None#

Sets the parameters

setQuantMethods(quant_methods: collections.abc.Sequence[pyopenms.AbsoluteQuantitationMethod]) → None#

Set the quantitation methods