dda: drop hardcoded scan 0..1000 in extract_precursor_ms1_signals#399
Merged
Conversation
The MS1 XIC/mobilogram filter in extract_precursor_ms1_signals hardcoded the scan range to 0..1000. The inv_mobility window (im_min/im_max) was already doing the actual mobility selection, so the scan cap only served to silently truncate signal on acquisitions that use more than 1000 scans per frame (high mobility-resolution / wide IM range methods — common in HLA immunopeptidomics). Symptom: for affected datasets, sample precursors whose target mobility maps to scan indices >= 1000 extract to all-zero MS1 (iso = [0,0,0,0,0], rt_r2 = 0, im_r2 = 0) even when the m/z calibration is correct. Confirmed on PXD026463 (10/10 precursors zero) and PXD020509 (5/10 zero, 5/10 fine) with the SDK-derived m/z fix applied — the latter's per-precursor binary on/off pattern is the giveaway. Fix: change the scan range to 0..i32::MAX. The inv_mobility filter still constrains to the requested mobility window.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
extract_precursor_ms1_signals(rustdf/src/data/dda.rs) builds its XIC /mobilogram filter with a hardcoded scan range
0..1000:The
inv_mobilitywindow (im_min/im_max) was already doing the actualmobility selection — the scan cap added nothing except silent signal loss for
any acquisition with more than 1000 scans per frame. That's common for
high-mobility-resolution methods, particularly HLA immunopeptidomics setups.
Symptom
On affected datasets, sample precursors whose target mobility maps to
scan indices
>= 1000extract to all-zero MS1:isotope_intensity = [0,0,0,0,0],rt_r2 = 0,im_r2 = 0— even when m/z calibration is correct.Confirmed on two real datasets (with the SDK-derived m/z fix from #396
already in place, so this is not the m/z bug):
The per-precursor binary pattern on PXD020509 (clean envelopes when mobility
falls in scans 0–1000; zero when it falls in scans ≥1000) is the giveaway.
Fix
One-line change: replace
0, 1000with0, i32::MAX. Theinv_mobilityfilter still selects the requested mobility band.
Compatibility
No API change. No new arguments. The only observable difference is that
acquisitions with
>1000scans per frame stop dropping signal in the XIC /mobilogram path.
Note
dda.rshas a few otherfilter_rangedcall sites that hardcodescan 0..2000(lines 355, 670, 787, 875). Those are different code paths(fragment extraction, top-N peak filtering) and are out of scope for this
fix — the 2000 cap is unlikely to bite in practice. Worth a follow-up audit
if a similar symptom ever appears on the fragment side.