Repository navigation
Conversation
…ist; shared shuffler
DecoyDatabase gets method 'shuffle_products' for 'type' RNA: each digestion
product ('enzyme', an RNase; no missed cleavages) is shuffled on its own,
with the enzyme's cleavage residues (e.g. G for RNase_T1) and the 3' residue
of the product in place. The same product always gets the same shuffle
(platform-independent RNG, seeded per seed and product), so targets that
share oligos (tRNA isodecoders) get decoys that share them, and the numbers
of distinct target and decoy oligos stay balanced. Decoy oligos of at least
'min_length' residues are reshuffled (up to 'shuffle_max_attempts' times)
until they equal no target oligo, no other decoy oligo and no oligo of the
new optional 'blacklist' FASTA (e.g. the human RNA background), since a
decoy that is a real molecule collects that molecule's spectra. Oligos
without an allowed shuffle are kept and reported. 'enzyme' now also accepts
RNase names and is checked against 'type'.
The shuffler (NucleicAcidSearchEngine's RNABackgroundDatabase) moves into
the library as RNAProductShuffler, used by NASE's background search and by
DecoyDatabase. Additions: failedProducts() and setMaxTries() (default 200,
NASE behaviour unchanged).
Tests: RNAProductShuffler_test (former RNABackgroundDatabase_test plus new
sections, including a fixed shuffle as a platform check); TOPP tests
DecoyDatabase_12-15 on isodecoder tRNAs check determinism, G positions,
balance of distinct target/decoy oligos and avoidance of blacklisted
oligos, and the parameter checks.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
timosachsenberg
left a comment
There was a problem hiding this comment.
Confirmed substantive RNA target–decoy correctness issue in the new shuffle_products mode. The focused sanitizer-backed reproduction is documented inline; full OpenMS integration was not available in this environment.
| if (shuffle_products) | ||
| { | ||
| // per product; products shorter than 'min_length' are shuffled too (without the forbidden check), so that | ||
| // missed-cleavage decoy oligos do not contain unchanged target stretches |
There was a problem hiding this comment.
Missed-cleavage target/decoy collisions are not excluded. rewrite(..., true) shuffles products shorter than min_length through short_replacement_of_, which passes an always-false forbidden predicate. For -type RNA -method shuffle_products -enzyme RNase_T1 -min_length 5 with targets ACGUAG and CAGAUG, the individual T1 products are ACG/UAG and CAG/AUG (all shorter than 5). With the default seed 1, the shuffler maps the first target to decoy CAGAUG and the second to decoy ACGUAG. Both are exactly the other target's searchable six-base product when NASE uses one missed cleavage (its default). Neither the target-oligo forbidden set nor -blacklist prevents this, because productKeys() excludes those short component products.
Own test: compiled and ran an isolated C++20 reproduction of this PR's FNV-1a/SplitMix64 Fisher–Yates shuffle and T1 segmentation with GCC, AddressSanitizer and UndefinedBehaviorSanitizer; both reciprocal collisions were observed and assertions passed. This does not establish a full OpenMS integration test: no checkout is available and GitHub DNS resolution fails in the isolated build environment. Please add a regression case for these two sequences with one missed cleavage and check actual searchable missed-cleavage products for target/decoy collisions (including sequences assembled from short products).
There was a problem hiding this comment.
Thanks, confirmed and fixed. Only single products were checked, so a missed-cleavage decoy oligo assembled from products shorter than min_length could equal a target oligo. Your case reproduced exactly: both decoys came out as the other target.
The fix is in the shared shuffler and applies to both tools:
#10940(beacf12c56):RNABackgroundDatabase::rewrite()now takes all sequences together and checks every combination of up tomissed_cleavages + 1consecutive products, short ones included.productKeys()lists those combinations as well. When a combination collides, its component products try other shuffles. A change is kept only if it lowers the number of collisions around that product, and each product keeps a single shuffle everywhere, so target/decoy balance is preserved. A short product may also stay unshuffled. NASE checks the search's missed cleavages, plusvariable_max_per_oligowhen modifications can block cleavage (e.g. m7G).- This PR (
7eb3f1c9cd): the same change is applied toRNAProductShuffler. DecoyDatabase gets amissed_cleavagesoption (default 1, NASE's default) and rewrites all decoys before writing them.
Regression tests use your sequences: a section in RNAProductShuffler_test, and TOPP_DecoyDatabase_16. The latter's check script now also compares missed-cleavage oligos; it fails with -missed_cleavages 0 and passes with 1.
What's left: combinations made only of products that cannot change (e.g. runs of G, AG, CG) can still collide. They are counted and logged. On HAP1 tRNA data with a minimum length of 7, the colliding decoy combinations dropped from 1759 to 832 (database decoys) and from 10281 to 6304 (built-in background decoys). Most of the remainder is only searchable when a G carries a cleavage-blocking modification.
There was a problem hiding this comment.
A correction to my previous reply. The repair loop there kept any reshuffle that lowered the number of colliding combinations, so it could trade one collision for another. On HAP1 data it turned the decoy of tRNA-Phe-GAA-4-1 into UAUG + CACG, joined across a 2'-O-methyl G. That join is the mitochondrial oligo UAUGCACG, and it then collected up to 65 spectra per run as a "decoy". Over 18 entrapment searches, native results lost a third of their target spectra at q 5% (1570 → 1028).
Fixed in #10940 (0b2d80cd58, merged here in f3fa567376):
- A reshuffle is now kept only if the colliding combinations around the product afterwards are a strict subset of those before, so it never creates a new collision.
- In NASE, an oligo that a database decoy shares with a background sequence now counts as background. It is a real molecule, and subset-neighbor search leaves such matches out.
Over the 18 searches, native is back to 1519 target spectra at q 5% (estimated FDP 2.4%), and Percolator gives 1848 (3.4%).
The collision numbers in my previous reply were from the flawed version. On the same HAP1 file, colliding decoy combinations now go from 1759 to 1109 (database decoys) and from 10281 to 8046 (background decoys). The descriptions and the docs table are updated. Your regression case and TOPP_DecoyDatabase_16 still pass.
Brings in the missed-cleavage check of the per-product shuffler (review of #10941) and applies it to the library class RNAProductShuffler and to DecoyDatabase: - RNAProductShuffler: batch rewrite() that checks combinations of up to missed_cleavages + 1 consecutive products and changes the shuffles of their components (local search; one replacement per product everywhere), productKeys() with missed cleavages, failedCombinations(). setMaxTries() and failedProducts() kept. - DecoyDatabase shuffle_products: new option 'missed_cleavages' (default 1, NASE's default); target and blacklist oligos include missed-cleavage combinations; all decoys are rewritten together and written at the end. - Tests: the review's case (targets ACGUAG and CAGAUG, RNase T1, min_length 5, one missed cleavage) in RNAProductShuffler_test and as TOPP_DecoyDatabase_16 with a missed-cleavage check in DecoyDatabase_shuffle_products_check.cmake (it fails with -missed_cleavages 0). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review of #10941: decoys were checked against real oligos only product by product. Products shorter than the minimum length were shuffled without any check, so a missed-cleavage combination of decoy products could equal a target oligo (e.g. targets ACGUAG and CAGAUG with RNase T1, min. length 5 and one missed cleavage: each target's decoy is the other target). RNABackgroundDatabase::rewrite() now handles all sequences together and checks the combinations of up to missed_cleavages + 1 consecutive products of every rewritten sequence. Components of forbidden combinations try further shuffles (a short product may also stay as it is) and keep the one that leaves the fewest forbidden combinations around its occurrences; each product keeps one replacement everywhere, so decoy/target balance is kept. productKeys() lists missed-cleavage combinations too. NASE uses the search's missed cleavages, plus 'variable_max_per_oligo' when modifications can block cleavage. On HAP1 tRNA data (built-in background, min. length 7), this reduces the decoy combinations equal to a real oligo from 1759 to 832 (database decoys) and from 10281 to 6304 (background decoys); the rest consist of products that cannot change (e.g. G, AG). Regression test with the review's case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
timosachsenberg
left a comment
There was a problem hiding this comment.
Follow-up to the previously reproduced target/decoy collision: the new repair avoids the original target keys but can collapse distinct searchable decoys into one. A focused independent sanitizer-backed reducer found the separate issue described inline. Full OpenMS integration was not available because no checkout is present and the isolated environment cannot resolve github.com.
| { | ||
| if (b.decoy) decoy_sequences.push_back(b.entry.sequence); | ||
| } | ||
| decoy_sequences = product_shuffler->rewrite(decoy_sequences, all_products, is_forbidden, true, missed_cleavages); |
There was a problem hiding this comment.
The collision repair can collapse two distinct searchable decoys into one. With RNA targets ACGUAG and CAGAUG, RNase_T1, min_length=5, missed_cleavages=1, and seed 1, the new greedy replacement loop produces ACGAUG for both decoy sequences. Neither equals a target, so failedCombinations() becomes 0, but the two distinct target 6-mers now have only one unique searchable decoy 6-mer. The used_ uniqueness check covers long individual products, not missed-cleavage combinations assembled from short products. This breaks the intended balance of distinct target/decoy candidates and can bias decoy-based FDR estimation. Please also check uniqueness of the assembled decoy oligos during candidate selection, not only collisions with target/blacklist keys; the same algorithm is used in #10940.
Own verification: compiled and ran a focused C++20 reducer of the current FNV-1a/SplitMix64 shuffle, RNase_T1 segmentation, and greedy local-collision repair using GCC with AddressSanitizer and UndefinedBehaviorSanitizer. Before repair it reproduced the two reciprocal target collisions; after repair it yielded ACGAUG, ACGAUG, zero target collisions but 2 → 1 distinct decoys; all assertions passed, no sanitizer reports. This is an isolated reproduction, not an OpenMS integration test (no checkout; GitHub DNS unavailable in the build environment).
There was a problem hiding this comment.
Written by an AI agent using GPT-6.
Confirmed and fixed in the shared shuffler. It now tracks the original owners of every searchable rewritten window, including missed-cleavage products assembled from short components. Distinct originals are checked for duplicate decoy mappings; repeated originals may still share one replacement. A repair must remove existing conflicts without creating a forbidden match or a new duplicate. Unresolved conflicts are counted and reported when the bounded search cannot repair them.
Your case now produces ACGAUG and CAGUAG, retaining two distinct decoys. The unit test checks that count, and the TOPP checker now compares distinct target/decoy counts with missed cleavages; it rejects the old two-target/one-decoy output. Further checks cover repeated originals, eight seeds and unresolved-collision reporting with a small shuffle budget. All 75 selected CTests pass without changing reference outputs or comparison tolerances.
Brings 0b2d80c into RNAProductShuffler (and with it DecoyDatabase shuffle_products): a reshuffle that repairs missed-cleavage collisions is only kept if it creates no new one. NASE also counts oligos that a database decoy shares with the background as background. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge the current background branch and its NASE foundation fixes while retaining the shared RNAProductShuffler and DecoyDatabase behavior. Validated with all 75 selected CTests and a fresh/cached background plus Percolator comparison; no learned-output references changed. Co-authored-by: OpenAI Codex (GPT-6) <[email protected]>
Index the original owners of searchable rewritten windows, including missed-cleavage products assembled from short components. Bounded repair must reduce existing conflicts without introducing forbidden matches or merging distinct originals into one decoy; identical originals still share one replacement. Count and report any unresolved conflicts. The review case and broader sharing/budget regressions fail on the old implementation and pass with the fix. All 75 selected CTests pass. Co-authored-by: OpenAI Codex (GPT-6) <[email protected]>
Inherit the updated develop base and the MassExplainer header fix. Co-authored-by: OpenAI Codex (GPT-6.2 Sol) <[email protected]>
The standalone checker uses IN_LIST. CMake 3.28 rejects it in script mode unless CMP0057 is enabled. Declare the project minimum version in the script so the checks run with the same policy settings as the build. Co-authored-by: OpenAI Codex (GPT-6.2 Sol) <[email protected]>
Written by an AI agent using GPT-6.2 Sol.
Build follow-up. This branch now includes #10940 at
95a2465c2d, with the upstream ONNX Runtime archive fallback (#10947) and the WindowsMassExplainerheader fix. All 82 selected CTests passed in the ONNX-enabled Linux Debug build, including the NASE, DecoyDatabase, PeptDeep, Compomer, MassExplainer, and FLASH core checks. The Windows wheel job passed on the previous head. Full Windows build-and-test is pending CI.The standalone DecoyDatabase checker now declares the project CMake minimum so script mode enables CMP0057 for
IN_LIST. CMake 3.28.3 reproduced the three CI failures before the fix. All three checks pass with the fix, and the checker still rejects a fixture with two targets mapping to one decoy.Description
Stacked on #10940 (NASE background search), which is stacked on #10927.
Restacked onto the resolved #10940 at
95a2465c2d, including #10927 throughd45a5c1340. The review follow-up also corrects assembled-decoy uniqueness in the sharedRNAProductShuffler, used by both DecoyDatabase and NASE on this branch. It indexes each searchable rewritten window by its original oligo, including missed-cleavage products assembled from short components. Identical originals may still share a decoy; distinct originals are checked for collisions. Repair candidates must remove existing conflicts without creating forbidden matches or new duplicate mappings. Unresolved forbidden/non-unique windows are counted and reported when the bounded repair cannot resolve them.Adds a per-oligo RNA shuffle to DecoyDatabase, with an optional blacklist of known RNAs, and moves the shuffler of #10940 into the library so that NASE and DecoyDatabase share it.
Why. DecoyDatabase's RNA
shufflepermutes whole sequences. For tRNA databases this has two problems:Tide's peptide-level shuffle avoids both problems for proteins (one decoy per distinct peptide, never equal to a target), and this does the same for RNA. In the 18-search entrapment check of #10940 (HAP1 tRNA, NASE with the human background), Percolator's estimated FDP at q ≤ 5% fell from 5.9% to 3.4% with per-oligo decoys, against 7.2% to 5.1% with whole-tRNA decoys from DecoyDatabase; at q ≤ 10%, from 11.0% to 5.2% against 10.8% to 9.2%.
The entrapment figures above are from an earlier feature checkpoint; those searches were not rerun after this decoy-uniqueness correction and do not validate its FDR calibration.
What changes
DecoyDatabase,
-type RNA -method shuffle_products. Each digestion product ofenzyme(an RNase; no missed cleavages) is shuffled on its own:seedand the product. Targets that share oligos therefore get decoys that share them, and the numbers of distinct target and decoy oligos stay balanced.min_lengthresidues are reshuffled, up toshuffle_max_attemptstimes, until they equal no target oligo, no other decoy oligo and no oligo of the new optionalblacklistFASTA (e.g.share/OpenMS/SEQUENCES/RNA/human_background_rna.fasta).missed_cleavages, default 1 like NASE), including those assembled from products shorter thanmin_length(review). All decoys are rewritten together and written at the end: components of a colliding combination try other shuffles, and a change is kept only if it removes existing conflicts without introducing a forbidden match or a duplicate mapping of distinct originals. Each product keeps one shuffle everywhere; repeated originals therefore remain shared. Combinations of products that cannot change (e.g. G, AG) can remain and are reported.enzymenow also accepts RNase names and is checked againsttype.Example:
The shuffler moves from NASE (
RNABackgroundDatabasein [FEATURE] NASE: search a background of known RNAs (background:enable) #10940) into the library asOpenMS::RNAProductShuffler(CHEMISTRY/RNAProductShuffler.h), including [FEATURE] NASE: search a background of known RNAs (background:enable) #10940's missed-cleavage check. It gainsfailedProducts()andsetMaxTries()(default 200), and NASE's behaviour is unchanged. DecoyDatabase usesshuffle_max_attempts, default 30, as its number of tries.Tests
ACGUAGandCAGAUGnow produce distinct decoysACGAUGandCAGUAGwith the reviewed settings. Additional checks cover repeated originals, eight seeds and reporting unresolved duplicate windows under a small shuffle budget. The strengthened TOPP checker rejects the old two-target/one-decoy output.RNAProductShuffler_test: the formerRNABackgroundDatabase_testplus new sections, including a fixed expected shuffle as a check that results are the same on every platform.DecoyDatabase_12–15, on isodecoder tRNAs, andDecoyDatabase_16, the review's case (targets ACGUAG and CAGAUG, one missed cleavage; its check fails with-missed_cleavages 0):Checklist
AI use (see the OpenMS AI Policy)
Co-authored-by:trailer, and the description above explains the design intent and rationaleNo need to edit the CHANGELOG file: entries are generated automatically once per week from merged changes.
🤖 Generated with Claude Code