pepfrag package

Module contents

class pepfrag.Mass(mono: float, avg: float)

Bases: object

Represents a mass pair of monoisotopic and average masses.

  • mono – Monoisotopic mass.
  • avg – Average mass.
class pepfrag.MassType

Bases: enum.Enum

An enumeration representing the possible mass types.

Note that the values of these enumerations correspond to their index in Mass, and similarly in the C++ code underneath methods such as calculate_mass.

mono = 0

Monoisotopic mass

avg = 1

Average mass

class pepfrag.IonType

Bases: enum.Enum

Enumeration of possible fragment ion types.

precursor = 1

Precursor ions

imm = 2

Immonium ions

b = 3

b-type ions

y = 4

y-type ions

a = 5

a-type ions

c = 6

c-type ions

z = 7

z-type ions

x = 8

x-type ions

class pepfrag.ModSite(mass: float, site: Union[int, str], mod: str)

Bases: object

Class representing an instance of mod_name at position site.

  • mass – Mass of the modification.
  • site – Position of the modification. Integer for sequence position, ‘nterm’ for N-terminus or ‘cterm’ for C-terminus.
  • mod – Name of the modification.
class pepfrag.Peptide(sequence: str, charge: int, modifications: Sequence[pepfrag.pepfrag.ModSite], mass_type: pepfrag.constants.MassType = <MassType.mono: 0>, radical: bool = False)

Bases: object

A class to represent a peptide, including its charge state and any modifications, including PTMs and quantitative tags. The class should be used to fragment the peptides for mass spectrum annotation.


Type of masses used in calculations (see MassType).


Flag indicating whether the peptide is a radical peptide.


The mass of the peptide along the sequence, with each position calculated separately.


In the returned list, index 0 is the N-terminus mass, while index -1 is the C-terminus mass.


Total mass of the peptide, including modifications.


Calculates the mass-to-charge ratio of the peptide.

calculate_mass() → List[float]

Calculates the theoretical mass of the peptide along the sequence, including any modifications.

Returns:Masses along the peptide sequence. Index 0 is the N-terminus mass, while index -1 is the C-terminus mass.
fragment(ion_types: Optional[Dict[pepfrag.pepfrag.IonType, List[Union[str, Tuple[str, float]]]]] = None) → List[Tuple[float, str, int]]

Fragments the peptide to generate the ion types specified.

Parameters:ion_types – Dictionary of IonType s to list of configured neutral losses. Only fragments for IonType s specified here will be generated.
Returns:List of generated ions, as tuples of (fragment mass, ion label, sequence position).