Repository navigation
feat: IM and FAIMS support in most feature finder - #7453
Conversation
|
Hi @jcharkow, @cbielow and @singjc, In ProteomicsLFQ (DDA), our input might include ID data with annotated ion mobility (IM) at the precursor level (e.g. from Sage or Comet). |
|
@copilot add the same optional FAIMS feature merging logic to Biosaur2Algorithm |
|
@timosachsenberg I've opened a new pull request, #8406, to work on those changes. Once the pull request is ready, I'll request review from you. |
* Initial plan * Add optional FAIMS feature merging to Biosaur2Algorithm/FeatureFinderLFQ Co-authored-by: timosachsenberg <[email protected]> * Move FAIMS feature merging to Biosaur2Algorithm Co-authored-by: timosachsenberg <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: timosachsenberg <[email protected]>
|
@copilot add to the changelog that there is a new experimental FeatureFinderLFQ tool that internally uses a slightly modified Biosaur2 algorithm to detect features in bottom-up DDA-LFQ. It supports FAIMS and timstof ion mobility. |
|
@timosachsenberg I've opened a new pull request, #8408, to work on those changes. Once the pull request is ready, I'll request review from you. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/openms/source/FEATUREFINDER/Biosaur2Algorithm.cpp (2)
227-296: FAIMS group processing and merge step are logically sound; consider minor robustness tweaksThe new FAIMS path in
runlooks correct overall:
IMDataConverter::splitByFAIMSCV(std::move(ms_data_))plus thehas_faimscheck (n_groups > 1 || !std::isnan(groups[0].first)) follows the documented pattern, so non‑FAIMS and tims/PASEF data will bypass FAIMS merging.- Per‑group processing is safely parallelized: each OpenMP iteration only touches its own
groups[i],hills_per_group[i],features_per_group[i], andfmap_per_group[i], and no shared container is resized in the loop.- The combined feature map is only passed to
FeatureOverlapFilter::mergeFAIMSFeatureswhen both FAIMS is present andfaims_merge_features_is enabled, and the INFO log is sensibly emitted only when the feature count actually shrinks.Two small points you may want to address:
ms_data_is now moved intosplitByFAIMSCV. This is fine for the common “setMSData once, run once” pattern, but it does change semantics for callers that might reuse a singleBiosaur2Algorithminstance across multipleruncalls without re‑invokingsetMSData. If such reuse exists, consider either documenting the one‑shot nature ofrunor operating on a local copy instead ofstd::move(ms_data_).- The merge tolerances
(5.0, 0.05)are currently hard-coded. Exposing them as advanced parameters (or at least defining named constants) would give power users control and make the intent of the chosen defaults clearer.
3057-3068: Prefer using the FAIMS_CV user param constant instead of a raw stringHere you annotate FAIMS CV via:
if (f.drift_time != IMTypes::DRIFTTIME_NOT_SET) { feature.setMetaValue("FAIMS_CV", f.drift_time); }Given that
Constants::UserParam::FAIMS_CVexists, it would be more robust and self‑documenting to reuse that constant instead of the literal"FAIMS_CV", mirroring howConstants::UserParam::IMis used for ion mobility meta values.- if (f.drift_time != IMTypes::DRIFTTIME_NOT_SET) - { - feature.setMetaValue("FAIMS_CV", f.drift_time); - } + if (f.drift_time != IMTypes::DRIFTTIME_NOT_SET) + { + feature.setMetaValue(Constants::UserParam::FAIMS_CV, f.drift_time); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
CHANGELOG(3 hunks)src/openms/include/OpenMS/CONCEPT/Constants.h(1 hunks)src/openms/include/OpenMS/FEATUREFINDER/Biosaur2Algorithm.h(1 hunks)src/openms/source/FEATUREFINDER/Biosaur2Algorithm.cpp(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/openms/include/OpenMS/CONCEPT/Constants.h
🧰 Additional context used
📓 Path-based instructions (2)
src/openms/**/*.{cpp,h,hpp,cc,cxx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms
Files:
src/openms/include/OpenMS/FEATUREFINDER/Biosaur2Algorithm.hsrc/openms/source/FEATUREFINDER/Biosaur2Algorithm.cpp
src/openms/include/OpenMS/**/*.h
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Add Doxygen comments for new public methods and classes
Files:
src/openms/include/OpenMS/FEATUREFINDER/Biosaur2Algorithm.h
🧠 Learnings (7)
📓 Common learnings
Learnt from: jcharkow
Repo: OpenMS/OpenMS PR: 8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Applied to files:
CHANGELOGsrc/openms/source/FEATUREFINDER/Biosaur2Algorithm.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Be aware of OpenMS dependencies and external libraries
Applied to files:
CHANGELOG
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes
Applied to files:
CHANGELOG
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms
Applied to files:
src/openms/source/FEATUREFINDER/Biosaur2Algorithm.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets
Applied to files:
src/openms/source/FEATUREFINDER/Biosaur2Algorithm.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations
Applied to files:
src/openms/source/FEATUREFINDER/Biosaur2Algorithm.cpp
🔇 Additional comments (7)
src/openms/include/OpenMS/FEATUREFINDER/Biosaur2Algorithm.h (1)
688-715: FAIMS merge flag wiring in header looks consistent
faims_merge_features_is added alongside other cached parameters in the private member block with a clear comment; no API surface change beyond internal state, which is appropriate.src/openms/source/FEATUREFINDER/Biosaur2Algorithm.cpp (3)
19-20: New FeatureOverlapFilter dependency is appropriateIncluding
FeatureOverlapFilter.hhere is justified by the latermergeFAIMSFeaturescall and keeps the dependency local to the implementation.
107-112: Parameter definition forfaims_merge_featuresis consistent with existing flagsThe new
faims_merge_featuresparameter is registered with sensible defaults, clear documentation, and propersetValidStrings({"true","false"}), matching the pattern of other boolean config flags.
117-165: Member caching and debug logging forfaims_merge_featuresare correct
updateMembers_correctly cachesparam_["faims_merge_features"]intofaims_merge_features_, and extending the debug line ensures the new parameter is traceable without altering behavior.CHANGELOG (3)
43-50: FAIMS/IM changelog entries are clear and aligned with the implementationThe new bullets for
FeatureFinderCentroided/Metabo/MultiplexandFeatureFinderMetaboIdent/FeatureFinderIdentificationaccurately summarize automatic FAIMS CV grouping, per‑CV processing, and default cross‑CV merging behavior, and correctly flag both FAIMS and Bruker timsTOF ion mobility support as experimental.
62-62: FeatureFinderLFQ tool entry matches the new Biosaur2-based workflowThe
FeatureFinderLFQ (experimental)changelog line concisely describes the new DDA‑LFQ feature finder as Biosaur2‑based with FAIMS and timsTOF IM support, which matches the surrounding code changes in this PR.
72-72: Library entry for FeatureFinderAlgorithmBiosaur2 is appropriateThe
FeatureFinderAlgorithmBiosaur2 (experimental)addition under “OpenMS Library: Added” correctly documents the new algorithm and its FAIMS/tims ion mobility capabilities, giving users a clear pointer to the reusable library component behind FeatureFinderLFQ.
… TSV columns (#9409) The FeatureFinderMetaboIdent TSV format supports two optional columns after IsoDistribution: - IonMobility (added in #7453 for IM/FAIMS support) - Adduct (added in #9382 for explicit adduct specification) The pyOpenMS tutorial at doc/pyopenms/docs/source/user_guide/feature_detection.rst was showing only the 7 required columns and the Python parsing example did not read or pass the optional columns to FeatureFinderMetaboIdentCompound. Changes: - Add a prose note listing the two optional columns with their semantics - Update the metaboTableFromFile() example to detect IonMobility and Adduct columns from the header row and pass them (or empty defaults) to the FeatureFinderMetaboIdentCompound constructor, which already accepts both as optional keyword arguments. Co-authored-by: GitHub Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Timo Sachsenberg <[email protected]>
PR Summary: FAIMS and Ion Mobility Support for FeatureFinder Tools
Overview
This PR adds comprehensive FAIMS (Field Asymmetric Ion Mobility Spectrometry) support to
multiple FeatureFinder tools and enhances ion mobility handling throughout the OpenMS
codebase. The changes enable proper processing of FAIMS data by splitting experiments by
compensation voltage (CV) and processing each group separately.
Key Changes
All major FeatureFinder tools now support FAIMS data:
features with FAIMS_CV meta value
value paired with each experiment
IMDataConverter::splitByFAIMSCV(std::move(exp))
New optional TSV input columns for targeted metabolite detection:
Files Changed (29 files, +1529/-1902 lines)
Core Library:
TOPP Tools:
Testing
Usage Pattern
// Split by FAIMS CV (returns single NaN-keyed element for non-FAIMS data)
auto faims_groups = IMDataConverter::splitByFAIMSCV(std::move(exp));
const bool has_faims = faims_groups.size() > 1 || !std::isnan(faims_groups[0].first);
for (auto& [group_cv, faims_group] : faims_groups)
{
// Process each group
// Annotate features with FAIMS_CV if has_faims
}
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.