Skip to content

Primitives

MassSpectrum(filename, scan_id, mz, intensity, ms_level=None, retention_time=None, ion_mobility=None, precursor_mz=None, precursor_charge=None, label=None)

Bases: MsmsSpectrum

A mass spectrum.

PARAMETER DESCRIPTION
filename

The file from which the spectrum originated.

TYPE: str

scan_id

The Hupo PSI standard scan identifier.

TYPE: str

mz

The m/z values.

TYPE: ArrayLike

intensity

The intensity values.

TYPE: ArrayLike

retention_time

The measured retention time.

TYPE: float | None DEFAULT: None

ion_mobility

The measured ion mobility.

TYPE: float | None DEFAULT: None

precursor_mz

The precursor ion m/z, if applicable.

TYPE: float | None DEFAULT: None

precursor_charge

The precursor charge, if applicable.

TYPE: int | None DEFAULT: None

label

A label for the mass spectrum. This is typically an annotation, such as the generating peptide sequence, but is distinct from spectrum_utils' annotation.

TYPE: str | None DEFAULT: None

Attributes

precursor_mass: float property

The monoisotopic mass.

usi: str property

The Universal Spectrum Identifier.

Functions

intensity(values)

Set the intensity array.

mz(values)

Set the m/z array.

to_tensor()

Combine the m/z and intensity arrays into a single tensor.

RETURNS DESCRIPTION
torch.tensor of shape (n_peaks, 2)

The mass spectrum information.

Peptide(sequence, modifications=None, charge=None) dataclass

A peptide sequence with or without modification and/or charge.

PARAMETER DESCRIPTION
sequence

The bare amino acid sequence.

TYPE: str

modifications

The modification at each amino acid. This should be the length of sequence + 2, where index 0 and -1 are used for N- and C-terminal modification respectively. Use None in the iterable to specify unmodified positions. When modifications is None, it is assumed that no modifications are present.

TYPE: iterable of str, float, or None DEFAULT: None

charge

The charge of the peptide.

TYPE: int DEFAULT: None

Functions

from_massivekb(sequence, charge=None) classmethod

Create a Peptide from MassIVE-KB annotations.

MassIVE-KB includes N-term carbamylation, NH3-loss, acetylation, as well as M oxidation, and deamidation of N and Q, in a manner that does not comply with the ProForma standard.

PARAMETER DESCRIPTION
sequence

The peptide sequence from MassIVE-KB

TYPE: str

charge

The charge state of the peptide.

TYPE: int DEFAULT: None

RETURNS DESCRIPTION
Peptide

The parsed MassIVE peptide after conversion to a ProForma format.

from_proforma(sequence) classmethod

Create a Peptide from a ProForma 2.0 string.

PARAMETER DESCRIPTION
sequence

A ProForma 2.0-compliant string.

TYPE: str

RETURNS DESCRIPTION
Peptide

The parsed ProForma peptide.

massivekb_to_proforma(sequence, charge=None) classmethod

Convert a MassIVE-KB peptide sequence to ProForma.

MassIVE-KB includes N-term carbamylation, NH3-loss, acetylation, as well as M oxidation, and deamidation of N and Q, in a manner that does not comply with ProForma.

PARAMETER DESCRIPTION
sequence

The peptide sequence from MassIVE-KB

TYPE: str

charge

The charge state of the peptide.

TYPE: int DEFAULT: None

RETURNS DESCRIPTION
str

The parsed MassIVE peptide after conversion to a ProForma format.

split()

Split the modified peptide for tokenization.

Molecule(smiles, charge=None) dataclass

A representation of a molecule.

PARAMETER DESCRIPTION
smiles

A SMILES string defining the molecule.

TYPE: str

charge

The charge of the molecule.

TYPE: int DEFAULT: None

Functions

from_selfies(selfies, charge=None) classmethod

Create a molecule from a SELFIES string.

PARAMETER DESCRIPTION
selfies

The SELFIES string defining the molecule.

TYPE: str

charge

The charge of the molecule.

TYPE: int DEFAULT: None

RETURNS DESCRIPTION
Molecule

The parsed Molecule.

show(**kwargs)

Show the molecule in 2D.

PARAMETER DESCRIPTION
**kwargs

Keyword arguments passed to rdkit.Chem.Draw.MolToImage

TYPE: dict DEFAULT: {}

to_selfies()

Convert SMILES to a SELFIES representaion.