Investigate mass spectra for chemical substances, especially ETD products.
Project description
masstodon
Your Python3 module for investigating the Electron Transfer Dissociation in Mass Spectrometry, and more generally finding stuff in the mass spectrum.
Prerequisites
Python3
Installation
The package can be installed directly from the Python Package Index:
pip install masstodon
Otherwise, download this github repo, use the default branch, and install the software with:
pip install .
from the folder containing setup.py.
This will let you import masstodon
simply by
import masstodon
Running
command line interface
It is possible to run masstodon
from command line after installing it from PIP.
Given that it would be not comfortable to input multiple compounds with their possible modifications and charges from the terminal, we have restricted (for now) the possibility to run masstodon
in the traditional case of studying precisely one protein and its c/z fragmentation patterns.
To see a detailed description of the possible arguments, open the terminal (or the Anaconda prompt on Windows, but seriously, Windows? You should feel guilty...) and write
masstodon -h
To run masstodon
, you do need to supply at least:
- the file with the spectrum
- the tolerance for the search in the m/z axis
- the amino acid sequence (fasta)
- the charge of the substance
All other parameters can be skipped, but it might be silly.
For instance, if you know that there is a particular PTM on a given amino acid,
you should supply the -m
parameter, and so on.
Python scripting
Importing data. You can analyze individual mass spectra with masstodon
.
This might very well be individual scans of an Orbitrap, or a general mass spectrum.
The easiest way to import the mass spectrum is to present a plain ASCII file with m/z and intensity values in each row, separated by tab or some other whitespace sign.
Running masstodon.
To call masstodon
with a single compound, use the masstodon_single
function.
For instance:
from masstodon.data.substanceP_wh15_wv400 import mz, intensity, fasta, modifications, z # input data
from masstodon.masstodon import masstodon_single # masstodon-proper
from pprint import pprint # nicer output in the terminal
print(mz)
# array([ 61.01 , 64.152, 66.515, ..., 1403.9 , 1485.578, 1497.226])
print(intensity)
# array([844.4 , 25.35, 190.1 , ..., 15.38, 55.62, 21. ])
print(fasta)
# 'RPKPQQFFGLM'
print(modifications)
# {'11': {'C_carbo': {'H': 1, 'N': 1, 'O': -1}}}
# (modify 11th amino-acid [starting from 1 for user-friendliness],
# by adding the chemical diff unto the group of atoms that include the C_carbo.)
print(z)
# 3
m = masstodon_single(mz, intensity, fasta, z,
min_mz_diff = 1.1, # this is actually the default
modifications = modifications,
orbitrap = False, # this ain't an orbitrap profile spectrum
threshold = "0.05 Da", # how far away to search for
isotopic_coverage = .999, # IsoSpec isotopic envelope coverage
min_prob = .8, # minimal acceptance probability of a candidate theoretical envelope.
std_cnt = 3 # m/z standard deviation count filter)
# for min_prob and std_cnt check out the publication under the filtering procedures.
print("Save spectrum to where you started your python from.")
m.plotly("spectrum.html", shape='rectangles', show=True)
print("Getting stats on inintial and final number of nodes and edges in the deconvolution graph.")
pprint(m.ome.G_stats)
print("Errors: absolute deviations and relative distance between spectra.")
pprint(m.imperator.errors())
print("Estimates of intensities of reactions and fragmentations.")
pprint(m.cz_simple.intensities)
pprint(m.cz_simple.probabilities)
print("Save all things under the given path.")
m.write(".")
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
File details
Details for the file masstodon-0.16.tar.gz
.
File metadata
- Download URL: masstodon-0.16.tar.gz
- Upload date:
- Size: 83.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bacc75e4aa678b1597788995bc125e1be8d2c90d4d0d2c7f4048f22590525fc |
|
MD5 | bb201732190b2ce133b4340b466adacb |
|
BLAKE2b-256 | e97d8df74fdf7aba0fd841e9c6dcb21994f97e4e726a4b5acba335a13bd7e0a9 |