instadeepai / instadeepai/winnow
Feat: Add precursor ion signal percentage feature
- Dominant language
- Python
- Stars
- 11
- Forks
- 2
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 1
Description
### Summary:
## Add Precursor Ion Signal Percentage Feature
### Description
Calculate the percentage of total MS2 signal intensity from the unfragmented precursor ion.
### Background: What This Feature Measures
In MS2 spectra, the precursor ion should fragment into many pieces (b-ions, y-ions, etc.). However, sometimes fragmentation is incomplete and a strong signal from the unfragmented precursor ion remains in the MS2 spectrum.
This feature will measure the percentage of the total MS2 signal is still coming from the precursor ion itself.
- **High percentage** = Poor fragmentation, most signal is still the precursor
- **Low percentage** = Good fragmentation, precursor broke into many fragments
This provides an orthogonal quality dimension to help the calibrator distinguish between:
- Genuine high-quality matches
- Artificially inflated matches due to precursor contamination
- Poor spectra vs. incorrect sequence assignments
### Implementation
#### Steps:
- Add a new feature to `winnow/calibration/calibration_features.py`
1. For each spectrum, get the precursor m/z from `dataset.metadata["precursor_mz"]`
2. Find all peaks in the MS2 spectrum (`mz_array`, `intensity_array`) that match the precursor m/z within tolerance
3. Sum the intensity of matching peaks
4. Calculate: `(precursor_intensity / total_spectrum_intensity) * 100`
- Can reuse existing ion matching patterns (see `find_matching_ions()`)
### Expected Output
- New column `precursor_signal_percentage` in calibration dataset and metadata output file
### Description & Purpose:
_No response_
### Additional Notes:
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.