MzMLFile#
- class pyopenms.MzMLFile#
Bases:
XMLFileFile adapter for MzML files
Provides methods to load and store MzML files. PeakFileOptions allow to load a reduced subset of the data into an MSExperiment.
See help(MSExperiment) how data is stored after loading. See help(PeakFileOptions) for available options.
Usage:
exp = MSExperiment() MzMLFile().load("test.mzML", exp) spec = [] for s in exp.getSpectra(): if s.getMSLevel() != 1: spec.append(s) exp.setSpectra(spec) MzMLFile().store("filtered.mzML", exp)
- __init__() None#
- __init__(arg: pyopenms.MzMLFile, /) None
Methods
__init__()endProgress([bytes_processed])Ends the progress display
Returns the type of progress log being used
Returns the options for loading/storing
Return the version of the schema
isSemanticallyValid(filename)Check semantic validity and return (is_valid, errors, warnings)
load(filename, exp)Load an mzML file into an MSExperiment
loadBuffer(buffer, exp)Load an MSExperiment from an in-memory mzML string buffer
Increment progress by 1 (according to range begin-end)
setLogType(type)Sets the progress log that should be used.
setOptions(options)Set PeakFileOptions to perform filtering during loading.
setProgress(value)Sets the current progress
startProgress(begin, end, label)store(filename, exp)Store an MSExperiment to an mzML file
storeBuffer(exp)Store an MSExperiment to an in-memory mzML buffer and return it as str
transform(filename, consumer[, ...])Overloaded function.
- endProgress(bytes_processed: int = 0) None#
Ends the progress display
- getLogType() pyopenms.ProgressLogger.LogType#
Returns the type of progress log being used
- getOptions() pyopenms.PeakFileOptions#
Returns the options for loading/storing
- getVersion() str#
Return the version of the schema
- isSemanticallyValid(filename: str) tuple#
Check semantic validity and return (is_valid, errors, warnings)
- load(filename: str, exp: pyopenms.MSExperiment) None#
Load an mzML file into an MSExperiment
- loadBuffer(buffer: str, exp: pyopenms.MSExperiment) None#
Load an MSExperiment from an in-memory mzML string buffer
- nextProgress() None#
Increment progress by 1 (according to range begin-end)
- setLogType(type: pyopenms.ProgressLogger.LogType) None#
Sets the progress log that should be used. The default type is NONE!
- setOptions(options: pyopenms.PeakFileOptions) None#
Set PeakFileOptions to perform filtering during loading. E.g., to load only MS1 spectra or meta data only
- setProgress(value: int) None#
Sets the current progress
- startProgress(begin: int, end: int, label: str) None#
- store(filename: str, exp: pyopenms.MSExperiment) None#
Store an MSExperiment to an mzML file
- storeBuffer(exp: pyopenms.MSExperiment) str#
Store an MSExperiment to an in-memory mzML buffer and return it as str
- transform(filename: str, consumer: object, skip_full_count: bool = False, skip_first_pass: bool = False) None#
- transform(filename: str, consumer: object, exp: pyopenms.MSExperiment, skip_full_count: bool = False, skip_first_pass: bool = False) None
Overloaded function.
transform(filename: str, consumer: object, skip_full_count: bool = False, skip_first_pass: bool = False) -> None
Transform an mzML file using a consumer object (streaming processing). The GIL is released while parsing and taken for each consumer call, so other Python threads run meanwhile; they must not use this object until it returns.
transform(filename: str, consumer: object, exp: pyopenms.MSExperiment, skip_full_count: bool = False, skip_first_pass: bool = False) -> None
Transform an mzML file using a consumer object, also collecting the spectra into exp. The consumer sees each spectrum before it is appended, so modifications it makes are kept. The GIL is released while parsing and taken for each consumer call, so other Python threads run meanwhile; they must not use this object or exp until it returns.