Peak Picking Methods¶
This page highlights the most often used API functionalities and is not complete.
It covers peak picking and chromatogram extraction helpers in emzed.peak_picking.
For complete coverage, see the API Reference.
Core Functions¶
Wrapper around OpenMS FeatureFinderMetabo for MS1 and MS2 workflows.
For MS2, emzed can split by precursors and merge subgroup results.
run_feature_finder_metabo(peak_map, ms_level=None, verbose=True, run_feature_grouper=True, split_by_precursors_mz_tol=0.0, **parameters)
¶
Run OpenMS FeatureFinderMetabo through the emzed wrapper.
Supports MS1 and MS2-oriented workflows. For MS2, emzed can split by precursor tuples, run per subgroup, and merge results into one table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peak_map
|
input |
required | |
ms_level
|
optional MS level selection (for example |
None
|
|
verbose
|
set to |
True
|
|
run_feature_grouper
|
set to |
True
|
|
split_by_precursors_mz_tol
|
precursor m/z tolerance for MS2
subgrouping. Set to |
0.0
|
|
parameters
|
additional OpenMS parameters using the emzed prefixes
|
{}
|
Returns:
| Type | Description |
|---|---|
|
OpenMS parameter references:
|
Run feature finding for all matching files in a folder and save one
*_peaks.table per input file.
run_feature_finder_metabo_on_folder(in_folder, file_patterns=None, out_folder=None, ms_level=None, n_cores=1, verbose=False, run_feature_grouper=True, split_by_precursor_mz_tol=0.0, overwrite=False, **parameters)
¶
Run run_feature_finder_metabo for matching input files in a folder.
Saves one *_peaks.table result per input file.
MS2-related settings are forwarded unchanged (for example ms_level and
split_by_precursor_mz_tol), as well as all additional **parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_folder
|
input folder, must exist. |
required | |
file_patterns
|
list of file patterns. Defaults to
|
None
|
|
out_folder
|
output folder, created on demand. Default:
|
None
|
|
ms_level
|
optional MS level to use for feature finding. |
None
|
|
n_cores
|
run feature finding on |
1
|
|
verbose
|
set to |
False
|
|
run_feature_grouper
|
also run OpenMS feature grouping. |
True
|
|
split_by_precursor_mz_tol
|
precursor m/z tolerance used to split MS2 spectra before feature finding. |
0.0
|
|
overwrite
|
overwrite existing |
False
|
|
parameters
|
additional parameters forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
|
|
Extract chromatograms for peak windows from a peak table.
Input rows must provide (with optional postfixes):
mzmin, mzmax, rtmin, rtmax, and peakmap.
extract_chromatograms(peak_table, ms_level=None, post_fixes=None, path=None, overwrite=False)
¶
Extract chromatograms from table with peak map and peak limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peak_table
|
Table with columns |
required | |
ms_level
|
optional MS level to consider. |
None
|
|
post_fixes
|
optional post_fixes to consider. |
None
|
|
path
|
optional path for out-of-memory table. |
None
|
|
overwrite
|
allow overwriting existing out-of-memory table. |
False
|
Returns:
| Type | Description |
|---|---|
|
new table with chromatograms and chromatogram boundaries. |
Extract all MS chromatograms already stored in a PeakMap into a table.
Each output row represents one chromatogram and includes:
peakmap, rtmin_chromatogram, rtmax_chromatogram,
precursor_mz_chromatogram, mz_chromatogram, type, and chromatogram.
Use this when you want table-based processing/filtering of instrument-provided chromatograms (for example SRM/MRM traces) rather than extracting new XICs from spectra windows.
extract_ms_chromatograms(peakmap, path=None)
¶
Export all chromatograms stored in a PeakMap to a table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peakmap
|
input |
required | |
path
|
optional output path for out-of-memory table storage. |
None
|
Returns:
| Type | Description |
|---|---|
|
|
Optional XCMS Wrapper¶
The package also exposes an optional XCMS-based wrapper (R backend):
run_feature_finder_centwave(peakmap, ppm=25, peakwidth=(20, 50), prefilter=(3, 100), snthresh=10, integrate=1, mzdiff=-0.001, noise=0, mzCenterFun='wMean', fitgauss=False, msLevel=None, verboseColumns=False, roiList=[], firstBaselineCheck=False, roiScales=[], extendLengthMSW=False, verboseBetaColumns=False)
¶
Run XCMS centWave peak picking through the emzed R connector.
This is an optional wrapper that requires the XCMS R package setup. Parameters are forwarded to centWave. XCMS project page: https://bioconductor.org/packages/release/bioc/html/xcms.html
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peakmap
|
input |
required | |
ppm
|
tolerated m/z deviation in ppm. |
25
|
|
peakwidth
|
expected chromatographic peak width range in seconds. |
(20, 50)
|
|
prefilter
|
prefilter tuple used by centWave. |
(3, 100)
|
|
snthresh
|
signal-to-noise threshold. |
10
|
|
integrate
|
integration method setting passed to centWave. |
1
|
|
mzdiff
|
minimum m/z difference for overlapping peaks. |
-0.001
|
|
noise
|
intensity threshold for noise filtering. |
0
|
|
mzCenterFun
|
function name used for m/z center calculation. |
'wMean'
|
|
fitgauss
|
enable Gaussian fitting of chromatographic peaks. |
False
|
|
msLevel
|
optional MS level filter passed to centWave. |
None
|
|
verboseColumns
|
include additional verbose result columns. |
False
|
|
roiList
|
optional predefined ROI list. |
[]
|
|
firstBaselineCheck
|
perform baseline check before ROI extension. |
False
|
|
roiScales
|
optional ROI scales. |
[]
|
|
extendLengthMSW
|
extend wavelet scales for long peaks. |
False
|
|
verboseBetaColumns
|
include additional beta-shape diagnostic columns. |
False
|
Returns:
| Type | Description |
|---|---|
|
|
install_xcms()
¶
Install required R dependencies for XCMS centWave support.
Requires a pre-existing R installation; R itself is not bundled with emzed.