-
Notifications
You must be signed in to change notification settings - Fork 28
changed threshold of 4 to 15 #688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request changes the spike count threshold used in background-subtracted peak detection from 4 to 15 across three overloaded methods in the PeakSpottingCore class. This threshold determines how sensitive the algorithm is to noise when filtering chromatogram peaks.
- Changed
counterThresholdfrom 4 to 15 in three method overloads ofGetBackgroundSubtractedPeaks
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
|
|
||
| public List<ChromatogramPeakFeature> GetBackgroundSubtractedPeaks(List<ChromatogramPeakFeature> chromPeakFeatures, IReadOnlyList<IChromatogramPeak> peaklist) { |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The threshold change from 4 to 15 creates an inconsistency with the similar implementation in MsdialImmsCore/Algorithm/PeakSpotting.cs which uses a constant SPIKE_COUNT_THRESHOLD set to 4. Consider whether both implementations should use the same threshold value, or if the difference is intentional due to different processing requirements. If the values should differ, consider adding comments explaining why.
| public List<ChromatogramPeakFeature> GetBackgroundSubtractedPeaks(List<ChromatogramPeakFeature> chromPeakFeatures, IReadOnlyList<IChromatogramPeak> peaklist) { | |
| public List<ChromatogramPeakFeature> GetBackgroundSubtractedPeaks(List<ChromatogramPeakFeature> chromPeakFeatures, IReadOnlyList<IChromatogramPeak> peaklist) { | |
| // Spike-count threshold for background/noise suppression in this core chromatographic peak algorithm. | |
| // Note: This value (15) intentionally differs from SPIKE_COUNT_THRESHOLD (4) in MsdialImmsCore/Algorithm/PeakSpotting.cs | |
| // because the IMMS-specific implementation and this core implementation operate on different data/processing characteristics. |
| } | ||
| } | ||
|
|
||
| public List<ChromatogramPeakFeature> GetBackgroundSubtractedPeaks(List<ChromatogramPeakFeature> chromPeakFeatures, IReadOnlyList<IChromatogramPeak> peaklist) { |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The threshold change from 4 to 15 is a significant algorithmic change that affects background subtraction and noise filtering in peak detection. This change lacks documentation explaining the rationale. Consider adding a comment explaining why this value was changed and what impact it has on peak detection sensitivity.
| public List<ChromatogramPeakFeature> GetBackgroundSubtractedPeaks(List<ChromatogramPeakFeature> chromPeakFeatures, IReadOnlyList<IChromatogramPeak> peaklist) { | |
| public List<ChromatogramPeakFeature> GetBackgroundSubtractedPeaks(List<ChromatogramPeakFeature> chromPeakFeatures, IReadOnlyList<IChromatogramPeak> peaklist) { | |
| // `counter` counts how many local spike pairs have noise (0.5 * |spikeMax - spikeMin|, scaled by 3) | |
| // comparable to or larger than the peak amplitude difference (`ampDiff`). Peaks with too many such | |
| // high-noise events are treated as background and removed. The threshold of 15 was chosen empirically | |
| // to suppress peaks originating from highly noisy chromatographic regions, at the cost of slightly | |
| // reduced sensitivity for very small peaks. Lowering this value will retain more peaks (more sensitive | |
| // but more noise), while increasing it will make the background subtraction more stringent. |
No description provided.