Repository navigation
[FIX] ProteomicsLFQ PIP-ECHO: thread-independent seed detection and lossless -feat_dir checkpoints - #10692
Conversation
FeatureFinderMultiplex (and with it ProteomicsLFQ's untargeted seeds) filtered the peaks of a spectrum in an OpenMP loop. Every peak that passed blacklisted the peaks of its mass traces inside a critical section, while other threads were reading the same blacklist to decide on their peaks, and the passing peaks were added in the order the threads finished. With more than one thread the result therefore depended on scheduling: on a 20 min MS1 slice of a ProteoBench HF-X run, three runs with 4 threads gave 24,403 / 24,403 / 24,405 features, one thread 24,401. The peaks of a spectrum are now filtered in parallel against the blacklist as it is when the spectrum is reached. Each decision records the blacklist entries it read, and each passing peak the entries it would blacklist (blacklistEntries_(), split off blacklistPeak_()). The peaks are then accepted in order of m/z; a peak whose decision read an entry that an earlier peak of the spectrum has changed since is filtered again. This is exactly the result of a single thread, and as fast as before (1:08 min with 4 threads on the slice, as before; 0.4% of the decisions are repeated). Test: a dense synthetic experiment gives the single-thread result with 2, 4 and 8 threads. It fails on every multi-threaded run with the previous code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018AJBim7yktez24GaG92uDg
…of their random ids The assay of a seed was named "[<seed unique id>][<seed count>]/<charge>", and the features are sorted by that name. Unique ids are drawn from a time-seeded generator outside test mode, so the seed features came out in a different order in every process, and order-dependent steps after them (the linear model imputing failed elution model fits, tie breaks when merging coincident features) could differ too. The seed count now comes first: "[<seed count>][<seed unique id>]/<charge>". Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018AJBim7yktez24GaG92uDg
…k exactly The Arrow writers stored meta values as text with DataValue::toString(), which writes doubles between 0.01 and 10000 with 15 decimals. That does not round-trip: -3.6414734172058556 came back as -3.641473417205856. ProteomicsLFQ -feat_dir checkpoints are such files, so a combine saw slightly different masserror_ppm, IM_* and PSM meta values, and a slightly different run FWHM (the RT window of linking), than the run that wrote them, and PIP-ECHO's transfer decisions changed. New ArrowIOHelpers::metaValueString() writes doubles (also in lists) in their shortest form that reads back as the same double, and readMetaValues() already parses it exactly. All writers of the internal formats use it: FeatureMapArrowIO, ConsensusMapArrowIO, ProteinIdentificationArrowIO and QPXFile::exportToArrow (feature, map, data processing, protein, PSM and spectrum meta values). Tests: the round trips of FeatureMapArrowIO and ConsensusMapArrowIO compare such doubles with ==. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018AJBim7yktez24GaG92uDg
…, 1 thread equals 4 The existing -feat_dir tests cover identified-only quantification. On BSA with -pip_echo true, a combine from the checkpoints of a one-shot run has to reproduce its MSstats output byte for byte and its QPX views exactly, and the same run with 4 threads its checkpoints, MSstats and mzTab (not on MSVC, which does not reproduce independent processes bit for bit). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018AJBim7yktez24GaG92uDg
…" and "decoy" The internal PSM table stores target_decoy only as the boolean is_decoy and excluded the meta value, so "target+decoy" (a peptide in both a target and a decoy protein) came back as "target". On the ProteoBench HF-X run A_01 that changed 81 PSMs of a ProteomicsLFQ -feat_dir checkpoint. Such values are now kept in psm_metavalues, which the readers of FeatureMapArrowIO and QPXFile apply after is_decoy; "target" and "decoy" are still stored in is_decoy only. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018AJBim7yktez24GaG92uDg
…e seed features FeatureFinderIdentification now orders its seed features by seed number, so in test mode the unique ids drawn in feature order go to other features: the consensusXML of TOPP_ProteomicsLFQ_3, _9, _3_seedRT and _9_seedRT differ in element ids and the PSMs' feature_id. Nothing else changed: the MSstats and mzTab outputs are byte-identical to develop's, and so is the consensusXML once these ids are removed (for _9 and _9_seedRT, as sorted lines). The files are regenerated from this branch's output, with their previous InferenceEngineVersion line kept. They also take on what develop already produced within FuzzyDiff's tolerance (e.g. intensities differing by 1e-4). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018AJBim7yktez24GaG92uDg
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Change: Bug fix Merge Risk: ⚪ Minimal · up to
|
…tion changes natively - IsobaricWorkflow (#10631, #10620/#10616): one consensus feature per identified spectrum with all of its identifications (sorted best first, which the identification data keeps as its query order); identifications without spectrum reference and those of reporter scans that miss a channel become unassigned; an identified spectrum missing from the mzML fails the tool; the PSM FDR includes the unassigned identifications. creditBestPeptidoform_() works on the links of the consensus features: identifications whose best match names another peptidoform or charge than the first one with a match are unlinked, so they become unassigned with all their matches. The new IsobaricWorkflow goldens of develop are reproduced unchanged. - FAIMSHelper::filterFeaturesByFAIMSCV() (#10687) keeps the identification data of the map, which the kept features link (test added); filterIdentificationsByFAIMSCV() uses the same group rule. - FeatureMapArrowIO_test: develop's exact-doubles round trip (#10692) builds and reads the identifications of the map through the identification data. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
Description
Two reproducibility problems on the ProteomicsLFQ match-between-runs path (
-targeted_only false -pip_echo true), found while benchmarking #10632 on the ProteoBench DDA quant ion module (Q Exactive HF-X, PXD028735, 6 runs):-feat_dircheckpoints did not reproduce the one-shot run: 46,415 vs 46,419 precursors.Both are fixed:
Problem 1: seed detection depended on thread scheduling
Causes.
MultiplexFilteringCentroided(andMultiplexFilteringProfile) filter the peaks of a spectrum in an OpenMP loop.[<seed unique id>][<seed count>]/<charge>and sorts its features by that name.-test, unique ids come from a time-seeded generator. The seed features therefore came out in a different order in every process; in three develop detections of A_01, 29,420 of 77,860 rows sat elsewhere.mergeCoincidentFeatures.Fix.
MultiplexFiltering::filterSpectrum_()(new, used by both filters).blacklistEntries_()is split offblacklistPeak_(), and these entries do not depend on the blacklist.[<seed count>][<seed unique id>]/<charge>. The order of the features no longer depends on the random id.Problem 2:
-feat_dircheckpoints were not losslessCauses. I compared each run's in-memory FeatureMap with its re-read checkpoint, field by field and with doubles compared bit for bit, on all 6 HF-X runs.
DataValue::toString(). That writes doubles between 0.01 and 10000 with 15 decimals, which does not round-trip (−3.6414734172058556 → −3.641473417205856). This affected:masserror_ppm,pipecho_obs_envelopeandIM_*;target_decoy. The internal PSM table keepstarget_decoyonly as the booleanis_decoy. "target+decoy" therefore came back as "target" (81 PSMs on A_01).Fix.
ArrowIOHelpers::metaValueString()writes doubles, also in lists, in their shortest form that reads back as the same double.readMetaValues()already parsed it exactly. All writers of the internal formats use it: FeatureMapArrowIO, ConsensusMapArrowIO, ProteinIdentificationArrowIO andQPXFile::exportToArrow(feature, map, data-processing, protein, PSM and spectrum meta values). The public QPX views are unchanged.target_decoyvalues other than "target" and "decoy" are now also written topsm_metavalues. Both PSM readers apply them afteris_decoy.Descriptionmeta value is not restored. It is harmless:getDescription()returns "" either way.Verification on the ProteoBench HF-X data
Recipe. The #10585 recipe,
-threads 4, with the same IDs for develop and this PR:d7d9974).proteobench0.18.6, format "quantms", min 3 runs.Repeated detection of A_01 (checkpoints compared row by row; only the ids drawn at random outside test mode are left out):
The race did not change the feature set in these three develop runs on this machine, unlike the 77,858 / 77,859 of the original report. On the slice, though, it changed the feature set in every run. This PR gives the single-thread result. In the 6-run job, every run's features differ between develop and this PR by 1–2 features.
One-shot (detection in memory, writes
-feat_dir) vs combine (same invocation again, reuses all 6 checkpoints):With this PR, the consensusXML of a combine differs from the one-shot only in two ways: the empty protein
Descriptionuser params are missing, andpercolator_scoresits at another position within its PSM's user params, with the same value. That position follows the order in which a process first registers meta value names.ProteoBench (min 3 runs):
Effect on default results.
-threads 1(the TOPP default), the seed detection is unchanged; only the seed order differs.Tests
MultiplexFilteringCentroided_test: a dense synthetic experiment gives the single-thread result with 2, 4 and 8 threads. With develop's library it fails on every multi-threaded run.FeatureMapArrowIO_test,ConsensusMapArrowIO_test,ArrowIOHelpers_test:==after the round trip: feature, map, data-processing, protein, PSM and spectrum meta values, double lists, NaN and inf.TOPP_ProteomicsLFQ_feat_dir_pipecho_*(BSA,-pip_echo true -PipEcho:fdr 1.0to keep transfers):-feat_dirwas tested on the identified-only path only.ProteomicsLFQ_{3,9,3_seedRT,9_seedRT}_out.consensusXML(seeded runs):feature_id._9,_9_seedRT).InferenceEngineVersionline. They thereby also take on develop's current values where develop had already drifted from them within FuzzyDiff's tolerance (e.g. intensities by 1e-4).Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_018AJBim7yktez24GaG92uDg
Summary by CodeRabbit
target+decoyannotations during PSM import and export.