Skip to content

Added RelativeAmplitudeCutoff Parameter for Spectrum Filtering in Deconvolution#560

Merged
Bujee415 merged 4 commits intomasterfrom
feature/deconvolution-relative-cutoff
May 10, 2025
Merged

Added RelativeAmplitudeCutoff Parameter for Spectrum Filtering in Deconvolution#560
Bujee415 merged 4 commits intomasterfrom
feature/deconvolution-relative-cutoff

Conversation

@YukiMatsuzawa
Copy link
Copy Markdown
Contributor

PR Classification

New feature

PR Summary

Introduces a RelativeAmplitudeCutoff parameter for flexible spectrum filtering based on relative intensity thresholds, complementing the existing absolute threshold. Updates span core logic, UI, ViewModel, and configuration parsing for seamless integration.

  • MSDecHandler.cs: Updated spectrum filtering logic to use both relative and absolute amplitude cutoffs.
  • ParameterBase.cs: Added RelativeAmplitudeCutoff property with default value and updated ToString method.
  • DeconvolutionSettingView.xaml: Added UI input for RelativeAmplitudeCutoff with validation and tooltips.
  • ConfigParser.cs: Enabled parsing of RelativeAmplitudeCutoff from configuration files.
  • Ms2Dec.cs: Enhanced MS/MS spectrum handling to incorporate the new parameter in intensity threshold calculations.

Encapsulated the AmplitudeCutoff parameter within ChromDecBaseParam
to improve code organization and modularity. Updated all references
to use param.ChromDecBaseParam.AmplitudeCutoff across multiple files
and methods, including MSDecHandler.cs, ParameterBase.cs, and others.

This refactoring enhances maintainability and readability without
changing functionality. Developers must now access AmplitudeCutoff
via ChromDecBaseParam, ensuring consistency across the codebase.
Introduced a new `RelativeAmplitudeCutoff` parameter to enable
dynamic intensity thresholding based on a spectrum's maximum
intensity. Updated logic across multiple files to calculate
thresholds as the maximum of `maxIntensity * RelativeAmplitudeCutoff`
and `AmplitudeCutoff`.

Key changes:
- Added `RelativeAmplitudeCutoff` to `ParameterBase`, `DeconvolutionSettingModel`, and `ParameterBaseVM`.
- Updated spectrum filtering logic in `MSDecHandler.cs`, `DataAccess.cs`, and `Ms2Dec.cs`.
- Enhanced configuration parsing in `ConfigParser.cs` to support the new parameter.
- Improved code readability with shorthand syntax for empty lists and removal of magic numbers.

These changes improve deconvolution flexibility and configurability,
adapting filtering to spectrum intensity distributions and exposing
the new parameter in the UI and configuration files.
- Added a new "MS/MS relative abundance cut off" input in
  `DeconvolutionSettingView.xaml` with labels, tooltips, and
  binding to the `RelativeAmplitudeCutoff` property.
- Introduced `RelativeAmplitudeCutoff` in
  `DeconvolutionSettingViewModel.cs` as a validated `ReactiveProperty`
  with error handling and synchronization with the model.
- Updated `ObserveHasErrors` and `ObserveChanges` to include
  `RelativeAmplitudeCutoff` for validation and change tracking.
- Added validation attributes (`[Required]`, `[RegularExpression]`)
  for `RelativeAmplitudeCutoff` to ensure valid percentage input.
- Introduced `RemoveAfterPrecursor` as a new property in the view model
  with synchronization and change observation.
- Improved overall functionality and user experience for deconvolution
  settings with better validation and configurability.
@YukiMatsuzawa YukiMatsuzawa requested review from Bujee415 and Copilot May 9, 2025 08:58
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 introduces a new RelativeAmplitudeCutoff parameter to improve spectrum filtering by applying both relative and absolute intensity thresholds during deconvolution. Key changes include updating core deconvolution logic, adding UI support through the ViewModel and XAML view, and enhancing configuration file parsing.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/MSDIAL5/MsdialCoreTestApp/Parser/ConfigParser.cs Updated parsing to route amplitude cutoff values to the new ChromDecBaseParam.
src/MSDIAL5/MsdialLcMsApi/Algorithm/Ms2Dec.cs Modified threshold calculation to incorporate RelativeAmplitudeCutoff.
src/MSDIAL5/MsdialLcImMsApi/Algorithm/Ms2Dec.cs Adjusted handling for empty spectrum lists and threshold computation.
src/MSDIAL5/MsdialImmsCore/Algorithm/Ms2Dec.cs Updated centroid calculation and handling of empty lists.
src/MSDIAL5/MsdialGuiApp/ViewModel/Setting/DeconvolutionSettingViewModel.cs Added reactive binding and validation for the new parameter.
src/MSDIAL5/MsdialGuiApp/ViewModel/DataObj/ParameterBaseVM.cs Propagated RelativeAmplitudeCutoff into the ViewModel.
src/MSDIAL5/MsdialGuiApp/View/Setting/DeconvolutionSettingView.xaml Integrated new UI elements for relative amplitude input.
src/MSDIAL5/MsdialGuiApp/Model/Setting/MethodSettingModelFactory.cs Adjusted parameter assignment to use ChromDecBaseParam for amplitude cutoff.
src/MSDIAL5/MsdialGuiApp/Model/Setting/DeconvolutionSettingModel.cs Added RelativeAmplitudeCutoff property and ensured its persistence.
src/MSDIAL5/MsdialDimsCore/Algorithm/Ms2Dec.cs Revised spectrum threshold computation to use the relative cutoff.
src/MSDIAL5/MsdialCore/Utility/DataAccess.cs Updated filtering logic on centroid spectra using the new cutoff.
src/MSDIAL5/MsdialCore/Parameter/ParameterBase.cs Revised text output to include the new RelativeAmplitudeCutoff parameter.
src/MSDIAL5/MsdialCore/MSDec/MSDecHandler.cs Modified deconvolution spectrum refinement and chromatogram extraction based on updated cutoff values.

…el.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Bujee415 Bujee415 merged commit 5665936 into master May 10, 2025
9 checks passed
@Bujee415 Bujee415 deleted the feature/deconvolution-relative-cutoff branch May 10, 2025 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants