diff --git a/src/depiction_targeted_preproc/pipeline_config/model.py b/src/depiction_targeted_preproc/pipeline_config/model.py index f3e360e..710f30e 100644 --- a/src/depiction_targeted_preproc/pipeline_config/model.py +++ b/src/depiction_targeted_preproc/pipeline_config/model.py @@ -41,8 +41,19 @@ class PeakPickerMSPeakPicker(BaseModel): fit_type: Literal["quadratic"] = "quadratic" +class PeakPickerFindMFPy(BaseModel): + peak_picker_type: Literal["FindMFPy"] + resolution: float = 10000.0 + width: float = 2.0 + int_width: float = 2.0 + int_threshold: float = 10.0 + area: bool = True + max_peaks: int = 0 + + PeakPicker = Annotated[ - None | PeakPickerBasicInterpolated | PeakPickerMSPeakPicker, Field(discriminator="peak_picker_type") + None | PeakPickerBasicInterpolated | PeakPickerMSPeakPicker | PeakPickerFindMFPy, + Field(discriminator="peak_picker_type"), ] diff --git a/src/depiction_targeted_preproc/workflow/proc/pick_peaks.py b/src/depiction_targeted_preproc/workflow/proc/pick_peaks.py index da20592..b8a950d 100644 --- a/src/depiction_targeted_preproc/workflow/proc/pick_peaks.py +++ b/src/depiction_targeted_preproc/workflow/proc/pick_peaks.py @@ -43,6 +43,18 @@ def perform_peak_picking(config: PipelineParameters, read_file: ImzmlReadFile, o ) case model.PeakPickerMSPeakPicker() as peak_picker_config: peak_picker = MSPeakPicker(fit_type=peak_picker_config.fit_type, peak_filtering=peak_filtering) + case model.PeakPickerFindMFPy() as peak_picker_config: + # NOTE: importing this here since it has non-standard dependencies + from depiction.spectrum.peak_picking.findmf_peak_picker import FindMFPeakpicker + + peak_picker = FindMFPeakpicker( + resolution=peak_picker_config.resolution, + width=peak_picker_config.width, + int_width=peak_picker_config.int_width, + int_threshold=peak_picker_config.int_threshold, + area=peak_picker_config.area, + max_peaks=peak_picker_config.max_peaks, + ) case _: raise ValueError(f"Unsupported peak picker type: {config.peak_picker.peak_picker_type}") # TODO correctly detect files which are already picked