Repository navigation
Add repeated shuffle to DecoyDatabase - #8339
Conversation
WalkthroughNew shuffle-based decoy generation was added: a DecoyGenerator::shuffle API, Cython bindings, TOPP DecoyDatabase support for repeated shuffles, tests, and reference FASTA data; implementation digests proteins, shuffles peptides per-repeat with seeded generators, and assembles decoy proteins. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Caller
participant ShuffleAPI as DecoyGenerator::shuffle
participant Digest as DigestionModule
participant PeptideGen as Per-Peptide DecoyGenerator
participant Assembler as ProteinAssembler
Caller->>ShuffleAPI: call shuffle(protein, protease, decoy_factor)
ShuffleAPI->>Digest: digest protein -> peptides[]
Digest-->>ShuffleAPI: peptides[]
loop for each repetition (decoy variant)
loop for each peptide in peptides[]
ShuffleAPI->>PeptideGen: create seeded generator (per-repeat/per-peptide)
PeptideGen-->>ShuffleAPI: shuffled peptide
end
ShuffleAPI->>Assembler: concatenate shuffled peptides
Assembler-->>ShuffleAPI: decoy_protein
end
ShuffleAPI-->>Caller: return vector of decoy_protein(s)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-09-03T12:58:20.032ZApplied to files:
🧬 Code graph analysis (1)src/topp/DecoyDatabase.cpp (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
🔇 Additional comments (5)
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/tests/topp/CMakeLists.txt (1)
2710-2712: Add explicit-decoy_stringand-decoy_string_positionfor consistency.The test setup is correct (deterministic seed, FuzzyDiff DEPENDS), and the reference file is present. However, tests 2–4 that also use shuffle/reverse methods with FuzzyDiff comparisons explicitly set
-decoy_string "DECOY_SEQ_" -decoy_string_position "prefix". For consistency and to avoid brittleness if defaults change, align test 8 with this pattern:add_test("TOPP_DecoyDatabase_8" ${TOPP_BIN_PATH}/DecoyDatabase -test -in ${DATA_DIR_TOPP}/DecoyDatabase_1.fasta -out DecoyDatabase_8.tmp.fasta -decoy_string "DECOY_SEQ_" -decoy_string_position "prefix" -method shuffle -shuffle_decoy_ratio 2 -seed 42)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/openms/include/OpenMS/CHEMISTRY/DecoyGenerator.h(1 hunks)src/openms/source/CHEMISTRY/DecoyGenerator.cpp(3 hunks)src/pyOpenMS/pxds/DecoyGenerator.pxd(2 hunks)src/tests/class_tests/openms/source/DecoyGenerator_test.cpp(1 hunks)src/tests/topp/CMakeLists.txt(1 hunks)src/tests/topp/DecoyDatabase_8_out.fasta(1 hunks)src/topp/DecoyDatabase.cpp(5 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
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/source/CHEMISTRY/DecoyGenerator.cppsrc/openms/include/OpenMS/CHEMISTRY/DecoyGenerator.h
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/CHEMISTRY/DecoyGenerator.h
src/tests/class_tests/openms/**/*.cpp
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Write unit tests for new functionality
Files:
src/tests/class_tests/openms/source/DecoyGenerator_test.cpp
🧠 Learnings (5)
📚 Learning: 2025-08-14T10:19:54.371Z
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#8167
File: src/topp/Digestor.cpp:200-226
Timestamp: 2025-08-14T10:19:54.371Z
Learning: In OpenMS (C++ bioinformatics framework), use boost random libraries instead of std library random distributions for cross-platform reproducible random number generation, as std library distributions are not reproducible across platforms.
Applied to files:
src/openms/source/CHEMISTRY/DecoyGenerator.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
PR: OpenMS/OpenMS#8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.
Applied to files:
src/tests/topp/CMakeLists.txtsrc/tests/class_tests/openms/source/DecoyGenerator_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality
Applied to files:
src/tests/topp/CMakeLists.txtsrc/tests/class_tests/openms/source/DecoyGenerator_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`
Applied to files:
src/tests/class_tests/openms/source/DecoyGenerator_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings
Applied to files:
src/pyOpenMS/pxds/DecoyGenerator.pxd
🧬 Code graph analysis (4)
src/openms/source/CHEMISTRY/DecoyGenerator.cpp (1)
src/topp/DecoyDatabase.cpp (1)
protein(151-496)
src/openms/include/OpenMS/CHEMISTRY/DecoyGenerator.h (1)
src/openms/source/CHEMISTRY/DecoyGenerator.cpp (2)
shuffle(63-99)shuffle(63-63)
src/tests/class_tests/openms/source/DecoyGenerator_test.cpp (1)
src/openms/source/CHEMISTRY/DecoyGenerator.cpp (2)
shuffle(63-99)shuffle(63-63)
src/topp/DecoyDatabase.cpp (2)
src/openms/source/CHEMISTRY/DecoyGenerator.cpp (2)
shuffle(63-99)shuffle(63-63)src/openms/source/CONCEPT/Exception.cpp (1)
InvalidParameter(230-233)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: build-and-test (macos-15-intel, xcode, 16.0.0)
- GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
- GitHub Check: build-and-test (ubuntu-22.04-arm, g++, 11)
- GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
- GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
- GitHub Check: build-and-test (macos-26, xcode, 26.0)
- GitHub Check: cppcheck-test
🔇 Additional comments (2)
src/tests/topp/DecoyDatabase_8_out.fasta (1)
1-60: The test data is correct—identical decoy sequences across variants are intentional.The review comment incorrectly identified duplicate sequences as a bug. The DecoyDatabase implementation explicitly uses the same random seed for all shuffle iterations (line 471:
shuffler.seed(seed)), producing deterministic, identical shuffles. This is documented in the method description and comments:
- "all sequences are shuffled using the same random seed, ensuring that identical sequences produce the same shuffled decoy sequences"
- "Set the seed for shuffling always to the same number, this ensures that identical peptides get shuffled the same way every time (without keeping track of them explicitly). This will ensure that the total number of unique tryptic peptides is identical in both databases."
The
shuffle_decoy_ratioparameter generates multiple database copies (not multiple different shuffles), so identical sequences with different suffix identifiers (_1, _2) is the expected test data format.Likely an incorrect or invalid review comment.
src/tests/topp/CMakeLists.txt (1)
2714-2715: Good negative test coverage.WILL_FAIL for reverse + shuffle_decoy_ratio is appropriate and minimal.
|
@timosachsenberg this looks to have broken our CI, can you take a look and see if you can isolate why? |
|
Ok. Strange. Here it passed all tests. |
Description
continues #8338
Checklist
How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check outIf you click in the column that lists the failed tests you will get detailed error messages.
Advanced commands (admins / reviewer only)
Click to expand
/reformat(experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.rebuild jenkinswill retrigger Jenkins-based CI buildsSummary by CodeRabbit
New Features
Tests