Repository navigation
add mbr alignment to qccollector - #12
Conversation
| ~QCMBRalignment(); | ||
| int MBRAlignment(MetricMap&,MetricMap&,MetricMap&,MetricMap&,MetricMap&) const; //std::vector<std::pair<OpenMS::String,OpenMS::FeatureMap>> FeatMaps_ | ||
| protected: | ||
| std::vector<std::pair<OpenMS::String,OpenMS::FeatureMap>> FeatMap_; |
There was a problem hiding this comment.
it might be good to give std::pair<OpenMS::String,OpenMS::FeatureMap> an alias, so its easier to understand whats going on, .e.g.
typedef OpenMS::String Filename;
typedef std::pair<Filename, OpenMS::FeatureMap>FeatureMapWithName;
| #include <OpenMS/METADATA/ProteinIdentification.h> | ||
| namespace OpenMS | ||
| { | ||
| class MBRAlignment |
There was a problem hiding this comment.
this class is not used. Can be deleted
| @@ -0,0 +1,18 @@ | |||
| #ifndef OPENMS_CONCEPT_MBRAlignment_H | |||
| #define OPENMS_CONCEPT_MBRAlignment_H | |||
| #include <OpenMS/FORMAT/FeatureXMLFile.h> | |||
There was a problem hiding this comment.
FeatureMap.h would suffice. FeatureXMLFile is not used here.
Even better:
just forward declare the class:
class FeatureMap;
class OPENMS_DLLAPI QCMBRalignment ...
| @@ -0,0 +1,18 @@ | |||
| #ifndef OPENMS_CONCEPT_MBRAlignment_H | |||
| #include <OpenMS/FORMAT/FeatureXMLFile.h> | ||
| #include <OpenMS/CONCEPT/QCMetricMap.h> | ||
|
|
||
| class OPENMS_DLLAPI QCMBRalignment |
There was a problem hiding this comment.
should be within namespace OpenMS
| if ( Columnlength_== 0 || Columnlength_== Data.size()) | ||
| { | ||
| DataStrings_.insert(DataStrings_.end(),pair<String,vector<String>>(Head,Data)); | ||
| isfilled_ = isfilled_||true; |
| Columnlength_ = Data.size(); | ||
| } | ||
| else{ | ||
| cout << "MetricMap Error: Wrongly sized Datavector" << endl; |
There was a problem hiding this comment.
throw exception! This must be noticable
| using namespace OpenMS; | ||
| using namespace std; | ||
|
|
||
| Metrics::~Metrics() |
There was a problem hiding this comment.
filename should equal class name
| @@ -0,0 +1,61 @@ | |||
| #include <OpenMS/KERNEL/StandardTypes.h> | |||
| { | ||
| for(StringList::const_iterator it=ins_ProteinQuantifier.begin();it!=ins_ProteinQuantifier.end();++it) | ||
| { | ||
| CsvFile fl(*it,' ',false,-1); |
| @@ -0,0 +1,18 @@ | |||
| #ifndef OPENMS_CONCEPT_MBRAlignment_H | |||
i Please enter the commit message for your changes. Lines starting
cbielow
left a comment
There was a problem hiding this comment.
almost there. goes in the right direction.
changes are annotated.
| } | ||
| for(vector<pair<String,FeatureMap>>::const_iterator it = feat_map_.begin();it!=feat_map_.end();++it) | ||
| { | ||
| if(it->first=="MapRTTransformer"){maps.push_back(it->second);} |
There was a problem hiding this comment.
not required. The FeatureMaps should be directly passed in the Constructor. The Metric must be able to trust that they are the correct ones.
|
|
||
| int numOfcorrRT = originalRTs.size(); | ||
|
|
||
| if(numOfcorrRT>0) |
There was a problem hiding this comment.
why not fill the mzTab object above, right when the data is generated? This would probably cut the code size in half and is better to read.
|
|
||
|
|
||
| } | ||
| mztab.setPeptideSectionRows(PepROWS); |
There was a problem hiding this comment.
you should not overwrite what is already there, but augment it.
Hence its important to agree on a unique way to identify and match the rows already present.
| else | ||
| { | ||
| // pep_id and sequence + spectrum ident | ||
| for (vector<PeptideIdentification>::iterator p_it = pep_id.begin(); p_it!=pep_id.end();p_it++) |
There was a problem hiding this comment.
iterating over all peptideIDs is probably not a good idea. The first ID and the first hit should be taken (if present).
Otherwise, the number of mzTab rows depends on the number of candidates a search engine generates.
It should depend on the number of features though.
|
please address comments for MBRalignment.h and QCMBRalignment.h. Ready for merge otherwise. |
…MS#9767 audit (OpenMS#9790) Fixes 14 of the "no-doubt, easy" defects catalogued in the implementation- consistency audit OpenMS#9767. Each fix is small and localized, ships with a focused regression test that fails (crash/hang/assert) before and passes after, and preserves behavior on valid inputs (only the buggy edge cases change). The set was reviewed with Codex and CodeRabbit; their findings are incorporated below. Boundary / crash / underflow: - #4 QTClusterFinder / FeatureGroupingAlgorithmKD: guard the empty mass range so feature-empty input maps don't dereference front()/back()/size()-1. The guards run before the linking work: KD calls postprocess_() first so per-map protein/unassigned-peptide IDs survive; QT returns before the single-partition branch, whose setParameters_() otherwise throws on the empty maps' invalid max m/z (the <2-maps case is validated by the caller). - #5 TheoreticalSpectrumGenerator: internal-fragment loop bound underflowed for peptides shorter than 4 (l < size-1-2) -> use additive l+3 < size. - #18 MzTab nextPSMRow (both streams): empty hit list underflowed size()-1 and looped forever with export_all_psms -> use current_psm_idx_+1 >= size(). - #30 OMSSACSVFile::load: bound the quote-skipping scan by line.end(). Correctness (wrong field / sentinel / flag): - #3 IDScoreGetterSetter::addToPeptideScoreMap_: the try_emplace "inserted" flag was misused, so a duplicated sequence never kept a later better score. Now updates BOTH the score and its target/decoy label, and resolves equal-score target/decoy ties to the target (matching getPickedProteinScores_), so the peptide-level representative is deterministic and input-order independent. - #6 MRMFeatureFilter: group retention_time_u %RSD read the _l mean/variance. - #12 ConsensusFeature range max sentinel minPositive() -> minNegative(). - #35 TIC::Result::operator== now includes relative_intensities. Serialization round-trip: - #17 Base64::decodeStrings: keep length-1 segments (dropped single-char strings). Also updates the malformed "====" corrupted-input expectation (now decodes to one placeholder byte instead of being silently dropped). - #19 ArrowIOHelpers: parse int meta with stoll -> SignedSize (was 32-bit). - #20 FeatureMapArrowIO::importPSMsFromArrow: group PSM rows by P_ID value, not by row adjacency (matches QPXFile/ConsensusMapArrowIO). Stale-state on reload / clear: - #27 QcMLFile::load: also clear derived run_/set_Name_ID_map_. - #32 CalibrationData::clear: also clear groups_. - #33 KDTreeFeatureMaps: init num_maps_{0}; clear() also clears rt_ cache. Not included: #1 (=OpenMS#9488 PROC-23, already in open PR OpenMS#9616); #2 (correct but the pooled split-charge FDR path has order-dependent side effects that preclude a clean regression test in isolation); #7 (percentile index -- verified NOT a bug: the "-1" is part of the double expression, so the negative value truncates to 0, no underflow); #38 (TOPP-tool aux-array desync, needs a CLI test). Remaining audit items need an API/deprecate decision. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
…ly detected channels, targeted quantification (OpenMS#10783) * [FIX] FeatureFinderMultiplex/MultiplexResolver: exact Spearman cutoffs, two-sided overlap check, satellite union, per-channel RT range Defects found while checking the SILAC attrition report in PhilRe99/openms_silac_nextflow#6 (mirrored in OpenMS#10775): - Math::rankCorrelationCoefficient took two square roots, so an exact correlation of 0.5 came out as 0.49999999999999989 and failed the 'peptide_similarity' (0.5) cutoff in MultiplexFiltering; 0.4 failed 'averagine_similarity' the same way. With three isotopes this meant light and heavy needed identical intensity rank order. Now one square root of the product, as in pearsonCorrelationCoefficient. - MultiplexResolverAlgorithm::isBlacklisted_ looked only at the first blacklisted peak at or above the dummy's m/z (MZBegin), so a peak just below it was missed and the channel reported as absent (0) instead of not quantifiable (NaN). Now MSSpectrum::findNearest within tolerance. - generateMapsCentroided_ stopped collecting a point's satellites at the first duplicate ('break'), dropping the later unique ones (reachable with rt_band > 0). Now skips only the duplicate. - determinePeptideIntensities{Centroided,Profile}_ started rt_min/rt_max at 0 and only reset them for the first mono-isotopic satellite, so the 'rt_min' duration check never applied to later channels and used only the last mono-isotopic RT of the first one. Now a proper min/max per channel. - Column header sizes were incremented before a later channel could abort the multiplet. Now counted for reported multiplets only. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MultiplexResolver/MS1LabeledWorkflow: overlap check ignores the multiplet's own isotopes, applies to added channels; join separately detected channels - The two-sided blacklist lookup made the multiplet's own isotopic peaks veto its missing channels: the light M+4 peak lies ~9 ppm below a Lys4 (or Dimethyl4) channel (4.0251 Da vs. 4 x 1.0034 Da), so e.g. the re-quantified medium channel of a light-detected triplex became NaN. isBlacklisted_ now skips blacklisted peaks at the first six isotopic positions of the multiplet's detected channels (those the detection follows by default) and checks every blacklisted peak within the tolerance on either side, keeping the strict '<' boundary. - A channel added to a multiplet for an identification of it (MS1LabeledWorkflow attachToUndetectedChannels_: intensity 0, no unique id) skipped the overlap check, because the multiplet looked complete (duplex) or the handle was copied as detected (triplex). It is now checked like a missing channel (PhilRe99/openms_silac_nextflow#9). - MS1LabeledWorkflow: when no spectrum holds a peptide's complete pattern, its channels can be detected separately (partial multiplets). mergeFragments_ never merges two such partials (neither is larger), and the resolver completed each with a dummy on the other's blacklisted peaks, so the peptide got no ratio. joinChannelsOfIdentifiedPeptides_ lets an identified partial multiplet take up the partials at the m/z its peptide has in the missing channels (same charge and CV, eluting at the identification within the id_mapping tolerances, identifications of the same peptide only). Synthetic fixture MS1LabeledWorkflow_8. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] Update reference outputs for the Spearman cutoff and per-channel RT range fixes Each change was traced to one fix by applying the fixes one at a time on top of develop (on which all of these tests pass): - Spearman (exact 0.5 / 0.4 no longer rejected): FeatureFinderMultiplex 4, 5, 6, 9, 11. More seeds pass the filters, so some intensities and ratios change and test 9 gains 6 features, test 11 one. - RT range per channel (the first channel no longer spans only from its last mono-isotopic satellite, which dropped multiplets with rt_band > 0): FeatureFinderMultiplex 10 gains a singlet; MS1LabeledWorkflow 1-6 detect one more (unidentified) multiplet, which changes only feature ids (and the MBR log count, 7 -> 8 unidentified); ProteomicsLFQ 3 and 9 (seeds from FeatureFinderMultiplex) get a few more seeds, which changes ids and shifts a few quantities by < 0.5%. The satellite union, the overlap check and the joining of separately detected channels change none of the existing outputs. References that did not take the change as a patch (FeatureFinderMultiplex, two of ProteomicsLFQ 3) were regenerated, keeping their input names and version strings. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MS1LabeledWorkflow join: same sequence, settled identifications; resolver: own isotopes only by proximity Review of OpenMS#10781: - joinChannelsOfIdentifiedPeptides_ compared only charge and expected channel m/z, so partials identified as different peptides of the same composition (e.g. LVNELTEFAK / VLNELTEFAK) were joined. The unlabelled sequences (other modifications kept) now have to match as well. - The join ran before keepMultiAssignedOnClosest_, so a spectrum match the mapping had attached to several partials let the first of them (not the closest) take up the partner. Multi-assigned matches are now settled before the join (and again after the attachment, as before). - The resolver attributed every blacklisted peak within its tolerance of one of six isotopic positions of a detected channel to the multiplet, which also exempted another feature's peak exactly at the dummy (the light M+4 position is only ~9 ppm from a Lys4 channel). A peak now only counts as the multiplet's own if it is closer to one of those positions than to the dummy's. New TOPP fixture MS1LabeledWorkflow_9 covers both join cases (the previous version joined the two peptides and paired the heavy channel with a ten times stronger envelope 15 ppm off: H/L 0.09 instead of ~1); the resolver class test gains a peak of another feature exactly at the Lys4 channel. MS1LabeledWorkflow_7/8 references: only the order of two meta values changed ('map_index' is now registered before 'feature_id'). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] Drop the MultiplexResolver and MS1LabeledWorkflow changes from this PR On real data (PXD022659, three injections of a SILAC Lys8/Arg10 mix, MetaMorpheus PSMs, MS1LabeledWorkflow with knock_out and requantify), each of these changes was harmful on its own against develop: - two-sided overlap check in MultiplexResolverAlgorithm::isBlacklisted_: 95 fewer quantified peptide forms; the removed ratios were mostly fine; - overlap check for channels added for an identification: 519 fewer forms; the removed ratios were 94% within 1.5x of the mix ratio; - joining separately detected channels of an identified peptide: 59 more forms, but only 44% of the new ratios within 1.5x, and 96 of the 99 existing ratios it changed got worse. The overlap veto works on an anonymous blacklist and is too imprecise to be made stricter; these changes need a different design and go to a follow-up. Restores MultiplexResolverAlgorithm, MS1LabeledWorkflow and their tests to develop and removes the MS1LabeledWorkflow_8/9 fixtures. The Spearman and FeatureFinderMultiplex fixes stay. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] FeatureFinderMultiplex: channel ids for channels without a reported multiplet The channel ids were numbered over the column headers that existed at that point, i.e. the channels of reported multiplets only (since the header counts moved behind the abort check, a channel used only by aborted multiplets no longer has one). A channel without a reported multiplet then got its header later, without a channel id (ColumnHeader::getLabelAsUInt() returns 1 for it), and the ids of the following channels shifted down. The ids are now set after the headers of all configured channels exist, as the channel's index. Reported by CodeRabbit on OpenMS#10781. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] FeatureFinderMultiplex 5/6: consensusXML references with the exact Spearman cutoffs The featureXML references of these tests were updated for the exact Spearman cutoffs in 52e783c, but their consensusXML references still held the develop values of the doublet (light 1.7945e9, heavy 1.6043e9, H/L 0.894). The PR produces 1.7822e9 / 1.5389e9 / 0.863, matching the updated featureXML. The tests passed anyway because the element lines are whitelisted ("id=") and the centroid moves by 0.7%, below the 1% tolerance. Only the centroid and the two element lines change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MultiplexResolverAlgorithm: a channel must label every residue kind of its sample matchesResidues_() only checked the residue kinds that carry a label in a pattern channel. With [][Lys8,Arg10], the pattern for one K and no R (heavy channel {Lys8}) therefore accepted a light peptide with one K and one R: its R count was never compared. This put the other channel at a single-label shift (+8.014 instead of +18.022 Da): - expectedChannelMZs() (used by MS1LabeledWorkflow to attach identifications of undetected channels) returned the wrong channel m/z, - resolve() completed a light singlet of such a peptide with a dummy at the wrong position (re-quantified there by MS1LabeledWorkflow), and accepted a Lys8 doublet as that peptide, - checkIdentifications() agreed with such a doublet. Partially labelled peptidoforms (e.g. heavy R, light K) matched the single-label pattern the same way. A channel now has to carry, for every residue kind its sample labels, one label per residue of that kind, i.e. none if the peptide has none. The sample of a channel is the one in 'algorithm:labels' whose labels include the channel's labels (not its position, since the light SILAC sample can be implicit). Unlabelled channels impose nothing; Dimethyl, ICPL and numeric labels are still not counted. Residue kinds a sample does not label impose nothing either ([][Lys8] still shifts a K+R peptide by Lys8 only). On the PXD022659 data, this explains all four joined K+R peptides that got a partner at a single-label shift (LEELDADKAEMR, IEERHREMENAIK, TKEELEAEKR, and IDLGKANEPNHVELGR, whose only PSM in that run is the heavy-R/light-K form). Run 028 has 2242 PSMs of light K+R peptides and 525 partially labelled PSMs. No reference output changes: the only SILAC resolver fixture (MultiplexResolver_1) and the MS1LabeledWorkflow fixtures contain no peptide with both K and R; MultiplexResolver_2/4 (Dimethyl) and _3 (Leu3) are not affected. All resolver and workflow test outputs were compared with the previous build and are identical apart from unique ids. New class tests (fail before this change): a light K+R singlet is completed at the combined shift and a Lys8 doublet with that identification is a conflict; checkIdentifications() rejects it; expectedChannelMZs() gives the combined shift for duplex and triple SILAC and with an implicit light sample, no pattern for 2K+R beyond max_nr_labelled_aas, without K/R, or for a partially labelled peptide; K-only/R-only, [][Lys8] and Dimethyl are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FEATURE] Owner-aware multiplex blacklist: a missing channel is vetoed only by another peptide Until now the blacklist was anonymous. The resolver made a missing channel NaN, and so never re-quantified, whenever any reserved peak lay at its position. MS1LabeledWorkflow's re-quantification skipped every reserved peak, whoever had reserved it. On the PXD022659 data, 59% of those vetoes came from reservations no reported feature owns (clusters dropped by rt_min), and 16% from the peptide's own other channel. - MultiplexFiltering records, for every reserved peak, the filtered peak (pattern, index in the filter result) and the mass trace it was reserved for. They are written together with the role value in the serial accept steps, so they are the same for any number of threads. The new getter getBlacklistOwners() returns them aligned with getBlacklist(). The undefined blacklistPeak_(peak) declaration is removed. - FeatureFinderMultiplexAlgorithm maps each owner to the unique id of the feature of its channel in the reported multiplet of its cluster, or to 0 if the multiplet was not reported. The ids are recorded per (pattern, cluster, channel) inside generateMaps*_, not by position, since a channel can lack a feature and the provisional ids of aborted multiplets are reused. Each blacklist spectrum carries them as two IntegerDataArrays aligned with its peaks, "owner_unique_id_high" and "owner_unique_id_low" (the 32-bit halves of the UInt64 id). The arrays survive mzML. The wrong "per-pattern blacklist" comment is fixed. - MultiplexResolverAlgorithm gets public static helpers: hasBlacklistOwners(), blacklistOwner(), setBlacklistOwners(). It also gets one classification rule: ownerPeptides() and classifyBlacklistOwner() give orphan / own / same peptide / unidentified / other peptide, and isForeign() decides whether an owner vetoes. Same peptide means the same sequence without the labels of algorithm:labels, at the same charge. With owners: - lookup is two-sided; - only foreign owners (unidentified or other peptide) veto; - channels added for an identification (intensity 0, no uid), including complete multiplets, are checked as well; - a log line counts the vetoes, separately for missing channels and added channels, by owner class, the channels whose reserved peaks belong to no other peptide, and the vetoes the anonymous check would have given. Without owner arrays, behaviour is unchanged. - MS1LabeledWorkflow: - mergeFragments_ returns flank channel -> coinciding channel of the kept multiplet, and the blacklist owners of merged flanks are remapped to it; - requantifyChannel_ takes a reserved-peak filter, and requantifyMissingChannels_ skips only peaks with a foreign owner, using the resolver's classification; - a log line counts the reserved peaks it now uses, by owner. Tests: - resolver: owner arrays (64-bit round trip, sort, mzML), hasBlacklistOwners(), classification, and resolve with owners (orphan/own/same peptide -> 0, other peptide/unidentified -> NaN, anonymous -> NaN as before, a peak below the dummy counts only with owners, added channels in duplex and triplex); - FeatureFinderMultiplexAlgorithm: owners = reported feature uid per channel, orphans for a multiplet dropped by rt_min, profile path, per-cluster ids incl. a channel without a feature; - MultiplexFilteringCentroided: the same owners for 1/2/4/8 threads. Real data (run 028, RT 2400-3600 s): of 182 missing channels, 49 are not quantifiable (103 without owners); 38 of 295 added channels are newly not quantifiable. 203 channels lie on reservations of the same peptide or of no reported feature. 329 channels are re-quantified (307 before) and 61 are absent (67 before). Reference outputs: none changed. The MS1LabeledWorkflow test outputs are byte-identical to the previous build. Fixture 7 shows one triplex channel that the owner-aware check classifies as lying on its own multiplet's reservation; no veto changes, and no re-quantification uses a reserved peak. MultiplexResolver_4 uses an anonymous blacklist. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FEATURE] MS1LabeledWorkflow: -join_channels joins separately detected channels and re-measures them over common spectra When no spectrum holds a peptide's complete pattern, FeatureFinderMultiplex can report its channels as separate partial multiplets. mergeFragments_ does not merge them (neither is larger), and the resolver completes each with a dummy on the other's peaks, so the peptide gets no ratio. The first attempt to join them (660aac7, dropped in 3678944) paired the right channels in most cases on real data (PXD022659), but it kept the two FFM partial intensities. Those were measured over different spectra and isotope counts, so only 41 % of the joined ratios were within 1.5x of the mixing ratio. New option -join_channels (default false until measured on the full data): - Candidate search as in 660aac (after settling multi-assigned spectrum matches, before attaching IDs to undetected channels; same charge and CV, eluting at the identification, all channels among the missing ones, IDs of the same unlabelled peptide only). The m/z must now match the expected channel m/z within the detection tolerance (algorithm:mz_tolerance, 6 ppm) instead of id_mapping's 20 ppm, for the candidate and for the target's own channels. This removes the abundant other species at 14-18 ppm that caused most of the remaining wrong partners. - The most intense channel keeps its intensity. The channels of the other partial multiplet(s) are re-measured against it with requantifyChannel_ (paired peaks) over the union of the two channels' elution regions, with as many mass traces as both have. The joined channels' own reserved peaks are used: owner-aware blacklist, the same classification as the re-quantification. On the real data the paired ratio over the hull union was within 1.5x for 96 % of the joins. - A candidate with fewer than 6 spectra of paired peaks is not joined (accuracy 60 % with 3-5, 92 % with 6-9, 98 % with 10 or more paired spectra). - No elution-correlation gate: on the real data it did not separate good from bad joins (AUC 0.48-0.60). - requantifyChannel_ can report the number of paired spectra. FFM's centroided experiment is also kept when only the join needs it. With -join_channels false (the default) the code path and every existing test output are unchanged. Sanity check on one real run (PXD022659 run 028 alone, -join_channels true vs false): - 71 joins; 8 candidates rejected for too few paired spectra. - 24 peptide forms gained, all within 1.5x of 1:1. - 40 existing ratios changed: within 1.5x 98 % before, 100 % after. - 1 form lost: DLLFQALGR, which shared a light singlet with the isobaric LVFGFLNGR(Arg10). The singlet is now joined to LVFGFLNGR's light channel, the peptide of its best identification (H/L 0.87; the FFM intensities would give 2.9). Tests (all with -join_channels true): - MS1LabeledWorkflow_8 and _9: the fixtures of 660aac7, regenerated byte for byte by their generators. - 8: LVNELTEFAK is joined. H/L is now 0.956 (re-measured); 660aac kept the FFM intensities: 0.935. - 9: the composition-identical LVNELTEFAK/VLNELTEFAK are not joined. YVNDLAGHEK is joined to its exact light channel, not to the 10x envelope 15 ppm above it. H/L 0.955 (660aac: 0.928). - Against the 660aac references, only the joined channel's intensity and the ratios derived from it differ. - New MS1LabeledWorkflow_10, channels detected over very different elution regions: - TLSDYNIQK 1:1 (FFM hulls 4 s vs 26 s): FFM intensities would give H/L 3.0, re-measured 0.954. - ALVAYYQK 5:1: the narrow light channel is the reference, and the heavy one is re-measured from peaks it reserved itself: 0.191 instead of 0.60. Without the owner-aware filter it would not be joined. - VSFELFADK: light and heavy share only 5 spectra, so they are not joined. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FEATURE] MS1LabeledWorkflow: -targeted_quantification measures identified peptides that have no multiplet An identified peptide without a multiplet in the run (none detected, or its identifications fit none) was kept for protein inference only. With -targeted_quantification true (default false) it is measured from the MS1 peaks at the m/z it has in every channel, after the re-quantification and while the handles still name their channels: - Candidates: unassigned identifications with a target best hit whose labels fit a pattern (expectedChannelMZs), of a peptide (label-stripped sequence, charge, CV) that no resolved multiplet quantifies within algorithm:rt_typical of its elution region (abundances add up per peptide and charge, so nothing is measured twice). - Extraction: nearest peak within algorithm:mz_tolerance for isotopes 0-2 of every channel in the detection's centroided spectra, ID RT +/- algorithm:rt_typical, same CV. Peaks reserved for a multiplet of another identified peptide are left out; peaks of unidentified multiplets and orphans are used. - Boundaries: sum of all channels' first two isotopes, smoothed and split at minima with ElutionPeakDetection's smoothData/findLocalExtrema (detectPeaks itself fails on a split part of zeros only), trimmed to the positive smoothed region; the peak containing the ID, else the nearest within id_mapping:rt_tolerance. - Reference = the identified channel. It needs M0 and M1 in >= 3 spectra without a strong peak one isotope below (another envelope, the detection's zeroth-peak rule) and an isotope pattern that fits the sequence (Pearson >= algorithm:averagine_similarity). Its intensity is the trapezoid area of its isotope traces (PeakIntegrator, as the detection integrates), its RT the intensity-weighted mean of its monoisotopic peaks. - Other channels from paired peaks against it (pairedIntensity_, the kernel requantifyChannel_ now uses as well), reported if paired in >= 2 spectra and co-eluting (Pearson of the isotope-summed profiles >= algorithm:peptide_similarity); else 0 if nothing is there, not quantifiable (no handle) if something is. - One consensus feature per elution peak (m/z = lightest channel, setUniqueId, FAIMS_CV), carrying every identification of the peptide in that peak, moved out of the unassigned ones, with map_index = its own channel. The feature and these identifications get quantification_method = "targeted" (only the identifications' value survives linking). MultiplexResolverAlgorithm gets peptideKey() (the key ownerPeptides() uses, now shared) and a classifyBlacklistOwner() overload for a peptide without a multiplet. Tests: MultiplexResolverAlgorithm_test sections for both. New fixture MS1LabeledWorkflow_11 (synthetic SILAC duplex) with TOPP tests 11_targeted (log regex, consensusXML, QPX psm view) and 11_default. Its cases cover: a weak doublet (two IDs, one feature, H/L 0.95); an already quantified peptide; a decoy; an ID on another envelope's second isotope (conflict), rejected by the lower-isotope check; light only (heavy 0); a heavy buried under another identified peptide (not quantifiable); an unidentified doublet's peaks used (H/L 0.94); a non-co-eluting heavy (not quantifiable). Throwaway builds without the lower-isotope check, with unidentified owners skipped, with no reserved peak skipped, or without the co-elution gate each change exactly the case meant for it. No existing reference changed; the outputs of all existing MS1LabeledWorkflow test commands are byte-identical to the previous commit. Real data (PXD022659 run 028 alone, same options): identified forms quantified 38.7% -> 67.7% (+5194 cells, none lost); targeted cells 92.6% within 1.5x of the run median (detected 96.5%); on the 2465 targeted cells MetaMorpheus also quantifies, 93.9% vs MetaMorpheus' 83.2%. Runtime 7:39 vs 7:27 min. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] review fixes for OpenMS#10782: owner mode opt-in, no double counting, targeted conflicts Resolver (MultiplexResolverAlgorithm): - New parameter algorithm:use_blacklist_owners (default false). Without it the owner arrays FeatureFinderMultiplex now always writes are ignored, so MultiplexResolver, pyOpenMS resolve() and MS1LabeledWorkflow -requantify false keep the old semantics (a dummy left at 0 in owner mode only means "not occupied" and must be measured). MS1LabeledWorkflow sets it from -requantify and hides it from its resolver section. - isForeign() includes SAME_PEPTIDE: another multiplet of the same peptide is quantified itself, so it vetoes a missing channel instead of being re-quantified into it (counted twice). Merged flanks and joined partners are OWN and unaffected. MS1LabeledWorkflow: - Re-quantification and join use a reserved peak only if the measured channel reserved it itself or no reported feature did (mayUseReserved_). A missing channel is no longer measured from the multiplet's own isotopes (triple SILAC Lys4 medium on light M+4) nor from a same-peptide multiplet. - Targeted quantification: an ID whose channel lies on a quantified channel of another peptide's multiplet (near its elution region) is not measured; of targeted peaks of different peptides that read the same peaks only the best-scoring ID's is kept; an unidentified multiplet kept for match between runs whose peaks a targeted feature read is replaced by it. Tests: new TOPP tests MultiplexResolver_5(_owners), MS1LabeledWorkflow_9_default, _9_join_tolerance, _11_conflicts, _11_targeted_mbr, _12_reserved (new triple SILAC fixture: own-isotope dummy, orphan re-quantification, merged-flank remap); resolver class tests for the parameter and SAME_PEPTIDE. Six existing workflow log regexes contained ';', which CMake splits into alternative regexes (only one half was enforced); ';' replaced by '.'. No existing reference output changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] targeted quantification: other signals at a channel's position, MBR replacement, conflict pass MS1LabeledWorkflow -targeted_quantification (second review round, findings 1-3, 6, 7, 9, 12): - #1/#7: the peaks of an unidentified multiplet are used only if it can be the peptide (same charge and CV, every channel at one of the peptide's channels); otherwise they are left out like another peptide's, so the channel is not quantifiable. The owners a targeted feature records are only those of reserved peaks that entered a reported intensity (the reference, or a channel measured > 0), so an unidentified multiplet kept for match between runs is replaced only when it is the targeted peptide. Unrelated co-eluting multiplets stay. - #6: a non-identified channel's peak at an isotope (k >= 1, up to the isotopes the detection assigns to a channel) of another channel whose monoisotopic peak is in the spectrum is left out (e.g. Lys4 medium on the light M+4), so such a channel is not quantifiable (NaN) instead of measured from the other channel's isotopes. - #2: a non-identified channel on a quantified channel of another peptide's multiplet near its elution region is not quantifiable (its peaks are left out), as the identified channel already was. - #3: the conflict pass between targeted peaks uses only measured channels (intensity > 0), in both directions; the identified channel always is one. Tests: new TOPP tests MS1LabeledWorkflow_12_targeted (fixture 12 targeted, medium on light M+4 not quantifiable), _13_targeted and _13_targeted_mbr with a new synthetic duplex fixture 13 (unrelated unidentified doublet at a heavy m/z, kept for match between runs and identified by linking; another peptide's tail at a heavy m/z; a NaN channel at another targeted peptide's m/z; a worse-scoring identification that sorts first in map order and only reads the kept peak's identified channel (#9); a wrong isotope pattern (#12)). Each new test fails with the previous code; each fix fails at least one of them when reverted, except the reported-intensity filter of the recorded owners. No existing reference output changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] blacklist owners keep a reported multiplet, own-isotope positions not quantifiable, join on by default Owners of reserved peaks (MultiplexFiltering, FeatureFinderMultiplexAlgorithm): - A peak that another filtered peak reserved before keeps a record of the first writer and its mass trace (sparse map next to the last writer). getBlacklistOwners() returns both (BlacklistOwner{first, last}, BlacklistWriter per writer). FFM takes the first writer's feature if its multiplet was reported, else the last one's, else none. So a later pattern whose RT band reaches back over a reported multiplet's peaks and that is dropped no longer turns them into orphans. Blacklist values, detection and thread determinism are unchanged (owner arrays identical with 1 and 4 threads; with rt_band 0 identical to before). - Class test: rt_band 5, a doublet whose light channel outlasts the heavy one, followed by a dropped singlet on its tail: the overlapping peaks keep the doublet's light uid. The thread test compares both writers. Re-quantification (MS1LabeledWorkflow): - requantifyChannel_ returns NaN (not quantifiable) instead of 0 when the channel would have a value with the reserved peaks it skipped (pairedIntensity_ on all peaks at its position), e.g. a triplex medium channel on the light channel's own M+4. The log counts these separately from the absent channels. Fixture 12: the medium channels of SAGLEVDNVLGTSLEAPYNAPLLEK and TPELGSVDNALAYNGLSVEPLTAEK change from 0 to not quantifiable (reference updated). -join_channels is true by default: - Help text and documentation updated; TOPP_MS1LabeledWorkflow_9_default passes -join_channels false. - The 7_partial and fixture 12 references change only in the order of a consensus feature's meta values: the join strips the labels of a copy of each identified partial multiplet's hit, which registers the MS1Label meta value names before feature_id. Tests: - TOPP_MS1LabeledWorkflow_12_no_requantify: -requantify false runs the resolver without owners (FAIL regex "Blacklist with owners"; reference with LVNELTEFAK's light channel not quantifiable). - New fixture MS1LabeledWorkflow_14, TOPP_MS1LabeledWorkflow_14_join: a joined heavy channel is re-measured without the peaks an unidentified multiplet reserved at its position (H/L ~1, not ~1.25), and an identification on an envelope 12 ppm off its light channel is not joined to the exact heavy partial multiplet next to it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] targeted quantification: weigh another channel's isotope in a channel's peak; pin the owner remap, other-peptide and conflict rules Another channel's isotope at a channel's position (measureTargeted_): - A non-identified channel's peak at an isotope (k = 1..max of algorithm:isotopes_per_peptide - 1) of another channel is no longer left out on the m/z alone. The expected part of it (that channel's monoisotopic peak in the spectrum times I_k/I_0 of the identified sequence's isotope distribution) leaves it out only if it is at least 20 % of the peak; a smaller part is subtracted. So a triple Dimethyl heavy channel, 4 ppm from the medium's M+4 (~2 %), is measured again (it was not quantifiable whenever the medium was present); a Lys4 channel on the light M+4 of a 2.6 kDa peptide without medium signal stays not quantifiable. - New fixture MS1LabeledWorkflow_15 (triple Dimethyl), TOPP_MS1LabeledWorkflow_15_targeted: SVEDLAFGNYQR 1:1:1 with the medium's unresolved M+4/M+5 in the heavy peaks gives H/L ~1. Tests for rules that no test checked any more: - Other-peptide reserved peaks in the targeted path: in fixture 15, FTDNTDLFR's heavy m/z is the light M+1 of the identified triplex GDVTALFEQR; those reserved peaks are left out (heavy not quantifiable, not measured from them). - Owner remap of merged flanks: TOPP_MS1LabeledWorkflow_12_owners checks the owner counts of the fixture 12 log (without the remap the medium channel of TPELGSVDNALAYNGLSVEPLTAEK is vetoed instead, with the same consensusXML). - Reverse half of the targeted conflict pass: TOPP_MS1LabeledWorkflow_13_swapped runs fixture 13 with the scores of NVYDLGSEK and AHQQQQHR swapped (MS1LabeledWorkflow_13c.idXML); NVYDLGSEK's not quantifiable heavy channel at AHQQQQHR's identified channel does not drop it. - Test comments of fixtures 11 and 12 updated. No existing reference changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] targeted quantification: correct lower channels first, correct the identified channel, same-centroid overlap rule measureTargeted_ estimates the part of a lower channel's isotope in a channel's peak from that channel's monoisotopic peak. Three problems with it: - F1: the lower channel's monoisotopic peak was taken raw, so it could hold a third channel's isotope. In triple Dimethyl R-peptides of 1.95 kDa and up, the light M+4 sits in the medium M0, so the heavy lost an extra L*(I4/I0)^2 or was left out (2.5 kDa 1:1:1: heavy NaN; 1:0:0.5: H/L 0.478). Now the channels of each spectrum are corrected in ascending m/z, and each monoisotopic estimate is taken without the isotopes of the channels below it. This is the triangular case of the overlap system, so one pass solves it. It also holds when the lower channel is the identified one. - F2: the identified channel was never corrected, so H/L depended on which channel was identified (fixture 15 heavy ID: 1.018 vs 1.000 for the light ID). The expected part is now subtracted from the identified channel's peaks too, before they become the reference. If another channel's isotope makes up at least targeted_other_isotope_fraction_ of them, they stay the reference. The other channels' paired intensities cancel a constant reference error. But the identified channel's own intensity is then reported not quantifiable, as a non-identified channel would be, unless min_targeted_reference_spectra_ clean spectra are below that fraction. Dropping the reference spectra instead would lose the whole feature; reporting the value would carry an unbounded estimate error. A new log line counts such features. - F3: an overlap was corrected only within algorithm:mz_tolerance (6 ppm), a mass-accuracy window. The Dimethyl4/Lys4 channel on the light M+4 (0.0117 Da) stayed uncorrected below ~1.95 kDa, although at usual MS1 resolution (FWHM 14-30 ppm) it is unresolved. Now an isotope is part of a channel's peak if that peak is also the nearest peak to the isotope's m/z within twice the tolerance, i.e. the same centroid. Twice the tolerance is the window MultiplexFiltering uses to look for peaks of another envelope (and the workflow's lower-envelope check). A resolved, visible isotope has a centroid of its own and is not taken off its neighbour. Docs: quantifyTargeted_ describes the overlap rule, the ascending correction and the identified- channel rule; the -targeted_quantification help mentions the subtraction and the 20 % rule. Tests: fixture 15 regenerated (generator reproduces the old and the new files byte for byte). - Isotopes are merged within the FWHM at a resolution of 120,000 at m/z 200, instead of 7 ppm. The 7 ppm window sat between SVEDLAFGNYQR's two Dimethyl offsets (4.1, 8.2 ppm) and dropped the light M+4 although it is above the noise level. - Ten isotopes per species instead of six. - New light-ID cases: - SVEDLAFGNYQSVEDLAFGNYR 2.5 kDa 1:1:1 (chain: 17 % in both the medium and the heavy) - SVEDLAFGNYQGEDVTALFEQLR 1:0:0.25 and SVEDLAFGNYQGEDVTALFEQR 1:0:0.5, with the light M+4 at the medium's m/z - TALFEQLSVEDLAFGNYQGDR 1:2:1 (heavy 26 % medium M+4) - New tests 15_heavy_id and 15_medium_id (+_out1) run the same data with peptides identified as heavy or medium. The values agree with the light IDs within 0.3 %. TALFEQLSVEDLAFGNYQGDR's identified heavy is reported not quantifiable, M/L 2. Reference changes (MS1LabeledWorkflow_15_out.consensusXML; no other reference changed, all other outputs of the 89 MS1LabeledWorkflow tests are identical to fa3a1ee): - SVEDLAFGNYQR medium 1314428 -> 1314363. The new fixture merges the light M+4/M+5 into the medium M0/M1 (+1.8 %, which fa3a1ee keeps: 1338196); the new rule subtracts it. - SVEDLAFGNYQR heavy 1314363 -> 1314387. The medium estimate is now without the light M+4 (fa3a1ee subtracted an extra L*r4^2, -0.05 %); +0.002 % from the light M+8 now generated. - GDVTALFEQR (detected) medium +0.99 %, heavy +0.006 %, the same with both binaries. The generator merges the light M+4 (10 ppm) into the medium M0, and the detection does not correct overlaps. - New features for the four new peptides, protein abundances accordingly. Log counts: 6 features (7 measured, 1 absent, 4 not quantifiable), was 2 (2/1/1). Fail-before: - With the fa3a1ee binary, all six fixture-15 tests fail. - Mutants: - raw monoisotopic estimate: 15_targeted, 15_medium_id (+out1), 15_heavy_id_out1, 12_targeted (+out1) - identified channel uncorrected: 15_heavy_id (+out1), 15_medium_id_out1 - identified channel always reported: 15_heavy_id (+out1) - old 6 ppm criterion: the three fixture-15 _out1 tests Duplex Lys8/Arg10 (no channel within k <= 5 isotopes of another): the run-028 window with -targeted_quantification is identical except ids/dates. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] targeted quantification: a NaN identified channel still reads its peaks in the conflict pass; fall back to its measured peaks if the subtraction removes them Since the identified channel can be reported not quantifiable (NaN), two fixes in MS1LabeledWorkflow's targeted quantification: - One signal, one peptide: the conflict pass registered and checked only channels > 0. Two identifications on the same peaks whose identified channels were both NaN (e.g. heavy-identified isomers on a heavy that is mostly the medium's M+4) were both kept with identical values. A peak now reads its identified channel whatever its reported value (it is the reference of the other channels) besides its measured ones. - The subtraction of the other channels' isotopes is clamped at 0 and also applies to the identified channel. An unrelated peak at a lower channel's m/z, taken for that channel, could remove the identified channel's peaks in every spectrum, and the feature was lost with the channels the light-ID run measures. If the subtraction leaves the identified channel fewer than three reference spectra although its measured peaks have them, the subtracted part cannot be right: its peaks are used as measured (reference, isotope gate, RT, lower-envelope check, co-elution profile), and its own intensity is not quantifiable. Nothing changes for features that keep their reference spectra. Fixture 15 (triple Dimethyl) gains SVEDLAFGNYQGEDVTALR 1:0:1 with an unrelated co-eluting peak at the absent medium's m/z (light ID; heavy ID in _heavy.idXML) and, in _heavy.idXML, a worse-scored heavy isomer of TALFEQLSVEDLAFGNYQGDR. References: one new feature (L only, as with the light identification) and the protein that comes with it; in the heavy-ID run the isomer stays unassigned. Existing features unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [DOC] FeatureFinderMultiplexAlgorithm::getBlacklist: fix unresolved doxygen reference '@ref run:' made doxygen look up 'run:' (Doxygen_Warning_test failed on CI). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] MS1LabeledWorkflow: FAIMS fixture 19 (join, re-quantification, owners and targeted quantification per CV) MS1LabeledWorkflow_19 is fixture 8 acquired at two FAIMS compensation voltages (-45 V and -60 V, one MS1 spectrum per CV at every RT, both with the same RT), with the identifications at -45 V. A peptide's heavy channel at -60 V is not joined to its light partial multiplet at -45 V, the missing channels at -45 V are re-quantified from the -45 V spectra only and not vetoed or skipped because of peaks reserved at -60 V, and the targeted quantification measures at the CV of the identification. The samecv input (the same peaks with two heavy channels at -45 V) is the positive control: the join then gives fixture 8's values and the targeted quantification measures the heavy channel. Eight tests: _19_faims_split (+_out1), _19_faims_owners, _19_faims_samecv (+_out1), _19_faims_targeted (+_out1), _19_faims_samecv_targeted. Every test fails for at least one scratch mutant that drops a CV check: the join candidate CV check, the CV match of the blacklist spectrum lookup, the CV filters of the re-quantification and of the targeted measurement, the candidate's CV, and both CV checks of MultiplexResolverAlgorithm (owner check and plain blacklist check). The inputs were generated from fixture 8's peaks by a stand-alone script that is not part of the repository. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [DOC] MultiplexFiltering, FeatureFinderMultiplexAlgorithm, MS1LabeledWorkflow: limits of blacklist owners and channel joins Only the first and the last filtered peak that reserved a peak are recorded: a reported multiplet that reserved it in between loses it when the clusters of both are dropped, and the peak then counts as reserved by no reported feature. That needs at least three writers of one peak, in practice only with algorithm:rt_band > 0. Stated at MultiplexFiltering::getBlacklistOwners() and applyBlacklistEntries_(), in the provisionalOwners() comment, in FeatureFinderMultiplexAlgorithm::getBlacklist() (whose rule for peaks reserved by several patterns is corrected: the first one if its multiplet was reported, else the last one) and briefly in the description of algorithm:use_blacklist_owners. joinChannelsOfIdentifiedPeptides_: a partner is joined to one partial multiplet only; another identified partial multiplet of the same channels that it spans keeps its own multiplet, in which the partner's channel is not quantifiable, so the summed channel abundances miss the partner channel's share of it (or, if the partner was the reference, count its share of the identified channels twice). No behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MultiplexFiltering, FeatureFinderMultiplexAlgorithm: store blacklist owners compactly The owner bookkeeping of the blacklist cost memory in proportion to the number of reserved peaks, which grows strongly with algorithm:rt_band > 0 (a pattern reserves its mass traces over the RT band, so many peaks are reserved several times): - MultiplexFiltering: the first owner of a peak reserved by more than one filtered peak was kept in an unordered_map (one node per such peak, plus a hash lookup on every overwrite). blacklist_owner_ now encodes the owners itself: -1 not reserved, >= 0 the only filtered peak that reserved the peak, <= -2 the index (-2 - value) of a record {first, first_value, last} in blacklist_owner_records_. The record is created when another filtered peak reserves the peak for the first time, so the first owner and its value are the same as with the map; later writers only update record.last. O(1) per write, no hash map. - filtered_peaks_ and BlacklistWriter store the peak index as unsigned instead of size_t (BlacklistWriter shrinks from 24 to 12 bytes). Owners and records are indexed by int, so applyBlacklistEntries_() throws Exception::InvalidSize before the filtered peaks, or the records, would exceed INT_MAX (one check per filtered peak; documented). - New getBlacklistOwners(Size spectrum_index) returns the owners of one spectrum. FeatureFinderMultiplexAlgorithm reads them spectrum by spectrum after generating the maps (centroided and profile branch), instead of holding a full copy of all owners (getBlacklistOwners()) during clustering and map generation. getBlacklistOwners() stays as a convenience for the class test. What is recorded and reported does not change: only the first and the last writer of a peak, as documented. Outputs are unchanged: on an RT slice (25-37 min, MS1 only) of PXD022659 run 099 with the FeatureFinderMultiplex parameters of the runtime measurement plus -test -out_blacklist, featureXML, consensusXML and the blacklist mzML (including owner_unique_id_high/low) are byte-identical to before at rt_band 0 and 5, and so are the logs apart from timings. Peak RSS on that slice (1 thread, without -out_blacklist as in the runtime measurement): rt_band 0: develop 197.3, before 213.6, now 206.1 MiB; rt_band 5: develop 241.0, before 288.3, now 259.5 MiB. MultiplexFilteringCentroided_test additionally checks that getBlacklistOwners(Size) matches getBlacklistOwners() and throws for an index past the last spectrum. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] MultiplexFiltering: pin the first and the last blacklist owner of a peak MultiplexFilteringCentroided_test gets a section that reserves peaks of two spectra by hand (applyBlacklistEntries_() through a derived tester) for three filtered peaks A, B and C, and checks getBlacklistOwners() against hand-computed owners: a single writer is first and last owner; A rewriting its own peak adds no record, and the mass trace it leaves is the one kept for the first owner; of three writers, A (first) and C (last) are kept and B is dropped; a second record in the second spectrum; the number of records after each writer; getBlacklistOwners(Size) and its IndexOverflow; alignment with getBlacklist() across a white peak. Every expected writer has a nonzero mass trace, so none of them equals a value-initialized BlacklistWriter. A list of the wrong size fails its size check and skips only the checks of its entries, not the independent checks after it. It replaces the check in the threads section that compared getBlacklistOwners(s) with getBlacklistOwners()[s], which could not fail since the latter is built from the former. MultiplexFiltering.h: the doc of applyBlacklistEntries_() put the last owner in blacklist_owner_; once a peak has a record, the record holds it. Each of these mutants of MultiplexFiltering.cpp fails the new section: the record's first value taken from the new entry; record.last not updated; a record also on an own rewrite; no records at all; every record addressed as the first one; the first owner's mass trace read from the current value; the per-spectrum owners stopping at the first white peak; record.first set to the new owner. Six of them pass the rest of the test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [DOC] MS1LabeledWorkflow: correct the example of a split elution in the join's doc joinChannelsOfIdentifiedPeptides_: the one observed case of a partner that spans two identified partial multiplets is a light elution split in m/z because its centroids scatter by more than the detection's m/z tolerance (8.1 ppm between the two partials, tolerance 6 ppm), not a split within that tolerance as the doc said. No behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ --------- Co-authored-by: Claude <[email protected]>
…nel intensities (OpenMS#10786) * [FIX] FeatureFinderMultiplex/MultiplexResolver: exact Spearman cutoffs, two-sided overlap check, satellite union, per-channel RT range Defects found while checking the SILAC attrition report in PhilRe99/openms_silac_nextflow#6 (mirrored in #10775): - Math::rankCorrelationCoefficient took two square roots, so an exact correlation of 0.5 came out as 0.49999999999999989 and failed the 'peptide_similarity' (0.5) cutoff in MultiplexFiltering; 0.4 failed 'averagine_similarity' the same way. With three isotopes this meant light and heavy needed identical intensity rank order. Now one square root of the product, as in pearsonCorrelationCoefficient. - MultiplexResolverAlgorithm::isBlacklisted_ looked only at the first blacklisted peak at or above the dummy's m/z (MZBegin), so a peak just below it was missed and the channel reported as absent (0) instead of not quantifiable (NaN). Now MSSpectrum::findNearest within tolerance. - generateMapsCentroided_ stopped collecting a point's satellites at the first duplicate ('break'), dropping the later unique ones (reachable with rt_band > 0). Now skips only the duplicate. - determinePeptideIntensities{Centroided,Profile}_ started rt_min/rt_max at 0 and only reset them for the first mono-isotopic satellite, so the 'rt_min' duration check never applied to later channels and used only the last mono-isotopic RT of the first one. Now a proper min/max per channel. - Column header sizes were incremented before a later channel could abort the multiplet. Now counted for reported multiplets only. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MultiplexResolver/MS1LabeledWorkflow: overlap check ignores the multiplet's own isotopes, applies to added channels; join separately detected channels - The two-sided blacklist lookup made the multiplet's own isotopic peaks veto its missing channels: the light M+4 peak lies ~9 ppm below a Lys4 (or Dimethyl4) channel (4.0251 Da vs. 4 x 1.0034 Da), so e.g. the re-quantified medium channel of a light-detected triplex became NaN. isBlacklisted_ now skips blacklisted peaks at the first six isotopic positions of the multiplet's detected channels (those the detection follows by default) and checks every blacklisted peak within the tolerance on either side, keeping the strict '<' boundary. - A channel added to a multiplet for an identification of it (MS1LabeledWorkflow attachToUndetectedChannels_: intensity 0, no unique id) skipped the overlap check, because the multiplet looked complete (duplex) or the handle was copied as detected (triplex). It is now checked like a missing channel (PhilRe99/openms_silac_nextflow#9). - MS1LabeledWorkflow: when no spectrum holds a peptide's complete pattern, its channels can be detected separately (partial multiplets). mergeFragments_ never merges two such partials (neither is larger), and the resolver completed each with a dummy on the other's blacklisted peaks, so the peptide got no ratio. joinChannelsOfIdentifiedPeptides_ lets an identified partial multiplet take up the partials at the m/z its peptide has in the missing channels (same charge and CV, eluting at the identification within the id_mapping tolerances, identifications of the same peptide only). Synthetic fixture MS1LabeledWorkflow_8. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] Update reference outputs for the Spearman cutoff and per-channel RT range fixes Each change was traced to one fix by applying the fixes one at a time on top of develop (on which all of these tests pass): - Spearman (exact 0.5 / 0.4 no longer rejected): FeatureFinderMultiplex 4, 5, 6, 9, 11. More seeds pass the filters, so some intensities and ratios change and test 9 gains 6 features, test 11 one. - RT range per channel (the first channel no longer spans only from its last mono-isotopic satellite, which dropped multiplets with rt_band > 0): FeatureFinderMultiplex 10 gains a singlet; MS1LabeledWorkflow 1-6 detect one more (unidentified) multiplet, which changes only feature ids (and the MBR log count, 7 -> 8 unidentified); ProteomicsLFQ 3 and 9 (seeds from FeatureFinderMultiplex) get a few more seeds, which changes ids and shifts a few quantities by < 0.5%. The satellite union, the overlap check and the joining of separately detected channels change none of the existing outputs. References that did not take the change as a patch (FeatureFinderMultiplex, two of ProteomicsLFQ 3) were regenerated, keeping their input names and version strings. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MS1LabeledWorkflow join: same sequence, settled identifications; resolver: own isotopes only by proximity Review of #10781: - joinChannelsOfIdentifiedPeptides_ compared only charge and expected channel m/z, so partials identified as different peptides of the same composition (e.g. LVNELTEFAK / VLNELTEFAK) were joined. The unlabelled sequences (other modifications kept) now have to match as well. - The join ran before keepMultiAssignedOnClosest_, so a spectrum match the mapping had attached to several partials let the first of them (not the closest) take up the partner. Multi-assigned matches are now settled before the join (and again after the attachment, as before). - The resolver attributed every blacklisted peak within its tolerance of one of six isotopic positions of a detected channel to the multiplet, which also exempted another feature's peak exactly at the dummy (the light M+4 position is only ~9 ppm from a Lys4 channel). A peak now only counts as the multiplet's own if it is closer to one of those positions than to the dummy's. New TOPP fixture MS1LabeledWorkflow_9 covers both join cases (the previous version joined the two peptides and paired the heavy channel with a ten times stronger envelope 15 ppm off: H/L 0.09 instead of ~1); the resolver class test gains a peak of another feature exactly at the Lys4 channel. MS1LabeledWorkflow_7/8 references: only the order of two meta values changed ('map_index' is now registered before 'feature_id'). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] Drop the MultiplexResolver and MS1LabeledWorkflow changes from this PR On real data (PXD022659, three injections of a SILAC Lys8/Arg10 mix, MetaMorpheus PSMs, MS1LabeledWorkflow with knock_out and requantify), each of these changes was harmful on its own against develop: - two-sided overlap check in MultiplexResolverAlgorithm::isBlacklisted_: 95 fewer quantified peptide forms; the removed ratios were mostly fine; - overlap check for channels added for an identification: 519 fewer forms; the removed ratios were 94% within 1.5x of the mix ratio; - joining separately detected channels of an identified peptide: 59 more forms, but only 44% of the new ratios within 1.5x, and 96 of the 99 existing ratios it changed got worse. The overlap veto works on an anonymous blacklist and is too imprecise to be made stricter; these changes need a different design and go to a follow-up. Restores MultiplexResolverAlgorithm, MS1LabeledWorkflow and their tests to develop and removes the MS1LabeledWorkflow_8/9 fixtures. The Spearman and FeatureFinderMultiplex fixes stay. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] FeatureFinderMultiplex: channel ids for channels without a reported multiplet The channel ids were numbered over the column headers that existed at that point, i.e. the channels of reported multiplets only (since the header counts moved behind the abort check, a channel used only by aborted multiplets no longer has one). A channel without a reported multiplet then got its header later, without a channel id (ColumnHeader::getLabelAsUInt() returns 1 for it), and the ids of the following channels shifted down. The ids are now set after the headers of all configured channels exist, as the channel's index. Reported by CodeRabbit on #10781. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] FeatureFinderMultiplex 5/6: consensusXML references with the exact Spearman cutoffs The featureXML references of these tests were updated for the exact Spearman cutoffs in 52e783c3b2, but their consensusXML references still held the develop values of the doublet (light 1.7945e9, heavy 1.6043e9, H/L 0.894). The PR produces 1.7822e9 / 1.5389e9 / 0.863, matching the updated featureXML. The tests passed anyway because the element lines are whitelisted ("id=") and the centroid moves by 0.7%, below the 1% tolerance. Only the centroid and the two element lines change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MultiplexResolverAlgorithm: a channel must label every residue kind of its sample matchesResidues_() only checked the residue kinds that carry a label in a pattern channel. With [][Lys8,Arg10], the pattern for one K and no R (heavy channel {Lys8}) therefore accepted a light peptide with one K and one R: its R count was never compared. This put the other channel at a single-label shift (+8.014 instead of +18.022 Da): - expectedChannelMZs() (used by MS1LabeledWorkflow to attach identifications of undetected channels) returned the wrong channel m/z, - resolve() completed a light singlet of such a peptide with a dummy at the wrong position (re-quantified there by MS1LabeledWorkflow), and accepted a Lys8 doublet as that peptide, - checkIdentifications() agreed with such a doublet. Partially labelled peptidoforms (e.g. heavy R, light K) matched the single-label pattern the same way. A channel now has to carry, for every residue kind its sample labels, one label per residue of that kind, i.e. none if the peptide has none. The sample of a channel is the one in 'algorithm:labels' whose labels include the channel's labels (not its position, since the light SILAC sample can be implicit). Unlabelled channels impose nothing; Dimethyl, ICPL and numeric labels are still not counted. Residue kinds a sample does not label impose nothing either ([][Lys8] still shifts a K+R peptide by Lys8 only). On the PXD022659 data, this explains all four joined K+R peptides that got a partner at a single-label shift (LEELDADKAEMR, IEERHREMENAIK, TKEELEAEKR, and IDLGKANEPNHVELGR, whose only PSM in that run is the heavy-R/light-K form). Run 028 has 2242 PSMs of light K+R peptides and 525 partially labelled PSMs. No reference output changes: the only SILAC resolver fixture (MultiplexResolver_1) and the MS1LabeledWorkflow fixtures contain no peptide with both K and R; MultiplexResolver_2/4 (Dimethyl) and _3 (Leu3) are not affected. All resolver and workflow test outputs were compared with the previous build and are identical apart from unique ids. New class tests (fail before this change): a light K+R singlet is completed at the combined shift and a Lys8 doublet with that identification is a conflict; checkIdentifications() rejects it; expectedChannelMZs() gives the combined shift for duplex and triple SILAC and with an implicit light sample, no pattern for 2K+R beyond max_nr_labelled_aas, without K/R, or for a partially labelled peptide; K-only/R-only, [][Lys8] and Dimethyl are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FEATURE] Owner-aware multiplex blacklist: a missing channel is vetoed only by another peptide Until now the blacklist was anonymous. The resolver made a missing channel NaN, and so never re-quantified, whenever any reserved peak lay at its position. MS1LabeledWorkflow's re-quantification skipped every reserved peak, whoever had reserved it. On the PXD022659 data, 59% of those vetoes came from reservations no reported feature owns (clusters dropped by rt_min), and 16% from the peptide's own other channel. - MultiplexFiltering records, for every reserved peak, the filtered peak (pattern, index in the filter result) and the mass trace it was reserved for. They are written together with the role value in the serial accept steps, so they are the same for any number of threads. The new getter getBlacklistOwners() returns them aligned with getBlacklist(). The undefined blacklistPeak_(peak) declaration is removed. - FeatureFinderMultiplexAlgorithm maps each owner to the unique id of the feature of its channel in the reported multiplet of its cluster, or to 0 if the multiplet was not reported. The ids are recorded per (pattern, cluster, channel) inside generateMaps*_, not by position, since a channel can lack a feature and the provisional ids of aborted multiplets are reused. Each blacklist spectrum carries them as two IntegerDataArrays aligned with its peaks, "owner_unique_id_high" and "owner_unique_id_low" (the 32-bit halves of the UInt64 id). The arrays survive mzML. The wrong "per-pattern blacklist" comment is fixed. - MultiplexResolverAlgorithm gets public static helpers: hasBlacklistOwners(), blacklistOwner(), setBlacklistOwners(). It also gets one classification rule: ownerPeptides() and classifyBlacklistOwner() give orphan / own / same peptide / unidentified / other peptide, and isForeign() decides whether an owner vetoes. Same peptide means the same sequence without the labels of algorithm:labels, at the same charge. With owners: - lookup is two-sided; - only foreign owners (unidentified or other peptide) veto; - channels added for an identification (intensity 0, no uid), including complete multiplets, are checked as well; - a log line counts the vetoes, separately for missing channels and added channels, by owner class, the channels whose reserved peaks belong to no other peptide, and the vetoes the anonymous check would have given. Without owner arrays, behaviour is unchanged. - MS1LabeledWorkflow: - mergeFragments_ returns flank channel -> coinciding channel of the kept multiplet, and the blacklist owners of merged flanks are remapped to it; - requantifyChannel_ takes a reserved-peak filter, and requantifyMissingChannels_ skips only peaks with a foreign owner, using the resolver's classification; - a log line counts the reserved peaks it now uses, by owner. Tests: - resolver: owner arrays (64-bit round trip, sort, mzML), hasBlacklistOwners(), classification, and resolve with owners (orphan/own/same peptide -> 0, other peptide/unidentified -> NaN, anonymous -> NaN as before, a peak below the dummy counts only with owners, added channels in duplex and triplex); - FeatureFinderMultiplexAlgorithm: owners = reported feature uid per channel, orphans for a multiplet dropped by rt_min, profile path, per-cluster ids incl. a channel without a feature; - MultiplexFilteringCentroided: the same owners for 1/2/4/8 threads. Real data (run 028, RT 2400-3600 s): of 182 missing channels, 49 are not quantifiable (103 without owners); 38 of 295 added channels are newly not quantifiable. 203 channels lie on reservations of the same peptide or of no reported feature. 329 channels are re-quantified (307 before) and 61 are absent (67 before). Reference outputs: none changed. The MS1LabeledWorkflow test outputs are byte-identical to the previous build. Fixture 7 shows one triplex channel that the owner-aware check classifies as lying on its own multiplet's reservation; no veto changes, and no re-quantification uses a reserved peak. MultiplexResolver_4 uses an anonymous blacklist. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FEATURE] MS1LabeledWorkflow: -join_channels joins separately detected channels and re-measures them over common spectra When no spectrum holds a peptide's complete pattern, FeatureFinderMultiplex can report its channels as separate partial multiplets. mergeFragments_ does not merge them (neither is larger), and the resolver completes each with a dummy on the other's peaks, so the peptide gets no ratio. The first attempt to join them (660aac7453, dropped in 3678944043) paired the right channels in most cases on real data (PXD022659), but it kept the two FFM partial intensities. Those were measured over different spectra and isotope counts, so only 41 % of the joined ratios were within 1.5x of the mixing ratio. New option -join_channels (default false until measured on the full data): - Candidate search as in 660aac (after settling multi-assigned spectrum matches, before attaching IDs to undetected channels; same charge and CV, eluting at the identification, all channels among the missing ones, IDs of the same unlabelled peptide only). The m/z must now match the expected channel m/z within the detection tolerance (algorithm:mz_tolerance, 6 ppm) instead of id_mapping's 20 ppm, for the candidate and for the target's own channels. This removes the abundant other species at 14-18 ppm that caused most of the remaining wrong partners. - The most intense channel keeps its intensity. The channels of the other partial multiplet(s) are re-measured against it with requantifyChannel_ (paired peaks) over the union of the two channels' elution regions, with as many mass traces as both have. The joined channels' own reserved peaks are used: owner-aware blacklist, the same classification as the re-quantification. On the real data the paired ratio over the hull union was within 1.5x for 96 % of the joins. - A candidate with fewer than 6 spectra of paired peaks is not joined (accuracy 60 % with 3-5, 92 % with 6-9, 98 % with 10 or more paired spectra). - No elution-correlation gate: on the real data it did not separate good from bad joins (AUC 0.48-0.60). - requantifyChannel_ can report the number of paired spectra. FFM's centroided experiment is also kept when only the join needs it. With -join_channels false (the default) the code path and every existing test output are unchanged. Sanity check on one real run (PXD022659 run 028 alone, -join_channels true vs false): - 71 joins; 8 candidates rejected for too few paired spectra. - 24 peptide forms gained, all within 1.5x of 1:1. - 40 existing ratios changed: within 1.5x 98 % before, 100 % after. - 1 form lost: DLLFQALGR, which shared a light singlet with the isobaric LVFGFLNGR(Arg10). The singlet is now joined to LVFGFLNGR's light channel, the peptide of its best identification (H/L 0.87; the FFM intensities would give 2.9). Tests (all with -join_channels true): - MS1LabeledWorkflow_8 and _9: the fixtures of 660aac7453, regenerated byte for byte by their generators. - 8: LVNELTEFAK is joined. H/L is now 0.956 (re-measured); 660aac kept the FFM intensities: 0.935. - 9: the composition-identical LVNELTEFAK/VLNELTEFAK are not joined. YVNDLAGHEK is joined to its exact light channel, not to the 10x envelope 15 ppm above it. H/L 0.955 (660aac: 0.928). - Against the 660aac references, only the joined channel's intensity and the ratios derived from it differ. - New MS1LabeledWorkflow_10, channels detected over very different elution regions: - TLSDYNIQK 1:1 (FFM hulls 4 s vs 26 s): FFM intensities would give H/L 3.0, re-measured 0.954. - ALVAYYQK 5:1: the narrow light channel is the reference, and the heavy one is re-measured from peaks it reserved itself: 0.191 instead of 0.60. Without the owner-aware filter it would not be joined. - VSFELFADK: light and heavy share only 5 spectra, so they are not joined. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FEATURE] MS1LabeledWorkflow: -targeted_quantification measures identified peptides that have no multiplet An identified peptide without a multiplet in the run (none detected, or its identifications fit none) was kept for protein inference only. With -targeted_quantification true (default false) it is measured from the MS1 peaks at the m/z it has in every channel, after the re-quantification and while the handles still name their channels: - Candidates: unassigned identifications with a target best hit whose labels fit a pattern (expectedChannelMZs), of a peptide (label-stripped sequence, charge, CV) that no resolved multiplet quantifies within algorithm:rt_typical of its elution region (abundances add up per peptide and charge, so nothing is measured twice). - Extraction: nearest peak within algorithm:mz_tolerance for isotopes 0-2 of every channel in the detection's centroided spectra, ID RT +/- algorithm:rt_typical, same CV. Peaks reserved for a multiplet of another identified peptide are left out; peaks of unidentified multiplets and orphans are used. - Boundaries: sum of all channels' first two isotopes, smoothed and split at minima with ElutionPeakDetection's smoothData/findLocalExtrema (detectPeaks itself fails on a split part of zeros only), trimmed to the positive smoothed region; the peak containing the ID, else the nearest within id_mapping:rt_tolerance. - Reference = the identified channel. It needs M0 and M1 in >= 3 spectra without a strong peak one isotope below (another envelope, the detection's zeroth-peak rule) and an isotope pattern that fits the sequence (Pearson >= algorithm:averagine_similarity). Its intensity is the trapezoid area of its isotope traces (PeakIntegrator, as the detection integrates), its RT the intensity-weighted mean of its monoisotopic peaks. - Other channels from paired peaks against it (pairedIntensity_, the kernel requantifyChannel_ now uses as well), reported if paired in >= 2 spectra and co-eluting (Pearson of the isotope-summed profiles >= algorithm:peptide_similarity); else 0 if nothing is there, not quantifiable (no handle) if something is. - One consensus feature per elution peak (m/z = lightest channel, setUniqueId, FAIMS_CV), carrying every identification of the peptide in that peak, moved out of the unassigned ones, with map_index = its own channel. The feature and these identifications get quantification_method = "targeted" (only the identifications' value survives linking). MultiplexResolverAlgorithm gets peptideKey() (the key ownerPeptides() uses, now shared) and a classifyBlacklistOwner() overload for a peptide without a multiplet. Tests: MultiplexResolverAlgorithm_test sections for both. New fixture MS1LabeledWorkflow_11 (synthetic SILAC duplex) with TOPP tests 11_targeted (log regex, consensusXML, QPX psm view) and 11_default. Its cases cover: a weak doublet (two IDs, one feature, H/L 0.95); an already quantified peptide; a decoy; an ID on another envelope's second isotope (conflict), rejected by the lower-isotope check; light only (heavy 0); a heavy buried under another identified peptide (not quantifiable); an unidentified doublet's peaks used (H/L 0.94); a non-co-eluting heavy (not quantifiable). Throwaway builds without the lower-isotope check, with unidentified owners skipped, with no reserved peak skipped, or without the co-elution gate each change exactly the case meant for it. No existing reference changed; the outputs of all existing MS1LabeledWorkflow test commands are byte-identical to the previous commit. Real data (PXD022659 run 028 alone, same options): identified forms quantified 38.7% -> 67.7% (+5194 cells, none lost); targeted cells 92.6% within 1.5x of the run median (detected 96.5%); on the 2465 targeted cells MetaMorpheus also quantifies, 93.9% vs MetaMorpheus' 83.2%. Runtime 7:39 vs 7:27 min. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] review fixes for #10782: owner mode opt-in, no double counting, targeted conflicts Resolver (MultiplexResolverAlgorithm): - New parameter algorithm:use_blacklist_owners (default false). Without it the owner arrays FeatureFinderMultiplex now always writes are ignored, so MultiplexResolver, pyOpenMS resolve() and MS1LabeledWorkflow -requantify false keep the old semantics (a dummy left at 0 in owner mode only means "not occupied" and must be measured). MS1LabeledWorkflow sets it from -requantify and hides it from its resolver section. - isForeign() includes SAME_PEPTIDE: another multiplet of the same peptide is quantified itself, so it vetoes a missing channel instead of being re-quantified into it (counted twice). Merged flanks and joined partners are OWN and unaffected. MS1LabeledWorkflow: - Re-quantification and join use a reserved peak only if the measured channel reserved it itself or no reported feature did (mayUseReserved_). A missing channel is no longer measured from the multiplet's own isotopes (triple SILAC Lys4 medium on light M+4) nor from a same-peptide multiplet. - Targeted quantification: an ID whose channel lies on a quantified channel of another peptide's multiplet (near its elution region) is not measured; of targeted peaks of different peptides that read the same peaks only the best-scoring ID's is kept; an unidentified multiplet kept for match between runs whose peaks a targeted feature read is replaced by it. Tests: new TOPP tests MultiplexResolver_5(_owners), MS1LabeledWorkflow_9_default, _9_join_tolerance, _11_conflicts, _11_targeted_mbr, _12_reserved (new triple SILAC fixture: own-isotope dummy, orphan re-quantification, merged-flank remap); resolver class tests for the parameter and SAME_PEPTIDE. Six existing workflow log regexes contained ';', which CMake splits into alternative regexes (only one half was enforced); ';' replaced by '.'. No existing reference output changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] targeted quantification: other signals at a channel's position, MBR replacement, conflict pass MS1LabeledWorkflow -targeted_quantification (second review round, findings 1-3, 6, 7, 9, 12): - #1/#7: the peaks of an unidentified multiplet are used only if it can be the peptide (same charge and CV, every channel at one of the peptide's channels); otherwise they are left out like another peptide's, so the channel is not quantifiable. The owners a targeted feature records are only those of reserved peaks that entered a reported intensity (the reference, or a channel measured > 0), so an unidentified multiplet kept for match between runs is replaced only when it is the targeted peptide. Unrelated co-eluting multiplets stay. - #6: a non-identified channel's peak at an isotope (k >= 1, up to the isotopes the detection assigns to a channel) of another channel whose monoisotopic peak is in the spectrum is left out (e.g. Lys4 medium on the light M+4), so such a channel is not quantifiable (NaN) instead of measured from the other channel's isotopes. - #2: a non-identified channel on a quantified channel of another peptide's multiplet near its elution region is not quantifiable (its peaks are left out), as the identified channel already was. - #3: the conflict pass between targeted peaks uses only measured channels (intensity > 0), in both directions; the identified channel always is one. Tests: new TOPP tests MS1LabeledWorkflow_12_targeted (fixture 12 targeted, medium on light M+4 not quantifiable), _13_targeted and _13_targeted_mbr with a new synthetic duplex fixture 13 (unrelated unidentified doublet at a heavy m/z, kept for match between runs and identified by linking; another peptide's tail at a heavy m/z; a NaN channel at another targeted peptide's m/z; a worse-scoring identification that sorts first in map order and only reads the kept peak's identified channel (#9); a wrong isotope pattern (#12)). Each new test fails with the previous code; each fix fails at least one of them when reverted, except the reported-intensity filter of the recorded owners. No existing reference output changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] blacklist owners keep a reported multiplet, own-isotope positions not quantifiable, join on by default Owners of reserved peaks (MultiplexFiltering, FeatureFinderMultiplexAlgorithm): - A peak that another filtered peak reserved before keeps a record of the first writer and its mass trace (sparse map next to the last writer). getBlacklistOwners() returns both (BlacklistOwner{first, last}, BlacklistWriter per writer). FFM takes the first writer's feature if its multiplet was reported, else the last one's, else none. So a later pattern whose RT band reaches back over a reported multiplet's peaks and that is dropped no longer turns them into orphans. Blacklist values, detection and thread determinism are unchanged (owner arrays identical with 1 and 4 threads; with rt_band 0 identical to before). - Class test: rt_band 5, a doublet whose light channel outlasts the heavy one, followed by a dropped singlet on its tail: the overlapping peaks keep the doublet's light uid. The thread test compares both writers. Re-quantification (MS1LabeledWorkflow): - requantifyChannel_ returns NaN (not quantifiable) instead of 0 when the channel would have a value with the reserved peaks it skipped (pairedIntensity_ on all peaks at its position), e.g. a triplex medium channel on the light channel's own M+4. The log counts these separately from the absent channels. Fixture 12: the medium channels of SAGLEVDNVLGTSLEAPYNAPLLEK and TPELGSVDNALAYNGLSVEPLTAEK change from 0 to not quantifiable (reference updated). -join_channels is true by default: - Help text and documentation updated; TOPP_MS1LabeledWorkflow_9_default passes -join_channels false. - The 7_partial and fixture 12 references change only in the order of a consensus feature's meta values: the join strips the labels of a copy of each identified partial multiplet's hit, which registers the MS1Label meta value names before feature_id. Tests: - TOPP_MS1LabeledWorkflow_12_no_requantify: -requantify false runs the resolver without owners (FAIL regex "Blacklist with owners"; reference with LVNELTEFAK's light channel not quantifiable). - New fixture MS1LabeledWorkflow_14, TOPP_MS1LabeledWorkflow_14_join: a joined heavy channel is re-measured without the peaks an unidentified multiplet reserved at its position (H/L ~1, not ~1.25), and an identification on an envelope 12 ppm off its light channel is not joined to the exact heavy partial multiplet next to it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] targeted quantification: weigh another channel's isotope in a channel's peak; pin the owner remap, other-peptide and conflict rules Another channel's isotope at a channel's position (measureTargeted_): - A non-identified channel's peak at an isotope (k = 1..max of algorithm:isotopes_per_peptide - 1) of another channel is no longer left out on the m/z alone. The expected part of it (that channel's monoisotopic peak in the spectrum times I_k/I_0 of the identified sequence's isotope distribution) leaves it out only if it is at least 20 % of the peak; a smaller part is subtracted. So a triple Dimethyl heavy channel, 4 ppm from the medium's M+4 (~2 %), is measured again (it was not quantifiable whenever the medium was present); a Lys4 channel on the light M+4 of a 2.6 kDa peptide without medium signal stays not quantifiable. - New fixture MS1LabeledWorkflow_15 (triple Dimethyl), TOPP_MS1LabeledWorkflow_15_targeted: SVEDLAFGNYQR 1:1:1 with the medium's unresolved M+4/M+5 in the heavy peaks gives H/L ~1. Tests for rules that no test checked any more: - Other-peptide reserved peaks in the targeted path: in fixture 15, FTDNTDLFR's heavy m/z is the light M+1 of the identified triplex GDVTALFEQR; those reserved peaks are left out (heavy not quantifiable, not measured from them). - Owner remap of merged flanks: TOPP_MS1LabeledWorkflow_12_owners checks the owner counts of the fixture 12 log (without the remap the medium channel of TPELGSVDNALAYNGLSVEPLTAEK is vetoed instead, with the same consensusXML). - Reverse half of the targeted conflict pass: TOPP_MS1LabeledWorkflow_13_swapped runs fixture 13 with the scores of NVYDLGSEK and AHQQQQHR swapped (MS1LabeledWorkflow_13c.idXML); NVYDLGSEK's not quantifiable heavy channel at AHQQQQHR's identified channel does not drop it. - Test comments of fixtures 11 and 12 updated. No existing reference changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] targeted quantification: correct lower channels first, correct the identified channel, same-centroid overlap rule measureTargeted_ estimates the part of a lower channel's isotope in a channel's peak from that channel's monoisotopic peak. Three problems with it: - F1: the lower channel's monoisotopic peak was taken raw, so it could hold a third channel's isotope. In triple Dimethyl R-peptides of 1.95 kDa and up, the light M+4 sits in the medium M0, so the heavy lost an extra L*(I4/I0)^2 or was left out (2.5 kDa 1:1:1: heavy NaN; 1:0:0.5: H/L 0.478). Now the channels of each spectrum are corrected in ascending m/z, and each monoisotopic estimate is taken without the isotopes of the channels below it. This is the triangular case of the overlap system, so one pass solves it. It also holds when the lower channel is the identified one. - F2: the identified channel was never corrected, so H/L depended on which channel was identified (fixture 15 heavy ID: 1.018 vs 1.000 for the light ID). The expected part is now subtracted from the identified channel's peaks too, before they become the reference. If another channel's isotope makes up at least targeted_other_isotope_fraction_ of them, they stay the reference. The other channels' paired intensities cancel a constant reference error. But the identified channel's own intensity is then reported not quantifiable, as a non-identified channel would be, unless min_targeted_reference_spectra_ clean spectra are below that fraction. Dropping the reference spectra instead would lose the whole feature; reporting the value would carry an unbounded estimate error. A new log line counts such features. - F3: an overlap was corrected only within algorithm:mz_tolerance (6 ppm), a mass-accuracy window. The Dimethyl4/Lys4 channel on the light M+4 (0.0117 Da) stayed uncorrected below ~1.95 kDa, although at usual MS1 resolution (FWHM 14-30 ppm) it is unresolved. Now an isotope is part of a channel's peak if that peak is also the nearest peak to the isotope's m/z within twice the tolerance, i.e. the same centroid. Twice the tolerance is the window MultiplexFiltering uses to look for peaks of another envelope (and the workflow's lower-envelope check). A resolved, visible isotope has a centroid of its own and is not taken off its neighbour. Docs: quantifyTargeted_ describes the overlap rule, the ascending correction and the identified- channel rule; the -targeted_quantification help mentions the subtraction and the 20 % rule. Tests: fixture 15 regenerated (generator reproduces the old and the new files byte for byte). - Isotopes are merged within the FWHM at a resolution of 120,000 at m/z 200, instead of 7 ppm. The 7 ppm window sat between SVEDLAFGNYQR's two Dimethyl offsets (4.1, 8.2 ppm) and dropped the light M+4 although it is above the noise level. - Ten isotopes per species instead of six. - New light-ID cases: - SVEDLAFGNYQSVEDLAFGNYR 2.5 kDa 1:1:1 (chain: 17 % in both the medium and the heavy) - SVEDLAFGNYQGEDVTALFEQLR 1:0:0.25 and SVEDLAFGNYQGEDVTALFEQR 1:0:0.5, with the light M+4 at the medium's m/z - TALFEQLSVEDLAFGNYQGDR 1:2:1 (heavy 26 % medium M+4) - New tests 15_heavy_id and 15_medium_id (+_out1) run the same data with peptides identified as heavy or medium. The values agree with the light IDs within 0.3 %. TALFEQLSVEDLAFGNYQGDR's identified heavy is reported not quantifiable, M/L 2. Reference changes (MS1LabeledWorkflow_15_out.consensusXML; no other reference changed, all other outputs of the 89 MS1LabeledWorkflow tests are identical to fa3a1ee0a4): - SVEDLAFGNYQR medium 1314428 -> 1314363. The new fixture merges the light M+4/M+5 into the medium M0/M1 (+1.8 %, which fa3a1ee0a4 keeps: 1338196); the new rule subtracts it. - SVEDLAFGNYQR heavy 1314363 -> 1314387. The medium estimate is now without the light M+4 (fa3a1ee0a4 subtracted an extra L*r4^2, -0.05 %); +0.002 % from the light M+8 now generated. - GDVTALFEQR (detected) medium +0.99 %, heavy +0.006 %, the same with both binaries. The generator merges the light M+4 (10 ppm) into the medium M0, and the detection does not correct overlaps. - New features for the four new peptides, protein abundances accordingly. Log counts: 6 features (7 measured, 1 absent, 4 not quantifiable), was 2 (2/1/1). Fail-before: - With the fa3a1ee0a4 binary, all six fixture-15 tests fail. - Mutants: - raw monoisotopic estimate: 15_targeted, 15_medium_id (+out1), 15_heavy_id_out1, 12_targeted (+out1) - identified channel uncorrected: 15_heavy_id (+out1), 15_medium_id_out1 - identified channel always reported: 15_heavy_id (+out1) - old 6 ppm criterion: the three fixture-15 _out1 tests Duplex Lys8/Arg10 (no channel within k <= 5 isotopes of another): the run-028 window with -targeted_quantification is identical except ids/dates. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] targeted quantification: a NaN identified channel still reads its peaks in the conflict pass; fall back to its measured peaks if the subtraction removes them Since the identified channel can be reported not quantifiable (NaN), two fixes in MS1LabeledWorkflow's targeted quantification: - One signal, one peptide: the conflict pass registered and checked only channels > 0. Two identifications on the same peaks whose identified channels were both NaN (e.g. heavy-identified isomers on a heavy that is mostly the medium's M+4) were both kept with identical values. A peak now reads its identified channel whatever its reported value (it is the reference of the other channels) besides its measured ones. - The subtraction of the other channels' isotopes is clamped at 0 and also applies to the identified channel. An unrelated peak at a lower channel's m/z, taken for that channel, could remove the identified channel's peaks in every spectrum, and the feature was lost with the channels the light-ID run measures. If the subtraction leaves the identified channel fewer than three reference spectra although its measured peaks have them, the subtracted part cannot be right: its peaks are used as measured (reference, isotope gate, RT, lower-envelope check, co-elution profile), and its own intensity is not quantifiable. Nothing changes for features that keep their reference spectra. Fixture 15 (triple Dimethyl) gains SVEDLAFGNYQGEDVTALR 1:0:1 with an unrelated co-eluting peak at the absent medium's m/z (light ID; heavy ID in _heavy.idXML) and, in _heavy.idXML, a worse-scored heavy isomer of TALFEQLSVEDLAFGNYQGDR. References: one new feature (L only, as with the light identification) and the protein that comes with it; in the heavy-ID run the isomer stays unassigned. Existing features unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [DOC] FeatureFinderMultiplexAlgorithm::getBlacklist: fix unresolved doxygen reference '@ref run:' made doxygen look up 'run:' (Doxygen_Warning_test failed on CI). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MS1LabeledWorkflow: require the isotope pattern for paired channel intensities, absent only without a peak (targeted) A channel measured from peaks paired with a reference (targeted quantification, re-quantification of missing channels, re-measurement of joined channels) is accepted only if its peaks show its isotope pattern in at least two spectra paired with the reference: its first two isotopes, and no peak one isotope below above 30 % of its monoisotopic peak (MultiplexFiltering's zeroth-peak check). Otherwise the channel is not quantifiable (NaN), never 0. The reported value stays the estimate over all paired peaks. A peak one isotope below a channel is taken as the peptide's own only if it is isotope 0 to maxIsotope_() of another channel, as MultiplexFiltering exempts only the isotopes of the pattern. Without that bound, the light M+7 next to the Lys8 channel's M-1 switched the check off, also for the identified channel of the targeted quantification. Targeted quantification: a channel without a value that is not interfered is reported absent (0) only if none of its isotopic peaks is seen within the elution boundaries, otherwise not quantifiable. The default re-quantification keeps its meaning of 0. The join keeps its minimum of six spectra with paired peaks on the count without the pattern requirement. Tests: new fixture MS1LabeledWorkflow_16 (Lys8/Arg10 duplex with targeted and re-quantified cases, plus a Dimethyl case for the exemption). In fixture 15, SVEDLAFGNYQGEDVTALR's medium channel, at whose m/z an unrelated peak sits, is now not quantifiable instead of absent: three regexes change and the three references lose that one element. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] MS1LabeledWorkflow: pin the lower-isotope bound on the identified channel, correct the -requantify help The bound of the lower-isotope exemption (a peak one isotope below a channel is the peptide's own only if it is isotope M+0 to M+maxIsotope_() of another channel) also applies to the identified channel's clean elution peak in the targeted quantification, but no test covered that half: keeping the old unbounded exemption for the identified channel alone passed every test. New test TOPP_MS1LabeledWorkflow_16_heavy_id (fixture 16 with MS1LabeledWorkflow_16_heavy.idXML): LSDEFVNGAYK is identified in its Lys8 channel, whose peaks are the M+1/M+2 of an unrelated envelope whose M0 lies one isotope below, at the light M+7. It is not quantified for want of a clean elution peak of the identified channel (before: L 1.2e6, H 7.4e5); TNLGEFAVDR's light identification gives the one feature. The test fails with the previous binary and with that mutation, and passes now. -requantify help: the isotope pattern names the exemption (a peak one isotope below that is an isotope of another channel does not count), and the channel is paired with the most intense detected channel instead of "the reference channel", which could be read as 'ratios:reference_channel'. The comment on the join's rejected pairs includes re-measured channels without a value. Correction to the message of the previous commit: in the join, a re-measured channel that does not show its isotope pattern gives no NaN channel; the candidate is not joined, and both partial multiplets stay as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] MS1LabeledWorkflow: pin the two-spectrum pattern requirement, clarify the absent / not quantifiable wording - Fixture 16: VDTYQLAGNR's heavy channel now shows its isotope pattern paired with a clean light spectrum in exactly one spectrum (one heavy M1 peak added 7 s before the apex; the mzML differs in that spectrum only). It stays not quantifiable with the required two pattern spectra; with one, it would be measured (H/L 0.50), so TOPP_MS1LabeledWorkflow_16_targeted now pins min_pattern_spectra_. No regex or reference changes. - -requantify help and class doc: a re-quantified channel is absent (0) only if its first two isotopic traces are not seen together in two spectra; only otherwise is it not quantifiable for lack of its isotope pattern (or because those traces lie only on reserved peaks). The previous wording also put the absent case under the not-quantifiable clause. - Class doc: peaks reserved by another multiplet make a channel not quantifiable without measuring it (not "only" cause of NaN). - Final NaN log line: "the channel's peaks" instead of the ambiguous "its peaks". Correction to the previous commit's message: in the join, a re-measured channel without a value (e.g. without its isotope pattern) gives no NaN channel; the candidate concerned (whose channel failed, or against whose channel the target's failed) is not joined to this target, and the target is joined to its remaining candidates if their re-measurement passes, otherwise it stays as it is. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] MS1LabeledWorkflow: pin the isotope pattern gate and the ungated paired-spectra count in the join The join re-measures a candidate's channel (or the target's) with the shared pattern gate, but no test covered it: joining a channel that fails the gate with its ungated value, or counting min_join_paired_spectra_ on the pattern spectra instead of all paired spectra, passed every test. New fixture MS1LabeledWorkflow_17 (synthetic SILAC duplex, light identifications) and test TOPP_MS1LabeledWorkflow_17_join (+ _out1): - AVFDNLGTEYK, light only: an unrelated envelope one isotope below the heavy channel co-elutes with the light one, and a signal at the heavy m/z right after it is the join candidate. The re-measured heavy channel has 14 paired spectra but no pattern spectrum (its peaks there are the envelope's M+1 and M+2): not joined (before: joined, H/L 1.19 from the envelope). - TFGDNLVSAER 1:0.063, channels alternating so that each is detected on its own: the heavy channel has 9 paired spectra, 3 of them with its pattern: joined, H/L 0.063. Counting only the pattern spectra (3 < 6) rejects it. No change to the program; all other tests and references are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [DOC] MS1LabeledWorkflow: fit the -targeted_quantification help into ten lines, word the lower-isotope rule as implemented - -targeted_quantification: re-flow the help to nine lines plus 'false:' (it had grown to eleven, and TOPPBase shows at most ten per option, so --help replaced the lines on which identifications are not measured by "..."); the text is unchanged. - -join_channels: name the second reason a candidate is not joined, a re-measured channel that is absent or not quantifiable (e.g. its peaks do not show its isotope pattern), as the log line and the doxygen already do. - The "not quantifiable" log line of the re-quantification, the docs of lower_isotope_fraction_, min_pattern_spectra_ and pairedIntensity_, and the fixture 16 comment: a pattern spectrum has no peak one isotope lower that exceeds 30 % of the channel's monoisotopic peak (as the -requantify help says), not "no stronger envelope one isotope below". No change in behaviour or quantitative output; the 16_requant regex stops before the changed part of the log line. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] MS1LabeledWorkflow: pin the exact bound of the lower-isotope exemption and the targeted absent rule on all isotopes read - The exemption of a peak one isotope below a channel (an isotope M+k of another channel) holds for 0 <= k <= n, n + 1 the maximum of 'algorithm:isotopes_per_peptide'. Only k = 3 (exempt) and k = 7 (not exempt) were tested, so a bound of k < n, or one hard-coded from 3 to 6, passed. The Dimethyl case of fixture 16 (medium M-1 on the light M+3, k = 3) now also runs with isotopes_per_peptide 3:4 (n = 3: still exempt, the medium is measured) and 3:3 (n = 2: not exempt, the medium is not quantifiable). - In targeted quantification a channel is absent (0) only if none of its isotopic peaks read (M+0 to M+2) is seen within the elution peak. Only M0 was tested. Fixture 16 gets two light-identified peptides (new MS1LabeledWorkflow_16_no_mono.idXML) whose heavy channel shows an unrelated envelope on its M+1/M+2, resp. M+2/M+3, and nothing at its M0: both heavy channels are not quantifiable (they were reported as absent). - The added peaks lie at m/z 672-693, RT 122-178, apart from the other cases; the FASTA gets the two proteins. All other outputs of fixtures 16 and 17 are unchanged (only the whitelisted spectra_data line differs); no existing reference or regular expression changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MS1LabeledWorkflow: a peak left out at any isotope read makes a targeted channel not quantifiable The targeted quantification leaves out the peaks of other peptides or channels (on another multiplet, reserved by another feature, or mostly another channel's isotope), but recorded such a peak as occupying the channel only for its M0 and M1. A left-out peak at M+2, e.g. a peak of another peptide's detected multiplet, therefore counted neither as seen nor as occupying the channel, which was reported absent (0), while the same peak of an undetected envelope made it not quantifiable. The peak is now recorded for every isotope read (M+0 to M+2): a channel is absent only if none of these positions holds a peak, its own or another's, within the elution peak. Tests, on a new synthetic fixture MS1LabeledWorkflow_18 (its cases need detected features, which would shift the unique ids in fixture 16's reference): - TOPP_MS1LabeledWorkflow_18_occupied: a targeted heavy channel with nothing at its M0/M1 whose M+2 is the light M0 of a detected, identified duplex of another peptide: not quantifiable (was absent). - TOPP_MS1LabeledWorkflow_18_dimethyl_requant: default re-quantification of a [Dimethyl0][Dimethyl4] 1:0.2 duplex whose medium was missed and whose M-1 is the light M+3 (0.66 x the medium M0): the exemption of another channel's isotope keeps the medium's pattern, M/L 0.2, and no channel is reported not quantifiable for want of its pattern. Both with a reference consensusXML. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] MS1LabeledWorkflow: FAIMS fixture 19 (join, re-quantification, owners and targeted quantification per CV) MS1LabeledWorkflow_19 is fixture 8 acquired at two FAIMS compensation voltages (-45 V and -60 V, one MS1 spectrum per CV at every RT, both with the same RT), with the identifications at -45 V. A peptide's heavy channel at -60 V is not joined to its light partial multiplet at -45 V, the missing channels at -45 V are re-quantified from the -45 V spectra only and not vetoed or skipped because of peaks reserved at -60 V, and the targeted quantification measures at the CV of the identification. The samecv input (the same peaks with two heavy channels at -45 V) is the positive control: the join then gives fixture 8's values and the targeted quantification measures the heavy channel. Eight tests: _19_faims_split (+_out1), _19_faims_owners, _19_faims_samecv (+_out1), _19_faims_targeted (+_out1), _19_faims_samecv_targeted. Every test fails for at least one scratch mutant that drops a CV check: the join candidate CV check, the CV match of the blacklist spectrum lookup, the CV filters of the re-quantification and of the targeted measurement, the candidate's CV, and both CV checks of MultiplexResolverAlgorithm (owner check and plain blacklist check). The inputs were generated from fixture 8's peaks by a stand-alone script that is not part of the repository. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [DOC] MultiplexFiltering, FeatureFinderMultiplexAlgorithm, MS1LabeledWorkflow: limits of blacklist owners and channel joins Only the first and the last filtered peak that reserved a peak are recorded: a reported multiplet that reserved it in between loses it when the clusters of both are dropped, and the peak then counts as reserved by no reported feature. That needs at least three writers of one peak, in practice only with algorithm:rt_band > 0. Stated at MultiplexFiltering::getBlacklistOwners() and applyBlacklistEntries_(), in the provisionalOwners() comment, in FeatureFinderMultiplexAlgorithm::getBlacklist() (whose rule for peaks reserved by several patterns is corrected: the first one if its multiplet was reported, else the last one) and briefly in the description of algorithm:use_blacklist_owners. joinChannelsOfIdentifiedPeptides_: a partner is joined to one partial multiplet only; another identified partial multiplet of the same channels that it spans keeps its own multiplet, in which the partner's channel is not quantifiable, so the summed channel abundances miss the partner channel's share of it (or, if the partner was the reference, count its share of the identified channels twice). No behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [FIX] MultiplexFiltering, FeatureFinderMultiplexAlgorithm: store blacklist owners compactly The owner bookkeeping of the blacklist cost memory in proportion to the number of reserved peaks, which grows strongly with algorithm:rt_band > 0 (a pattern reserves its mass traces over the RT band, so many peaks are reserved several times): - MultiplexFiltering: the first owner of a peak reserved by more than one filtered peak was kept in an unordered_map (one node per such peak, plus a hash lookup on every overwrite). blacklist_owner_ now encodes the owners itself: -1 not reserved, >= 0 the only filtered peak that reserved the peak, <= -2 the index (-2 - value) of a record {first, first_value, last} in blacklist_owner_records_. The record is created when another filtered peak reserves the peak for the first time, so the first owner and its value are the same as with the map; later writers only update record.last. O(1) per write, no hash map. - filtered_peaks_ and BlacklistWriter store the peak index as unsigned instead of size_t (BlacklistWriter shrinks from 24 to 12 bytes). Owners and records are indexed by int, so applyBlacklistEntries_() throws Exception::InvalidSize before the filtered peaks, or the records, would exceed INT_MAX (one check per filtered peak; documented). - New getBlacklistOwners(Size spectrum_index) returns the owners of one spectrum. FeatureFinderMultiplexAlgorithm reads them spectrum by spectrum after generating the maps (centroided and profile branch), instead of holding a full copy of all owners (getBlacklistOwners()) during clustering and map generation. getBlacklistOwners() stays as a convenience for the class test. What is recorded and reported does not change: only the first and the last writer of a peak, as documented. Outputs are unchanged: on an RT slice (25-37 min, MS1 only) of PXD022659 run 099 with the FeatureFinderMultiplex parameters of the runtime measurement plus -test -out_blacklist, featureXML, consensusXML and the blacklist mzML (including owner_unique_id_high/low) are byte-identical to before at rt_band 0 and 5, and so are the logs apart from timings. Peak RSS on that slice (1 thread, without -out_blacklist as in the runtime measurement): rt_band 0: develop 197.3, before 213.6, now 206.1 MiB; rt_band 5: develop 241.0, before 288.3, now 259.5 MiB. MultiplexFilteringCentroided_test additionally checks that getBlacklistOwners(Size) matches getBlacklistOwners() and throws for an index past the last spectrum. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [TEST] MultiplexFiltering: pin the first and the last blacklist owner of a peak MultiplexFilteringCentroided_test gets a section that reserves peaks of two spectra by hand (applyBlacklistEntries_() through a derived tester) for three filtered peaks A, B and C, and checks getBlacklistOwners() against hand-computed owners: a single writer is first and last owner; A rewriting its own peak adds no record, and the mass trace it leaves is the one kept for the first owner; of three writers, A (first) and C (last) are kept and B is dropped; a second record in the second spectrum; the number of records after each writer; getBlacklistOwners(Size) and its IndexOverflow; alignment with getBlacklist() across a white peak. Every expected writer has a nonzero mass trace, so none of them equals a value-initialized BlacklistWriter. A list of the wrong size fails its size check and skips only the checks of its entries, not the independent checks after it. It replaces the check in the threads section that compared getBlacklistOwners(s) with getBlacklistOwners()[s], which could not fail since the latter is built from the former. MultiplexFiltering.h: the doc of applyBlacklistEntries_() put the last owner in blacklist_owner_; once a peak has a record, the record holds it. Each of these mutants of MultiplexFiltering.cpp fails the new section: the record's first value taken from the new entry; record.last not updated; a record also on an own rewrite; no records at all; every record addressed as the first one; the first owner's mass trace read from the current value; the per-spectrum owners stopping at the first white peak; record.first set to the new owner. Six of them pass the rest of the test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ * [DOC] MS1LabeledWorkflow: correct the example of a split elution in the join's doc joinChannelsOfIdentifiedPeptides_: the one observed case of a partner that spans two identified partial multiplets is a light elution split in m/z because its centroids scatter by more than the detection's m/z tolerance (8.1 ppm between the two partials, tolerance 6 ppm), not a split within that tolerance as the doc said. No behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ --------- Co-authored-by: Claude <[email protected]>
No description provided.