Skip to main content

Python package for the high-thoroughput nontargeted metabolite fingerprinting of nominal mass direct injection mass spectrometry.

Project description

HERE BE DRAGONS: This project is largely undocumented and untested, I do aim on sorting it all out eventually.

Python package for the high-thoroughput nontargeted metabolite fingerprinting of nominal mass direct injection mass spectrometry from mzML files.

Implementation of the methods detailed in:

High-throughput, nontargeted metabolite fingerprinting using nominal mass flow injection electrospray mass spectrometry

Beckmann, et al. (2008) - doi:10.1038/nprot.2007.500


DIMEpy requires Python 2.7.+ and is unfortunately not compatible with Python 3.

You can install it through pypi using pip:

pip install dimepy

Or alternatively install it manually using git:

git clone
cd DIMEpy
python install

Bug reporting

Please report all bugs you find in the issues tracker. We would welcome all sorts of contribution, so please be as candid as you want.



The following script takes a path containing mzML files, processes them following the Beckmann, et al protocol and exports the result to an Excel file.

# Importing modules required to run this script.

import dimepy
import os

# Path containing mzML files.
mzMLpaths = "/dir/to/mzMLs/"

# Path to save the output.
output_directory = "/output/directory/"

# mzML parameters.
parameters = {
    "MS1 Precision" : 1e-6,
    "MSn Precision" : 1e-6,
    "Measured Precision" : 1e-6,
    "Scan Range" : "apex",
    "Peak Type" : "peaks"

# Object to store processed spectrum.

for polarity in ["negative", "positive"]:
    spectrum_list = dimepy.SpectrumList()

    for index, file in enumerate(os.listdir(mzMLpaths)):
        # Read a mzML file from a given directory, and process it using given parameters.
        spectrum = dimepy.Spectrum(file_path=os.path.join(mzMLpaths, file),
                                   polarity=polarity, parameters=parameters)
        # Applying TIC normalisation
        # Applying generalised log transformation.
        # Adding the processed spectrum to the spectrum list.

    # Create a spectrum list processor.
    processor = dimepy.SpectrumListProcessor(spectrum_list)

    # Apply MAD outlier detection.

    # Bin the spectrum to 0.25 m/z widths.

    # Value imputation and value thresholding.
    processor.value_imputation(method="basic", threshold=0.5)

    # Applying mass-wise pareto scaling to the spectrum list.

    # Export the processed spectrum list back to a spectrum list object.
    processed_spectrum_list = processor.to_spectrumlist()

    # Convert the spectrum list to a Pandas DataFrame.
    df = processed_spectrum_list.flatten_to_dataframe()

    # Export processed spectrum to to Excel.
    df.to_excel(os.path.join(output_directory, polarity+".xlsx"))


DIMEpy is licensed under the GNU General Public License v2.0.

Project details

Download files

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

Source Distribution

dimepy-0.0.9.tar.gz (8.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page