Introduction
This tutorial explains how to use the OpenMS Targeted Quantitation module for processing MRM/SRM and SWATH/DIA mass spectrometry data. These algorithms provide a complete workflow from raw chromatograms to absolutely quantified concentrations, and form the computational foundation for tools like SmartPeaks.
Workflow Overview
The targeted quantitation workflow consists of four main stages:
Stage 1: Peak Picking and Integration
Peak Picking with MRMTransitionGroupPicker
The MRMTransitionGroupPicker identifies peaks across multiple chromatograms belonging to the same precursor. It uses a consensus approach to find consistent peak boundaries.
MRMTransitionGroupPicker picker;
Param params = picker.getDefaults();
params.setValue("PeakPickerChromatogram:method", "corrected");
params.setValue("background_subtraction", "exact");
params.setValue("recalculate_peaks", "true");
picker.setParameters(params);
MRMTransitionGroup<MSChromatogram, ReactionMonitoringTransition> transition_group;
picker.pickTransitionGroup(transition_group);
for (const auto& feature : transition_group.getFeatures())
{
std::cout << "Peak at RT: " << feature.getRT()
<< " Intensity: " << feature.getIntensity() << std::endl;
}
Peak Integration with PeakIntegrator
The PeakIntegrator computes peak areas using various methods:
PeakIntegrator pi;
Param params = pi.getDefaults();
params.setValue("integration_type", "trapezoid");
params.setValue("baseline_type", "base_to_base");
pi.setParameters(params);
MSChromatogram chrom;
double left_boundary = 100.0;
double right_boundary = 120.0;
PeakIntegrator::PeakArea pa = pi.integratePeak(chrom, left_boundary, right_boundary);
std::cout << "Peak area: " << pa.area << std::endl;
std::cout << "Peak height: " << pa.height << std::endl;
std::cout << "Apex position: " << pa.apex_pos << std::endl;
PeakIntegrator::PeakShapeMetrics psm = pi.calculatePeakShapeMetrics(
chrom, left_boundary, right_boundary, pa.height, pa.apex_pos);
std::cout << "FWHM: " << psm.width_at_50 << std::endl;
std::cout << "Tailing factor: " << psm.tailing_factor << std::endl;
EMG Peak Fitting for Saturated/Cutoff Peaks
The EmgGradientDescent class fits peaks to an Exponentially Modified Gaussian model, useful for reconstructing saturated or cutoff peaks:
EmgGradientDescent emg;
MSChromatogram input_peak, fitted_peak;
emg.fitEMGPeakModel(input_peak, fitted_peak);
const auto& emg_params = fitted_peak.getFloatDataArrays()[0];
double h = emg_params[0];
double mu = emg_params[1];
double sigma = emg_params[2];
double tau = emg_params[3];
Stage 2: Quality Control
Setting Up QC Criteria
The MRMFeatureQC class defines quality control criteria:
MRMFeatureQC qc;
MRMFeatureQC::ComponentQCs comp_qc;
comp_qc.component_name = "glucose_quantifier";
comp_qc.retention_time_l = 5.0;
comp_qc.retention_time_u = 7.0;
comp_qc.intensity_l = 1000.0;
comp_qc.intensity_u = 1e9;
comp_qc.overall_quality_l = 0.5;
qc.component_qcs.push_back(comp_qc);
MRMFeatureQC::ComponentGroupQCs group_qc;
group_qc.component_group_name = "glucose";
group_qc.n_heavy_l = 1;
group_qc.n_light_l = 1;
group_qc.ion_ratio_pair_name_1 = "glucose_qualifier";
group_qc.ion_ratio_pair_name_2 = "glucose_quantifier";
group_qc.ion_ratio_l = 0.3;
group_qc.ion_ratio_u = 0.5;
qc.component_group_qcs.push_back(group_qc);
Applying QC Filters
The MRMFeatureFilter applies QC criteria to features:
MRMFeatureFilter filter;
Param params = filter.getDefaults();
params.setValue("flag_or_filter", "filter");
filter.setParameters(params);
FeatureMap features;
filter.FilterFeatureMap(features, qc, targeted_exp);
std::vector<FeatureMap> qc_samples;
filter.FilterFeatureMapPercRSD(features, qc_samples, params);
FeatureMap blank_sample;
filter.FilterFeatureMapBackgroundInterference(features, blank_sample, params);
Stage 3: Feature Selection with Linear Programming
The MRMFeatureSelector uses linear programming to optimally select features while maintaining retention time consistency:
MRMFeatureSelector::SelectorParameters params;
params.nn_threshold = 4;
params.segment_window_length = 8;
params.segment_step_length = 4;
params.variable_type = MRMFeatureSelector::VariableType::INTEGER;
params.optimal_threshold = 0.5;
params.score_weights = {
{"peak_apex_int", MRMFeatureSelector::LambdaScore::LINEAR},
{"sn_ratio", MRMFeatureSelector::LambdaScore::LOG}
};
FeatureMap features, selected_features;
MRMFeatureSelectorScore selector;
selector.selectMRMFeature(features, selected_features, params);
For iterative refinement, use MRMBatchFeatureSelector:
std::vector<MRMFeatureSelector::SelectorParameters> params_list;
FeatureMap features, selected;
MRMBatchFeatureSelector::batchMRMFeaturesScore(features, selected, params_list);
Stage 4: Absolute Quantitation
Setting Up Calibration
The AbsoluteQuantitationMethod defines how each component should be quantified:
AbsoluteQuantitationMethod method;
method.setComponentName("glucose");
method.setFeatureName("peak_apex_int");
method.setISName("glucose_13C6");
method.setConcentrationUnits("uM");
method.setTransformationModel("linear");
method.setLLOD(0.1);
method.setULOD(1000);
method.setLLOQ(1.0);
method.setULOQ(500);
Performing Quantitation
AbsoluteQuantitation aq;
std::vector<AbsoluteQuantitationMethod> methods;
aq.setQuantMethods(methods);
std::map<String, std::vector<AbsoluteQuantitationStandards::featureConcentration>> components_to_concentrations;
Param params = aq.getDefaults();
params.setValue("outlier_detection_method", "iter_jackknife");
params.setValue("use_chauvenet", "true");
params.setValue("optimization_method", "iterative");
aq.setParameters(params);
aq.optimizeCalibrationCurves(components_to_concentrations);
std::vector<AbsoluteQuantitationMethod> fitted_methods = aq.getQuantMethods();
for (const auto& m : fitted_methods)
{
std::cout << m.getComponentName() << " R=" << m.getCorrelationCoefficient() << std::endl;
}
FeatureMap unknowns;
aq.quantifyComponents(unknowns);
for (const auto& f : unknowns)
{
if (f.metaValueExists("calculated_concentration"))
{
std::cout << f.getMetaValue("PeptideRef") << ": "
<< f.getMetaValue("calculated_concentration")
<< f.getMetaValue("concentration_units") << std::endl;
}
}
TOPP Tools
The following TOPP tools utilize these algorithms:
References
- McCloskey D, et al. "SmartPeaks: An Open Source Tool for Automated Processing of
LC-MS Metabolomics and Fluxomics Data" (2020)
- Kalambet Y, et al. "Reconstruction of chromatographic peaks using the exponentially
modified Gaussian function" Journal of Chemometrics (2011) 25:352-356
- See also
- Targeted Quantitation (MRM/SRM) for module overview