Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

mzml2isa - mzML to ISA-tab parsing tool

Project description


Parser to get meta information from mzML file and parse relevant information to a ISA-Tab structure

|Version| |Py versions| |Build Status| |GitHub| |License|


mzml2isa is a Python3 program that can be used to generate an ISA-Tab
structure out of mzML files, providing the backbone of a study which can
then be edited with an ISA editing tool (see `MetaboLights pre-packaged
ISA Creator <>`__)

Currently the program does the following \* Extract meta information
from mzML files and store as either python dictionary or JSON format \*
Create an ISA-Tab file structure with relevant meta information \* Add
additional metadatas that cannot be parsed from mzML files to the
ISA-Tab files through a JSON formatted dictionnary.


With PIP

If ``pip`` is installed, it can be used to easily install the parser
(this may need to be run as administrator depending on the machine's

.. code:: bash

pip3 install mzml2isa

Without PIP

Alternatively, you can also clone the repository and install from the
source :

.. code:: bash

git clone git:// && cd mzml2isa
python3 install

mzml2isa has 2 optional dependencies: ``progressbar2`` and ``lxml``, the
latter quickening the parsing process while the other enhances the
output of the program. To install them both, use pip:

.. code:: bash

pip3 install lxml progressbar2



The parser comes with a simple one-liner:

.. code:: bash

mzml2isa -i /path/to/mzml_files/ -o /path/to/out_folder/ -s name_of_study


It is also possible to import the package:

.. code:: python

from mzml2isa import parsing

in_dir = "/path/to/mzml_files/"
out_dir = "/path/to/out_folder/"
study_identifier_name = "name_of_study"

parsing.full_parse(in_dir, out_dir, study_identifier_name)

Meta extraction

If you just want to extract meta information:

.. code:: python

from mzml2isa import mzml

onefile = os.path.join(in_dir,"samp1.mzML")
mm = mzml.mzMLmeta(onefile)

# python dictionary format
print mm.meta

# JSON format
print mm.meta_json


To download some real data from
`MetaboLights <>`__ studies to test
the converter with, run

.. code:: bash

python scripts/ <size>

from inside the repository, where *size* is the maximum size in GiB you
can allocate to download files. The script will download the files to
the ``example_files/metabolight``\ s folder and then run mzml2isa on
those files..

If you use a \*NIX machine with **curlftpfs** and **bash** available,
you can also run

.. code:: bash


to mount the database to the example directory and start converting mzML


.. figure::
:alt: workflow


A modified version of the ontology extraction from this blog[1] was
used, and a slightly modified class from pymzml[2]


.. |Build Status| image::

.. |Py versions| image::

.. |Version| image::

.. |GitHub| image::

.. |License| image::

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
mzml2isa-0.4.9a0-py3-none-any.whl (134.9 kB) Copy SHA256 hash SHA256 Wheel 3.5

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page