PeptidoformIon#

class pyopenms.PeptidoformIon#

Bases: object

A peptidoform ion (one or more chains with optional charge)

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

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

  • charge: charge state specification (complex variant type)

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

Methods

__init__()

canCalculateMass()

Check if mass can be calculated for this peptidoform ion.

canGenerateSpectrum()

Check if a theoretical spectrum can be generated.

fromJSON(json_str)

Create a PeptidoformIon from a JSON string.

fromString(proforma_string)

Parse a ProForma string and return a PeptidoformIon.

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

Generate a theoretical MS/MS spectrum.

getMZ()

Calculate m/z using the embedded charge state.

getMassCalculationIssues()

Get issues preventing mass calculation.

getMonoWeight()

Calculate monoisotopic mass in Daltons.

getSpectrumGenerationIssues()

Get issues preventing spectrum generation.

toString([mode])

Convert to ProForma string notation.

Attributes

canCalculateMass() → bool#

Check if mass can be calculated for this peptidoform ion.

canGenerateSpectrum() → bool#

Check if a theoretical spectrum can be generated.

property chains: list[pyopenms.Peptidoform]#
classmethod fromJSON(json_str: str)#

Create a PeptidoformIon from a JSON string.

Parameters#

json_strstr

A JSON string representing a PeptidoformIon.

Returns#

PeptidoformIon

The deserialized PeptidoformIon.

classmethod fromString(proforma_string: str)#

Parse a ProForma string and return a PeptidoformIon.

Parameters#

proforma_stringstr

A ProForma v2 notation string with optional charge (e.g., “PEPTIDE/2”).

Returns#

PeptidoformIon

The parsed peptidoform ion AST.

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 (default: “by”).

add_lossesbool

Include neutral losses (default: False).

add_metainfobool

Add peak annotations (default: False).

Returns#

MSSpectrum

The theoretical spectrum.

getMZ() → float#

Calculate m/z using the embedded 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.

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.