Coder Social home page Coder Social logo

brewman29 / pymassspec Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pymassspec/pymassspec

0.0 0.0 0.0 71.48 MB

Python Toolkit for Mass Spectrometry

Home Page: https://pymassspec.readthedocs.io/en/latest

License: GNU General Public License v2.0

Shell 0.26% Python 69.29% CSS 0.01% HTML 0.02% Jupyter Notebook 30.42%

pymassspec's Introduction

PyMassSpec

Python Toolkit for Mass Spectrometry

Docs Documentation Build Status Docs Check Status
Tests Linux Test Status Windows Test Status macOS Test Status Coverage
PyPI PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel
Anaconda Conda - Package Version Conda - Platform
Activity GitHub last commit Maintenance PyPI - Downloads
QA CodeFactor Grade Flake8 Status mypy status
Other License GitHub top language Requirements Status

PyMassSpec is a Python package for processing gas chromatography-mass spectrometry data. PyMassSpec provides a framework and a set of components for rapid development and testing of methods for processing of chromatography--mass spectrometry data. PyMassSpec can be used interactively through the Python shell, in a Jupyter Notebook, or the functions can be collected into scripts when it is preferable to perform data processing in the batch mode.

Forked from the original PyMS Repository: https://github.com/ma-bio21/pyms. Originally by Andrew Isaac, Sean O'Callaghan and Vladimir Likić. The original publication can be found here: https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-13-115

The original project seems to have been abandoned as there has been no activity since 2017.

Table of Contents

The PyMassSpec project

The directory structure of PyMassSpec is as follows:

/
├── pyms:      The PyMassSpec code
│
├── pyms-data: Example GC-MS data files
│
├── pyms-demo: Examples of how to use PyMassSpec
│
├── tests: pytest tests
│
└── doc-source: Sphinx source for documentation

Features

Installation

PyMassSpec can be installed with the following command:

$ pip --user install PyMassSpec

This will also install the following dependencies:

numpy >= 1.16.2
scipy >= 1.2.1
pymzml >= 2.2.1
matplotlib >= 3.0.2
openpyxl >= 2.6.2
netCDF4 >= 1.5.0
biopython >= 1.74
deprecation >= 2.0.6

PyMassSpec can also make use of 'mpi4py' if it is installed. See https://mpi4py.readthedocs.io/en/stable/ for further information.

Usage

A tutorial illustrating various PyMassSpec features in detail is provided in subsequent chapters of this User Guide. The commands executed interactively are grouped together by example, and can be found here.

The data used in the PyMassSpec documentation and examples is available here.

In the "Demos and Examples" section there is a page corresponding to each example, coded with the chapter number (ie. "pyms-demo/20a/" corresponds to the Example 20a, from Chapter 2).

Each example has a script named 'proc.py' which contains the commands given in the example. These scripts can be run with the following command:

$ python3 proc.py

Example processing GC-MS data

Download the file gc01_0812_066.jdx and save it in the folder data. This file contains GC-MS data in the the JCAMP-DX format.

First the raw data is loaded:

>>> from pyms.GCMS.IO.JCAMP import JCAMP_reader >>> jcamp_file = "data/gc01_0812_066.jdx" >>> data = JCAMP_reader(jcamp_file) -> Reading JCAMP file 'Data/gc01_0812_066.jdx' >>> data <pyms.GCMS.Class.GCMS_data at 0x7f3ec77da0b8>

The intensity matrix object is then built by binning the data:

>>> from pyms.IntensityMatrix import build_intensity_matrix_i >>> im = build_intensity_matrix_i(data)

In this example, we show how to obtain the dimensions of the newly created intensity matrix, then loop over all ion chromatograms, and for each ion chromatogram apply Savitzky-Golay noise filter and tophat baseline correction:

>>> n_scan, n_mz = im.size >>> from pyms.Noise.SavitzkyGolay import savitzky_golay >>> from pyms.TopHat import tophat >>> for ii in range(n_mz): ... print("working on IC", ii) ... ic = im.get_ic_at_index(ii) ... ic1 = savitzky_golay(ic) ... ic_smooth = savitzky_golay(ic1) ... ic_base = tophat(ic_smooth, struct="1.5m") ... im.set_ic_at_index(ii, ic_base)

The resulting noise and baseline corrected ion chromatogram is saved back into the intensity matrix.

Further examples can be found in the documentation

Contributing

Contributions are very welcome. Tests can be run with pytest. Please ensure the coverage is at least Coverage before you submit a pull request.

For further information see the section Contributing to PyMassSpec

License

PyMassSpec is Free and Open Source software released under the GNU General Public License version 2.

Issues

If you encounter any problems, please file an issue along with a detailed description.

pymassspec's People

Contributors

chrisdafo avatar domdfcoding avatar imgbot[bot] avatar ma-bio21 avatar pre-commit-ci[bot] avatar repo-helper[bot] avatar siggismara avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.