pymzML - an interface between Python and mzML Mass spectrometry Files

pymzml, updated 🕥 2023-03-20 16:06:12


.. image:: :target: :alt: Documentation Status

.. image:: :target:

.. image:: :target:

.. image:: :target: :alt: As long it is black

.. image:: :target: :alt: Research software impact

General information

Module to parse mzML data in Python based on cElementTree

Copyright 2010-2021 by:

| M. Kösters,
| J. Leufken,
| T. Bald,
| A. Niehues,
| S. Schulze,
| K. Sugimoto,
| R.P. Zahedi,
| M. Hippler,
| S.A. Leidel,
| C. Fufezan,

=================== Contact information ===================

Please refer to:

| Dr. Christian Fufezan
| Group Leader Experimental Bioinformatics
| Cellzome GmbH
| R&D Platform Technology & Science
| Germany
| eMail: [email protected]


pymzML is an extension to Python that offers * a) easy access to mass spectrometry (MS) data that allows the rapid development of tools * b) a very fast parser for mzML data, the standard mass spectrometry data format * c) a set of functions to compare and/or handle spectra * d) random access in compressed files * e) interactive data visualization


pymzML requires Python3.7+. The module is freely available on or pypi, published under MIT license and only requires numpy and regex, however there are several optional dependencies for extended functionality like interactive plotting and deconvolution.


Get the latest version via github |

The complete Documentation can be found as pdf |


M Kösters, J Leufken, S Schulze, K Sugimoto, J Klein, R P Zahedi, M Hippler, S A Leidel, C Fufezan; pymzML v2.0: introducing a highly compressed and seekable gzip format, Bioinformatics, doi:


pymzML requires Python_ 3.7 or higher.

.. note::

Consider to use a Python virtual environment for easy installation and use.
Further, usage of python3.7+ is recommended.

Download pymzML using GitHub_ or the zip file:

  • GitHub version: Start by cloning the GitHub repository::

[email protected]:~$ git clone [email protected]:~$ cd pymzml [email protected]:~$ pip install -r requirements.txt [email protected]:~$ python install

.. _Python:

.. _GitHub:

  • pypi version::

[email protected]:~$ pip install pymzml # install standard version [email protected]:~$ pip install "pymzml[plot]" # with plotting support [email protected]:~$ pip install "pymzml[pynumpress]" # with pynumpress support [email protected]:~$ pip install "pymzml[deconvolution]" # with deconvolution support using ms_deisotope [email protected]:~$ pip install "pymzml[full]" # full featured

If you have troubles installing the dependencies, install numpy first separately, since pynumpress requires numpy to be installed.

If you use Windows 7 please use the 'SDK7.1 command prompt' for installation of pymzML to assure correct compiling of the C extensions.

======= Testing =======

To test the package and correct installation::



Please read the contribution guidelines before contributing here </CONTRIBUTING.rst>_

Code of Conduct

Since pymzML is an open source project maintained by the community, we established a code of conduct in order to facilitate an inclusive environment for all users, contributors and project memebers. Before contributing to pymzML, please read the code of conduct here </>_


How to get isolation window information?

opened on 2023-03-20 15:20:20 by rxnataliezhang

Do you have any features about getting isolation window information (upper bound and lower bound)? I didn't find any clue about this in the documentation.

How can I load a SRM data?

opened on 2023-03-08 12:07:09 by dongdongdong7

It seems that I can't load SRM data with pymzml, nor can I find any clue in the documentation.

Trying to use pymzml with pyinstaller

opened on 2023-03-03 20:01:07 by sorenwacker

I am running into this error and would like to have some background info about this missing file psi-ms-1.1.0.obo: on /_dash-update-component [POST] Traceback (most recent call last): File "pymzml\", line 201, in _get_encoding_parameters File "pymzml\", line 116, in __getitem__ File "pymzml\", line 190, in parseOBO File "pymzml\", line 152, in download_obo File "urllib\", line 251, in urlretrieve FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\asdf\\workspace\\ms-mint-app\\pyinstaller\\dist\\Mint\\obo\\psi-ms-1.1.0.obo'

It looks like this file is downloaded during runtime, is that correct? Was that changed recently? I just switched from pyinstaller 4 to 5.8, and I am trying to figure out if this is a pyinstaller or pymzml problem. Thanks

add element to precursor

opened on 2023-02-18 10:59:11 by wolfgangcolsman

add element to precursor to provide access to isolationWindow and activation

Merge to master

opened on 2023-02-03 13:45:20 by MKoesters None

Add pydocstyle CI

opened on 2022-11-08 16:56:23 by MKoesters None


v2.5.2 2022-09-08 13:37:04

What's Changed

  • Master by @MKoesters in
  • Update dependency sphinx to v4.5.0 by @renovate in
  • modified regex to work with id and index regardless of order by @tristan-ranff in
  • Update dependency sphinx to v5 by @renovate in
  • generate reprofiled in Spectrum.add if not present. by @JB-Wolf in

New Contributors

  • @tristan-ranff made their first contribution in
  • @JB-Wolf made their first contribution in

Full Changelog:

Release 2.5.1 2022-04-11 13:51:29

  • autodownload obo files if not available
  • Reader class accepts Path objects as input
  • add support for miliseconds unit for scan time
  • fix bux leading to wrong parsing of chromatograms elements

Release 2.5.0 2021-06-02 13:38:45

  • add ms level 0 with precision of 0.0001 for spectra without MS level (e.g. UV spectra)
  • allow saving plots as pdf
  • fix py38 warning
  • add methods to retrieve ion mobility arrays
  • require at least python 3.7
  • fix centroiding issue due to change in new obo

Upgrade to v2.4.7 release version 2020-06-05 13:19:17

Release v2.4.7

fix bug when calling scan_time_in_minutes serveral time resulting in casting conversion every time
allow user to set a custom regex for parsing the mzML index
update readme with instructions for testing with tox
fix bug which made pymzML crash when ms_level is 0
update sphinx dependency
the reader is now reset to the inital state after iterating all spectra
fix bugs when parsing mzML files with non numerical id

Upgrade to v2.4.2 release version 2019-08-13 11:38:26

  • optimize spectrum class methods to make better use of numpy
  • add remove_precursor_peak method in spectrum class

Upgrade to v2.4.0 release version 2019-08-05 12:21:24

  • Implement spectrum deconvolution using ms_deisotope

mass-spectrometry mzml-files bioinformatics mzml-interface