Skip to content

Commit

Permalink
add the experimental peak picker as an option
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Jun 27, 2024
1 parent 59aface commit f6fe995
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/depiction_targeted_preproc/pipeline_config/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
]


Expand Down
12 changes: 12 additions & 0 deletions src/depiction_targeted_preproc/workflow/proc/pick_peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f6fe995

Please sign in to comment.