Repository navigation
feat(MSstatsConverter): add flag to control shared peptide filtering - #9068
timosachsenberg merged 3 commits into
Conversation
…hared peptide filtering The MSstatsConverter silently drops peptides mapping to proteins in different indistinguishable protein groups via isQuantifyable_(). This is hardcoded with no user control, causing proteins with only shared peptides to vanish from MSstats output even when the upstream ProteinQuantifier was configured with use_shared_peptides=true. This commit adds a -remove_shared_peptides flag (default true for backward compatibility) that allows users to retain shared peptides in the MSstats output. It also adds OPENMS_LOG_WARN messages reporting how many peptide hits were dropped, so the filtering is no longer silent. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo MSstatsFile methods gained a trailing Changes
Sequence Diagram(s)sequenceDiagram
rect rgba(180, 220, 255, 0.5)
participant User as CLI/User
end
rect rgba(200, 255, 200, 0.5)
participant Tool as MSstatsConverter
end
rect rgba(255, 230, 180, 0.5)
participant Module as MSstatsFile
end
rect rgba(255, 200, 200, 0.5)
participant Log as Logger
end
User->>Tool: invoke with --remove_shared_peptides=(true|false)
Tool->>Module: call storeLFQ/storeISO(..., remove_shared_peptides)
Module->>Module: evaluate peptides (if remove_shared_peptides && !isQuantifyable_ => drop)
Module-->>Log: if drops > 0 -> emit warning with count
Module-->>Tool: return generated MSstats data
Tool-->>User: write output / exit
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/topp/MSstatsConverter.cpp (1)
100-105: Please add a regression test for both switch states.
src/tests/class_tests/openms/source/MSstatsFile_test.cpp:16-35only says these methods are "tested via MSstatsConverter tool", so the default path, the explicit keep-shared-peptides path, and the new warning text are currently unguarded.Also applies to: 160-170
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/topp/MSstatsConverter.cpp` around lines 100 - 105, Add regression tests that exercise MSstatsConverter with both settings of the flag param_remove_shared_peptides (default/remove and explicit keep) and assert the produced output differs as expected and that the new warning text is emitted; update or extend src/tests/class_tests/openms/source/MSstatsFile_test.cpp to invoke MSstatsConverter (or call the underlying conversion routines used by MSstatsConverter) twice—once using the default behavior and once with the keep-shared-peptides flag set—and validate (1) that shared peptides are removed in the default run, (2) that shared peptides remain when the flag is unset, and (3) that the warning message string introduced for this behavior appears in the logs for the relevant run.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/openms/include/OpenMS/FORMAT/MSstatsFile.h`:
- Around line 40-49: The header added a new optional parameter
remove_shared_peptides to MSstatsFile::storeLFQ and MSstatsFile::storeISO, so
update the PyOpenMS nanobind lambdas that expose these methods (the lambdas
around the storeLFQ/storeISO bindings in bind_format.cpp) to accept and forward
the new bool remove_shared_peptides parameter, and update the test signatures in
MSstatsFile_test.cpp (the documented section signatures previously listing 8
params at the two locations) to include the new parameter; run the
bindings/tests to ensure compilation and tag the commit with "API" for the C++
API change.
In `@src/topp/MSstatsConverter.cpp`:
- Around line 100-105: The flag param_remove_shared_peptides is currently
registered with registerFlag_ (which defaults to false) but
MSstatsFile::storeLFQ()/storeISO() expect a default of true; replace the
registerFlag_ call with registerStringOption_ using default value "true" and
allowed values ["true","false"], then read the value with getStringOption_
(convert to bool) wherever param_remove_shared_peptides is used; remove or stop
using registerFlag_ for this parameter to ensure the tool defaults to removing
shared peptides.
---
Nitpick comments:
In `@src/topp/MSstatsConverter.cpp`:
- Around line 100-105: Add regression tests that exercise MSstatsConverter with
both settings of the flag param_remove_shared_peptides (default/remove and
explicit keep) and assert the produced output differs as expected and that the
new warning text is emitted; update or extend
src/tests/class_tests/openms/source/MSstatsFile_test.cpp to invoke
MSstatsConverter (or call the underlying conversion routines used by
MSstatsConverter) twice—once using the default behavior and once with the
keep-shared-peptides flag set—and validate (1) that shared peptides are removed
in the default run, (2) that shared peptides remain when the flag is unset, and
(3) that the warning message string introduced for this behavior appears in the
logs for the relevant run.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 18fb162f-499f-4cf2-a244-3f9715cd0da9
📒 Files selected for processing (3)
src/openms/include/OpenMS/FORMAT/MSstatsFile.hsrc/openms/source/FORMAT/MSstatsFile.cppsrc/topp/MSstatsConverter.cpp
…efault for remove_shared_peptides Add full @PARAM documentation for storeLFQ() to match storeISO() style, fixing Doxygen warning test failures. Change remove_shared_peptides from registerFlag_ (default false) to registerStringOption_ with default "true" so shared peptides are removed by default, preserving backward-compatible behavior and ensuring test CSV outputs remain unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Thanks. Please update the nanobind bindings as mentioned by coderabbit. |
|
@jpfeuffer Im trying to do this for consistency across workflows. |
…red_peptides - Add remove_shared_peptides parameter (default true) to storeLFQ() and storeISO() nanobind lambdas in bind_format.cpp - Update MSstatsFile_test.cpp START_SECTION signatures to match the new C++ API Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
would be important to find out if they include all shared peptides or only those of subsumable etc. |
Add two missing changelog entries for the OpenMS 3.6.0 under-development section: - General: Fix UpdateCheck crash when $HOME is not writable in containers (#9075) - TOPP tools / MSstatsConverter: new -remove_shared_peptides parameter (#9068) Co-authored-by: Copilot <[email protected]>
Add two missing changelog entries for the OpenMS 3.6.0 under-development section: - General: Fix UpdateCheck crash when $HOME is not writable in containers (#9075) - TOPP tools / MSstatsConverter: new -remove_shared_peptides parameter (#9068) Co-authored-by: GitHub Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Timo Sachsenberg <[email protected]>
Summary
-remove_shared_peptidesflag toMSstatsConverter(defaulttruefor backward compatibility)false, shared peptides mapping to proteins in different indistinguishable protein groups are retained in the MSstats outputOPENMS_LOG_WARNmessages reporting how many peptide hits were dropped by this filterMotivation
The
isQuantifyable_()method inMSstatsFile.cppsilently drops peptides whose protein accessions span multiple indistinguishable protein groups. This is hardcoded with no user-facing parameter to control the behavior.In a benchmarking study comparing quantms (which uses OpenMS) against PD on a TMTpro 16-plex dataset, we found that this filter causes:
This occurs even when the upstream
ProteinQuantifieris configured withuse_shared_peptides=true, creating a disconnect between the two tools.Changes
MSstatsConverter.cpp-remove_shared_peptidesadvanced flagMSstatsFile.hremove_shared_peptidesparameter tostoreLFQ()andstoreISO()MSstatsFile.cppisQuantifyable_()check on the new parameter; add warning log when peptides are droppedTest plan
-remove_shared_peptidesset) produces identical output to current version🤖 Generated with Claude Code
Summary by CodeRabbit