Skip to main content

A library for peptide fragment ion generation

Project description

pepfrag

Python package codecov

pepfrag is a library for generating possible dissociation fragment ions of peptides in tandem mass spectrometry experiments.

Table of Contents

Installation

pepfrag can be installed from PyPI.

Compatibility

pepfrag is written using Python 3 and should be compatible with most operating systems. The package has been tested on

  • Windows 10
  • MacOS 10.15
  • Ubuntu 18.04 LTS

Because pepfrag includes C/C++ extensions, installation requires the presence of a C++ 11 compatible compiler on your machine.

Instructions

  1. Install Python 3 (>= version 3.6).
  2. Install the latest version of the pepfrag library using pip:
pip install pepfrag

Usage

Peptide Construction

pepfrag provides one key public class: Peptide. This class includes public methods for computing the mono/average mass of the peptide, including any configured modifications (ModSites), and the peptide fragment ions, with configurable neutral losses.

A Peptide can be constructed from its amino acid sequence, charge state and modifications, for example:

from pepfrag import MassType, ModSite, Peptide

peptide = Peptide(
    "ABCMPK", 
    2, 
    (ModSite(15.994915, 4, "Oxidation"), ModSite(304.20536, "nterm", "iTRAQ8plex")),
    mass_type=MassType.mono
)

Peptide modifications are defined using a sequence of ModSite instances, which are namedtuples defined by the mass of the modification (float), the site of the modification (string for terminal modifications or 1-indexed integer otherwise) and the name of the modification.

The Peptide constructor has two keyword parameters:

  • mass_type:
    • Description: The type of mass to calculate.
    • Type: MassType enumeration.
    • Default: MassType.mono.
  • radical:
    • Description: Flag indicating whether radical cation fragments should be generated.
    • Type: bool.
    • Default: False.

Fragment Generation

Fragment ions can be generated using the fragment method; for efficiency when the same Peptide instance is used repeatedly, the resulting fragments are cached on the instance. This cache is invalidated if the instance attributes are changed.

The fragment method has two keyword parameters:

  • ion_types:
    • Description: The types of fragment ion species to generate. The default setup would generate precursor, immonium, b, y, a, c and z ions.
    • Type: dictionary mapping IonType enumeration instances to possible neutral loss species, represented as strings for the most common neutral losses (i.e. those configured in pepfrag, namely 'H2O', 'NH3', 'CO2' and 'CO'). For additional losses, these can be input as tuples of (name (str), mass (float)).
    • Default:
    from pepfrag import IonType
    
    DEFAULT_IONS = {
        IonType.precursor: ['H2O', 'NH3', 'CO2'],
        IonType.imm: [],
        IonType.b: ['H2O', 'NH3', 'CO'],
        IonType.y: ['NH3', 'H2O'],
        IonType.a: [],
        IonType.c: [],
        IonType.z: []
    }
    
    • Example:
    from pepfrag import IonType, Peptide
    
    peptide = Peptide('APYSMLK', 2, [])
    
    peptide.fragment(ion_types={
        IonType.b: ['NH3', ('customLoss', 17.04)]
    })
    
  • force:
    • Description: Flag indicating whether fragments should be forcibly regenerated, i.e. bypassing the cached ions.
    • Type: bool.
    • Default: False.

License

pepfrag is released under the terms of the MIT license.

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

pepfrag-0.4.1.tar.gz (16.6 kB view details)

Uploaded Source

File details

Details for the file pepfrag-0.4.1.tar.gz.

File metadata

  • Download URL: pepfrag-0.4.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for pepfrag-0.4.1.tar.gz
Algorithm Hash digest
SHA256 a192a9e305c98ad06ad67ae9237ae3c09b981b082fcdadc8be818c99198a0ba0
MD5 71ee5498a68e9c0a0ef8a6ea342f06a8
BLAKE2b-256 b4a7fb039a1fe80e766c04a14c72442cc2a30c72dd05b50147d4723c942c9220

See more details on using hashes here.

Supported by

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