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

Installation

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 https://www.github.com/KeironO/DIMEpy
cd DIMEpy
python setup.py 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.

Contributors

Usage

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
        spectrum.normalise(method="tic")
        # Applying generalised log transformation.
        spectrum.transform(method="glog")
        # Adding the processed spectrum to the spectrum list.
        spectrum_list.add(spectrum)


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

    # Apply MAD outlier detection.
    processor.outlier_detection()

    # Bin the spectrum to 0.25 m/z widths.
    processor.binning(bin_size=0.25)

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

    # Applying mass-wise pareto scaling to the spectrum list.
    processor.scale(method="pareto")

    # 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"))

License

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.1.tar.gz (15.9 kB view details)

Uploaded Source

File details

Details for the file dimepy-0.0.9.1.tar.gz.

File metadata

  • Download URL: dimepy-0.0.9.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dimepy-0.0.9.1.tar.gz
Algorithm Hash digest
SHA256 95cb8865dcc822dd907a3e4584adc9125fca67b78024507afed8f49065af8ab9
MD5 bcbd88cc211af2480318c25e48fc2ebe
BLAKE2b-256 0884553246b7de9a8891ce93cb1a7234b725512684ae364d3d0e0ea65e6b0240

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page