Repository navigation
[FEATURE] MassTraceDetection: minimum number of peaks of a mass trace (min_trace_scans) - #10954
Conversation
… (min_trace_scans) 'min_trace_length' counts seconds, so what it admits depends on the MS1 cycle time: at a cycle of more than a second a trace of two or three peaks can be longer than the limit. The new advanced parameter 'min_trace_scans' (default 4, 1 disables it) counts the peaks of a trace and applies in addition to 'min_trace_length'. FeatureFinderMetabo and MassTraceExtractor take the new default. Their test references change: the outputs are identical to the previous references with '-algorithm:mtd:min_trace_scans 1'. Unchanged, by setting the parameter to 1: PeakPickerIM (traces along ion mobility), FLASHDeconv / MassFeatureTrace (top-down) and the chromatographic peak width estimate of ProteomicsLFQ (DDAWorkflowCommons). See #10900. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmZHbFSUJZfvswYQoDp
Walkthrough
Change: Feature Pre-merge checks:
|
Conflict with #10893 in MassTraceDetection::isTraceValid_(), which now gets the RT range and the peak count instead of the trace. The new min_trace_scans check uses peak_count instead of trace.size(). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmagZ9HY1kvqXDEweT1
Brings in #10954 (min_trace_scans), so that CI tests the smoothing change together with it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmagZ9HY1kvqXDEweT1
Description
Adds an advanced parameter
min_trace_scans(default 4) toMassTraceDetection: the minimum number of peaks of a mass trace. It applies in addition tomin_trace_length;1disables it. Part of #10900.Why.
min_trace_lengthcounts seconds, so what it lets through depends on the MS1 cycle time. At a cycle of more than a second, a trace of two or three peaks is longer than the limit, and loweringmin_trace_lengthfor narrow UHPLC peaks (the request in #10900) would admit more of them. A limit in peaks does not depend on the cycle time. With it in place,min_trace_lengthcan be chosen for the chromatography alone.Design.
trace.size()), not the scans it spans. Withmin_sample_rate0.5 a trace that spans 4 scans can have 2 peaks.isTraceValid_(), next to the length in seconds.min_trace_length(5 s) is not changed here.Who gets the new default.
FeatureFinderMetaboandMassTraceExtractor(asalgorithm:mtd:min_trace_scans), and direct users ofMassTraceDetection(C++ / pyOpenMS).Who keeps the previous behavior (parameter set to 1):
PeakPickerIM: its traces run along ion mobility, and it already disables the length limits.MassFeatureTrace/FLASHDeconv(top-down):ft:min_trace_scansexists with default 1.DDAWorkflowCommons::estimateMedianChromatographicFWHM(ProteomicsLFQ): with the limit, the 1000 most intense traces are a different set, the median FWHM changes and so do theProteomicsLFQ_3results. I kept this out of the PR; whether the estimate should use the limit is a separate question.Why 4. Measured with pyOpenMS 3.6.0 (the limit emulated by dropping traces after detection),
FeatureFinderMetabodefaults,min_trace_length2 s:msdata, 2 injections (0.28 s)streamlit-templateexample data, 4 runs (0.63 s)pyopenms-docsMetabolomics_1,_2(1.21 s)FeatureFinderMetabo_1_input(1.77 s)Metabolomics_1: 8,659 → 8,417 features) and nothing at 0.19–0.28 s.Test references. Nine reference files of
FeatureFinderMetabo(1, 2, 5, 6) andMassTraceExtractor(1, 2, 4, 5, 6) change, because their inputs scan slowly (1.1–1.8 s) and lose the traces of fewer than 4 peaks. For each of them I checked that the tool run with-algorithm:mtd:min_trace_scans 1still gives the previous reference (FuzzyDiff passes), so the limit is the only cause. Besides the removed features, the files differ in trace labels (renumbered) andoverallquality(normalized over all features).MassTraceExtractor_1shows the largest effect: 454 → 204 traces, as this tool reports traces without elution peak detection.MassTraceExtractor_3_expected.inigains the parameter.Checklist
Local build: Linux, GCC 13, Release, system dependencies, without Thermo/OpenTIMS/ONNX support and pyOpenMS. All TOPP tests ran and pass. Of the class tests I built and ran those of the changed code:
MassTraceDetection_test(with a new section for the parameter),MassTrace_test,ElutionPeakDetection_test,FeatureFindingMetabo_test,PeakPickerIM_test,MassFeatureTrace_test, theFLASH*tests,DDAWorkflowCommons_test,MetaboliteFeatureDeconvolution_testandMetaboliteSpectralMatching_test. The other class tests and the pyOpenMS tests were not built.AI use (see the OpenMS AI Policy)
Co-authored-by:trailer, and the description above explains the design intent and rationaleGenerated by Claude Code
Summary by CodeRabbit