Peptidoform#

class pyopenms.Peptidoform#

Bases: object

A single peptidoform (one peptide chain) with modifications Represents a complete peptide chain including global modifications, unlocalised modifications, labile modifications, terminal modifications, and the amino acid sequence with modifications.

Note: The following fields are intentionally not exposed and should be accessed via the ProForma parser/writer API functions:

  • name: optional peptidoform name (v2.1 extension)

  • sequence: the amino acid sequence with modifications (complex type)

  • global_mods: global modifications like isotope labels (complex type)

__init__() → None#
__init__(arg: pyopenms.Peptidoform, /) → None

Methods

__init__()

canCalculateMass()

Check if mass can be calculated for this peptidoform.

canGenerateSpectrum()

Check if a theoretical spectrum can be generated.

fromAASequence(aas)

Create a Peptidoform from an AASequence.

fromJSON(json_str)

Create a Peptidoform from a JSON string.

fromString(proforma_string)

Parse a ProForma string and return a Peptidoform.

generateSpectrum([min_charge, max_charge, ...])

Generate a theoretical MS/MS spectrum.

getAASequenceConversionIssues()

Get conversion issues for AASequence conversion.

getMZ(charge)

Calculate m/z at a given charge state.

getMassCalculationIssues()

Get issues preventing mass calculation.

getMonoWeight()

Calculate monoisotopic mass in Daltons.

getSpectrumGenerationIssues()

Get issues preventing spectrum generation.

isRepresentableAsAASequence()

Check if this peptidoform can be fully represented as an AASequence.

toAASequence([policy])

Convert to an OpenMS AASequence.

toString([mode])

Convert to ProForma string notation.

Attributes

c_term_mods

labile_mods

n_term_mods

unlocalised_mods

(self) -> list[OpenMS::ProForma::UnlocalisedMod]

property c_term_mods: list[pyopenms.Modification]#
canCalculateMass() → bool#

Check if mass can be calculated for this peptidoform.

canGenerateSpectrum() → bool#

Check if a theoretical spectrum can be generated.

classmethod fromAASequence(aas)#

Create a Peptidoform from an AASequence.

Parameters#

aasAASequence

An OpenMS AASequence object.

Returns#

Peptidoform

A Peptidoform representing the same peptide.

Examples#

>>> aas = AASequence.fromString("PEPTIDE")
>>> pf = Peptidoform.fromAASequence(aas)
classmethod fromJSON(json_str: str)#

Create a Peptidoform from a JSON string.

Parameters#

json_strstr

A JSON string representing a Peptidoform.

Returns#

Peptidoform

The deserialized Peptidoform.

classmethod fromString(proforma_string: str)#

Parse a ProForma string and return a Peptidoform.

Parameters#

proforma_stringstr

A ProForma v2 notation string (e.g., “EM[UNIMOD:35]K”).

Returns#

Peptidoform

The parsed peptidoform AST.

Raises#

RuntimeError

If the string cannot be parsed.

Examples#

>>> pf = Peptidoform.fromString("EM[UNIMOD:35]K")
>>> pf.toString()
'EM[UNIMOD:35]K'
generateSpectrum(min_charge: int = 1, max_charge: int = 2, ion_types: str = 'by', add_losses: bool = False, add_metainfo: bool = False)#

Generate a theoretical MS/MS spectrum.

Parameters#

min_chargeint

Minimum fragment charge state (default: 1).

max_chargeint

Maximum fragment charge state (default: 2).

ion_typesstr

Ion types to generate: a,b,c,x,y,z for ion series, M for precursor, I for immonium (default: “by”).

add_lossesbool

Include neutral losses (default: False).

add_metainfobool

Add peak annotations (default: False).

Returns#

MSSpectrum

The theoretical spectrum.

getAASequenceConversionIssues()#

Get conversion issues for AASequence conversion.

Returns#

list of ConversionIssue

Issues that would arise during conversion.

getMZ(charge: int) → float#

Calculate m/z at a given charge state.

Parameters#

chargeint

Charge state.

Returns#

float

The m/z value.

getMassCalculationIssues()#

Get issues preventing mass calculation.

Returns#

list of ConversionIssue

Issues preventing mass calculation.

getMonoWeight() → float#

Calculate monoisotopic mass in Daltons.

Returns#

float

Monoisotopic mass.

getSpectrumGenerationIssues()#

Get issues preventing spectrum generation.

Returns#

list of ConversionIssue

Issues preventing spectrum generation.

isRepresentableAsAASequence() → bool#

Check if this peptidoform can be fully represented as an AASequence.

property labile_mods: list[pyopenms.LabileModification]#
property n_term_mods: list[pyopenms.Modification]#
toAASequence(policy=None)#

Convert to an OpenMS AASequence.

Parameters#

policyProForma.ConversionPolicy, optional

Conversion policy. Defaults to BEST_EFFORT.

Returns#

AASequence

The converted sequence.

Raises#

RuntimeError

If policy is FAIL_ON_LOSS and conversion cannot be lossless.

toString(mode=None) → str#

Convert to ProForma string notation.

Parameters#

modeProForma.WriteMode, optional

LOSSLESS (default) preserves original formatting, CANONICAL produces normalized output.

Returns#

str

The ProForma string representation.

property unlocalised_mods: list[pyopenms.UnlocalisedMod]#

(self) -> list[OpenMS::ProForma::UnlocalisedMod]