Skip to content

emzed.peak_picking

install_xcms()

Install required R dependencies for XCMS centWave support.

Requires a pre-existing R installation; R itself is not bundled with emzed.

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 rtmin<postfix>, rtmax<postfix>, mzmin<postfix>, mzmax<postfix>, and peakmap<postfix> for the selected post_fixes.

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_ms_chromatograms(peakmap, path=None)

Export all chromatograms stored in a PeakMap to a table.

Parameters:

Name Type Description Default
peakmap

input emzed.PeakMap containing MS chromatograms.

required
path

optional output path for out-of-memory table storage.

None

Returns:

Type Description

emzed.Table with one row per chromatogram and columns peakmap, rtmin_chromatogram, rtmax_chromatogram, precursor_mz_chromatogram, mz_chromatogram, type, and chromatogram.

Install required R dependencies for XCMS centWave support.

Requires a pre-existing R installation; R itself is not bundled with emzed.

install_xcms()

Install required R dependencies for XCMS centWave support.

Requires a pre-existing R installation; R itself is not bundled with emzed.

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 emzed.PeakMap.

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

emzed.Table with detected peak/features.

RunFeatureFinderMetabo

__call__(peak_map, ms_level=None, verbose=True, run_feature_grouper=True, split_by_precursors_mz_tol=0.0, **parameters)

Works for standard MS1 processing and for MS2-oriented runs. For MS2, emzed can split the input PeakMap by precursor tuples (using split_by_precursors_mz_tol), run OpenMS per subgroup, and merge the resulting tables.

Parameters:

Name Type Description Default
peak_map

input emzed.PeakMap.

required
ms_level

MS level to process (e.g. 1 for MS1, 2 for MS2).

None
verbose

set to False to suppress output.

True
run_feature_grouper

also run OpenMS feature grouping.

True
split_by_precursors_mz_tol

precursor m/z tolerance used to group MS2 spectra before feature finding. Set to None to disable precursor-based splitting.

Notes: - during OpenMS execution, selected spectra are temporarily mapped to MS level 1 and restored afterward. - split MS2 groups with too few spectra are skipped with warnings. - OpenMS parameter references: FeatureFindingMetabo: https://abibuilder.cs.uni-tuebingen.de/archive/openms/Documentation/nightly/html/classOpenMS_1_1FeatureFindingMetabo.html#details MassTraceDetection: https://abibuilder.cs.uni-tuebingen.de/archive/openms/Documentation/nightly/html/classOpenMS_1_1MassTraceDetection.html#details ElutionPeakDetection: https://abibuilder.cs.uni-tuebingen.de/archive/openms/Documentation/nightly/html/classOpenMS_1_1ElutionPeakDetection.html#details

0.0

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 emzed.PeakMap.

required
ms_level

optional MS level selection (for example 2 for MS2).

None
verbose

set to False to suppress output.

True
run_feature_grouper

set to False to suppress grouping of peaks to features.

True
split_by_precursors_mz_tol

precursor m/z tolerance for MS2 subgrouping. Set to None to disable subgrouping.

0.0
parameters

additional OpenMS parameters using the emzed prefixes common_*, mtd_*, epdet_*, and ffm_*.

{}

Returns:

Type Description

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 ["*.mzML", "*.mzXML"].

None
out_folder

output folder, created on demand. Default: out_folder = in_folder.

None
ms_level

optional MS level to use for feature finding.

None
n_cores

run feature finding on n_cores in parallel.

1
verbose

set to True for verbose output.

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 *_peaks.table outputs.

False
parameters

additional parameters forwarded to run_feature_finder_metabo.

{}

Returns:

Type Description

None.