Skip to main content

MzML Ripper

This package parses MzML files and extracts data into JSON format for easier processing.

Extracts the following information:

  • MS1 Information

  • MS2 Information

  • MS3 Information

  • MS4 Information

  • For each spectrum in MS1/2/3/4:

    • Masses and Intensities
    • Parent of that spectrum
    • Retention time of that spectrum
    • List of masses

Installation

Mzmlripper is available through Pip (Python Package Index):

pip install mzmlripper --user

Source code will be made available in due course.

Dependencies

If you want to use the (optional) SPectraL hASHing functions (see https://splash.fiehnlab.ucdavis.edu/ for more details), you may want to install pySPLASH with the following commands:

git clone git://github.com/berlinguyinca/spectra-hash.git
cd spectra-hash/python
python setup.py install


Usage

Import the extractor and give it a file/directory and an output directory for the JSON files

# Import module
import mzmlripper.extractor as ripper

# Process an mzML file
ripper_data = ripper.process_mzml_file(mzml_filename, target_directory)

# Using the pySPLASH functions
import mzmlripper.splash_helpers as spl

# Add splash to each ripper function
splashed_ripper_data = spl.splash_ripper_dict(ripper_data)

Output

Standard Output

The file output is in the following format:

{
    "ms1": {
        "spectrum_1": {
            "95.3423": 160,
            "96.8473": 322,
            "110.8476": 640253,
            ...
            "parent": "",
            "retention_time": "0.9685",
            "mass_list": [
                95.3423,
                96.8473,
                110.8476
                ...
            ]
        },
        "spectrum_2": {
            ...
        },
        ...
    },
    "ms2": {
        "spectrum_1": {
            "101.2356": 4552,
            "102.5398": 12369,
            "102.9856": 845,
            ...
            "parent": "235.6523",
            "retention_time": "1.1203",
            "mass_list": [
                101.2356,
                102.5398,
                102.9856,
                ...
            ]
        },
        "spectrum_2": {
            ...
        },
        ...
    },
    "ms3": {
        "spectrum_1": {
            "67.3434": 142,
            "69.8364": 1325,
            "72.9746": 3320,
            ...
            "parent": "102.2365",
            "retention_time": "1.0253",
            "mass_list": [
                67.3434,
                69.8364,
                72.9746,
                ...
            ]
        },
        "spectrum_2": {
            ...
        },
        ...
    },
    "ms4": {
        "spectrum_1": {
            "45.2036": 1234,
            "46.3210": 8853,
            "49.3205": 12342,
            ...
            "parent": "115.3256",
            "retention_time": "2.0365",
            "mass_list": [
                45.2036,
                46.3120,
                49.3205,
                ...
            ]
        },
        "spectrum_2": {
            ...
        },
        ...
    }
}

Relative Intensity Output

The example above shows standard output of mzmlripper, with absolute intensity values of individual ions. However, there is also an option for displaying relative intensity values of ions in spectra:

# Process an mzML file with final output showing relative intensities
ripper_data = ripper.process_mzml_file(mzml_filename, target_directory, relative=True)

This will result in output of a very similar format to the standard output, with two differences:

  1. Intensity values are relative, with the most intense peak being set to 100 %
  2. The base peak (most intense peak) is recorded in each spectrum, along with its absolute intensity. This enables the original, absolute intensity values of all peaks to be calculated later if required.

Here is the above example converted to relative intensity spectra:

{
    "ms1": {
        "spectrum_1": {
            "95.3423": 0.0250,
            "96.8473": 0.0503,
            "110.8476": 100,
            ...
            "parent": "",
            "base_peak": [110.8476, 640253],
            "retention_time": "0.9685",
            "mass_list": [
                95.3423,
                96.8473,
                110.8476
                ...
            ]
        },
        "spectrum_2": {
            ...
        },
        ...
    },
    "ms2": {
        "spectrum_1": {
            "101.2356": 36.8017,
            "102.5398": 100,
            "102.9856": 6.8316,
            ...
            "parent": "235.6523",
            "base_peak": [102.5398, 12369],
            "retention_time": "1.1203",
            "mass_list": [
                101.2356,
                102.5398,
                102.9856,
                ...
            ]
        },
        "spectrum_2": {
            ...
        },
        ...
    },
    ...
}

Authors

All software was written as part of the Cronin Lab 2019


Contributions


License

MIT

Metadata

Release files for mzmlripper 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mzmlripper 1.3.1
File Size Uploaded Provenance Actions
mzmlripper-1.3.1.tar.gz 15.8 kB Without provenance Details for mzmlripper-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mzmlripper 1.3.1
File Interpreter ABI Platform Actions
mzmlripper-1.3.1-py3-none-any.whl Python 3 none any Details for mzmlripper-1.3.1-py3-none-any.whl

Total release size: 32.7 kB

Release files / mzmlripper-1.3.1.tar.gz

Download URL mzmlripper-1.3.1.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bf057b76e621c2b1442f7a48122aaa196ea847485de23dd6a74073f64fe661c2
BLAKE2b-256 checksum
How to use checksums
b1cb1c81ffdc4e29dc5c1630e05d8a1bab010fc6f7f811edd9150e0c8ea5a4d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.6

Release files / mzmlripper-1.3.1-py3-none-any.whl

Download URL mzmlripper-1.3.1-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5de490b34cc0be07860a2a827cbba332b2472828f270269e189dca0cc409a4a7
BLAKE2b-256 checksum
How to use checksums
72fb3da65c073d226ba2b29519aca2075917230a18a8dadb0fb79ba0f109ba85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.6

Security for mzmlripper 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page