multiplierz.mass_biochem - BlaisProteomics/multiplierz GitHub Wiki

multiplierz.mass_biochem collects a set of tools for calculating analyte mass, in silico digestion and fragmentation, and also contains several bits of physical data that are useful to have on hand.


Functions

peptide_mass(peptide, mods = None)

Returns the mass of a given peptide, with the specified chemical modifications. The peptide should be given as an upper-case string of amino acid letter abbreviations (e.g., 'PEPTIDE'); the modifications can be given in several ways:

  • Floating-point mass in Daltons
  • Chemical formula (string or atom-to-dalton-mass dict)
  • Modification name (looked up in the dict multiplierz.ModificationFormulae, which may be safely customized with new modifications.)
  • Floating-point mass or modification name with a specified amino acid site in Mascot format, e.g.: 'M6: Oxidation' or 'M6: 16.000'.
  • A list or semicolon-separated list in string format of any of the above.

The return value is the mass of the modified peptide, in Daltons.

peptide_mz(peptide, mods, charge)

Returns the M/Z value of the given peptide and modifications, with the specified charge; charge should be an integer, peptide and mods should have the same format as for peptide_mass().

fragment(peptide, mods = [], charges = [1], ions = ['b', 'y'])

Returns an in silico fragmentation of the specified peptide, with the specified modifications and for the specified charge states and fragment ion types.

Modifications should be given as ': ' strings; e.g., 'M3: Oxidation' or 'C15: 567.8909'.

Currently only b and y ion fragmentation types are supported.

digest(peptide, enzyme = "Trypsin", missed_cleavages = 0)

Returns an in silico digest of the specified peptide with the given enzyme. The enzyme can be any member of multiplierz.EnzymeSpecification. A number of missed cleavages can be specified, to provide digest products where a number of restriction sites haven't been successfully cleaved.

Returns a list of (subsequence, (start-site, end-site), missed_cleavages) tuples.

add_protons(mass, charge)

Given an unprotonated analyte mass, returns the M/Z of the same molecule with the specified positive charge.

remove_protons(mass, charge)

The reverse of add_protons; given the M/Z of a charged analyte with the specified charge, returns the unprotonated mass.

Data

AminoAcidMasses

A dict of amino acids (by letter abbreviation) to (monoisotopic mass, average mass) tuples.

AminoAcidFormulas

A dict of amino acids (by letter abbreviation)-to-molecular formulas, given in atom-to-molecular count dicts, e.g.:

>>> AminoAcidFormulas['C']
{'C': 3, 'H': 7, 'N': 1, 'O': 2, 'S': 1}
>>> AminoAcidFormulas['K']['H']
14
EnzymeSpecification

A dict of enzyme names to their enzymatic specificity in regular expression form. This allows ready identification of restriction sites in amino acid sequences using Python's built-in regular expression module, e.g.:

>>> EnzymeSpecification['Trypsin']
'[KR][^P]'
>>> import re
>>> sites = re.finditer(EnzymeSpecification['Trypsin'], 'MRLEKDRFSVNLDVKHFSPEELKVKV')
>>> [s.start()+1 for s in sites] # Add 1 to recover 1-indexed site number!
[2, 5, 7, 15, 23, 25]
AtomicMass

A dict of monoisotopic element masses, by letter abbreviation.

⚠️ **GitHub.com Fallback** ⚠️