AASequence#

class pyopenms.AASequence#

Bases: object

Representation of a peptide/protein sequence This class represents amino acid sequences in OpenMS. An AASequence instance primarily contains a sequence of residues.

__init__() → None#
__init__(arg: pyopenms.AASequence, /) → None
__init__(sequence: str) → None
__init__(arg: str, /) → None
__init__(arg0: str, arg1: bool, /) → None

Overloaded function.

  1. __init__() -> None

Default constructor - creates empty sequence

  1. __init__(arg: pyopenms.AASequence, /) -> None

Copy constructor

  1. __init__(sequence: str) -> None

Create AASequence from string (e.g., ‘PEPTIDE’)

  1. __init__(arg: str, /) -> None

  2. __init__(arg0: str, arg1: bool, /) -> None

Methods

__init__()

Overloaded function.

empty()

Check if sequence is empty

fromString(s)

Create AASequence from string (deprecated - use AASequence(s) constructor)

fromStringPermissive(s, permissive)

Create AASequence from string with permissive mode

getAAFrequencies()

Returns the amino acid frequencies of the peptide

getAverageWeight()

Overloaded function.

getCTerminalModification()

Returns a copy of the C-terminal modification object, or None if not modified

getCTerminalModificationName()

Returns the name (ID) of the C-terminal modification, or an empty string if none is set

getFormula()

Overloaded function.

getMZ(charge)

Overloaded function.

getMonoWeight()

Overloaded function.

getNTerminalModification()

Returns a copy of the N-terminal modification object, or None if not modified

getNTerminalModificationName()

Returns the name (ID) of the N-terminal modification, or an empty string if none is set

getPrefix(index)

Returns a peptide sequence of the first index residues

getResidue(index)

Returns a copy of the residue at position index

getSubsequence(index, number)

Returns a peptide sequence of number residues, beginning at position index

getSuffix(index)

Returns a peptide sequence of the last index residues

has(residue)

Returns true if the peptide contains the given residue

hasCTerminalModification()

Predicate which is true if the peptide is C-term modified

hasNTerminalModification()

Predicate which is true if the peptide is N-term modified

hasPrefix(peptide)

Returns true if the peptide has the given prefix

hasSubsequence(peptide)

Returns true if the peptide contains the given peptide

hasSuffix(peptide)

Returns true if the peptide has the given suffix

isModified()

Returns true if any of the residues or termini are modified

setCTerminalModification(modification)

Overloaded function.

setCTerminalModificationByDiffMonoMass(...)

Sets the C-terminal modification by the monoisotopic mass difference it introduces (creates a "user-defined" mod if not present)

setModification(index, modification)

Overloaded function.

setModificationByDiffMonoMass(index, ...)

Modifies the residue at index in the sequence and potentially in the ResidueDB

setNTerminalModification(modification)

Overloaded function.

setNTerminalModificationByDiffMonoMass(...)

Sets the N-terminal modification by the monoisotopic mass difference it introduces (creates a "user-defined" mod if not present)

size()

Returns the number of residues

toBracketString([integer_mass, mass_delta, ...])

Returns the bracket string representation of the peptide

toString()

Returns the peptide as string with modifications embedded in brackets

toUniModString()

Returns the peptide as string with UniMod-style modifications embedded in brackets

toUnmodifiedString()

Returns the peptide as string without any modifications

empty() → bool#

Check if sequence is empty

static fromString(s: str) → pyopenms.AASequence#

Create AASequence from string (deprecated - use AASequence(s) constructor)

static fromStringPermissive(s: str, permissive: bool) → pyopenms.AASequence#

Create AASequence from string with permissive mode

getAAFrequencies() → dict[str, int]#

Returns the amino acid frequencies of the peptide

getAverageWeight() → float#
getAverageWeight(type: pyopenms.Residue.ResidueType, charge: int) → float

Overloaded function.

  1. getAverageWeight() -> float

Returns the average weight of the peptide

  1. getAverageWeight(type: pyopenms.Residue.ResidueType, charge: int) -> float

Returns the average weight of the peptide with specified residue type and charge

getCTerminalModification() → pyopenms.ResidueModification | None#

Returns a copy of the C-terminal modification object, or None if not modified

getCTerminalModificationName() → str#

Returns the name (ID) of the C-terminal modification, or an empty string if none is set

getFormula() → pyopenms.EmpiricalFormula#
getFormula(type: pyopenms.Residue.ResidueType, charge: int) → pyopenms.EmpiricalFormula

Overloaded function.

  1. getFormula() -> pyopenms.EmpiricalFormula

Returns the empirical formula of the peptide

  1. getFormula(type: pyopenms.Residue.ResidueType, charge: int) -> pyopenms.EmpiricalFormula

Returns the empirical formula of the peptide with specified residue type and charge

getMZ(charge: int) → float#
getMZ(charge: int, type: pyopenms.Residue.ResidueType) → float

Overloaded function.

  1. getMZ(charge: int) -> float

Returns the mass-to-charge ratio of the peptide

  1. getMZ(charge: int, type: pyopenms.Residue.ResidueType) -> float

Returns the mass-to-charge ratio of the peptide with specified residue type

getMonoWeight() → float#
getMonoWeight(type: pyopenms.Residue.ResidueType, charge: int) → float

Overloaded function.

  1. getMonoWeight() -> float

Returns the monoisotopic weight of the peptide

  1. getMonoWeight(type: pyopenms.Residue.ResidueType, charge: int) -> float

Returns the monoisotopic weight of the peptide with specified residue type and charge

getNTerminalModification() → pyopenms.ResidueModification | None#

Returns a copy of the N-terminal modification object, or None if not modified

getNTerminalModificationName() → str#

Returns the name (ID) of the N-terminal modification, or an empty string if none is set

getPrefix(index: int) → pyopenms.AASequence#

Returns a peptide sequence of the first index residues

getResidue(index: int) → pyopenms.Residue#

Returns a copy of the residue at position index

getSubsequence(index: int, number: int) → pyopenms.AASequence#

Returns a peptide sequence of number residues, beginning at position index

getSuffix(index: int) → pyopenms.AASequence#

Returns a peptide sequence of the last index residues

has(residue: pyopenms.Residue) → bool#

Returns true if the peptide contains the given residue

hasCTerminalModification() → bool#

Predicate which is true if the peptide is C-term modified

hasNTerminalModification() → bool#

Predicate which is true if the peptide is N-term modified

hasPrefix(peptide: pyopenms.AASequence) → bool#

Returns true if the peptide has the given prefix

hasSubsequence(peptide: pyopenms.AASequence) → bool#

Returns true if the peptide contains the given peptide

hasSuffix(peptide: pyopenms.AASequence) → bool#

Returns true if the peptide has the given suffix

isModified() → bool#

Returns true if any of the residues or termini are modified

setCTerminalModification(modification: str) → None#
setCTerminalModification(modification: pyopenms.ResidueModification) → None
setCTerminalModification(mod: pyopenms.ResidueModification) → None

Overloaded function.

  1. setCTerminalModification(modification: str) -> None

Sets the C-terminal modification (by lookup in the mod names of the ModificationsDB). Throws if nothing is found (since the name is not enough information to create a new mod)

  1. setCTerminalModification(modification: pyopenms.ResidueModification) -> None

Sets the C-terminal modification. The modification is interned into ModificationsDB, so a copy is stored rather than the object passed in

  1. setCTerminalModification(mod: pyopenms.ResidueModification) -> None

Sets the C-terminal modification (copies and adds to database if not present)

setCTerminalModificationByDiffMonoMass(diffMonoMass: float, protein_term: bool) → None#

Sets the C-terminal modification by the monoisotopic mass difference it introduces (creates a “user-defined” mod if not present)

setModification(index: int, modification: str) → None#
setModification(index: int, modification: pyopenms.Residue) → None
setModification(index: int, modification: pyopenms.ResidueModification) → None
setModification(index: int, modification: pyopenms.ResidueModification) → None

Overloaded function.

  1. setModification(index: int, modification: str) -> None

Sets the modification of the residue at position index. If an empty string is passed replaces the residue with its unmodified version

  1. setModification(index: int, modification: pyopenms.Residue) -> None

Sets the residue at position index. The residue must come from ResidueDB, since AASequence stores it by reference

  1. setModification(index: int, modification: pyopenms.ResidueModification) -> None

Sets the modification of the residue at position index. The modification is interned into ModificationsDB, so a copy is stored rather than the object passed in

  1. setModification(index: int, modification: pyopenms.ResidueModification) -> None

Sets the modification of AA at index by providing a ResidueModification object. Stricter than just looking for the name and adds the Modification to the DB if not present

setModificationByDiffMonoMass(index: int, diffMonoMass: float) → None#

Modifies the residue at index in the sequence and potentially in the ResidueDB

setNTerminalModification(modification: str) → None#
setNTerminalModification(modification: pyopenms.ResidueModification) → None
setNTerminalModification(mod: pyopenms.ResidueModification) → None

Overloaded function.

  1. setNTerminalModification(modification: str) -> None

Sets the N-terminal modification (by lookup in the mod names of the ModificationsDB). Throws if nothing is found (since the name is not enough information to create a new mod)

  1. setNTerminalModification(modification: pyopenms.ResidueModification) -> None

Sets the N-terminal modification. The modification is interned into ModificationsDB, so a copy is stored rather than the object passed in

  1. setNTerminalModification(mod: pyopenms.ResidueModification) -> None

Sets the N-terminal modification (copies and adds to database if not present)

setNTerminalModificationByDiffMonoMass(diffMonoMass: float, protein_term: bool) → None#

Sets the N-terminal modification by the monoisotopic mass difference it introduces (creates a “user-defined” mod if not present)

size() → int#

Returns the number of residues

toBracketString(integer_mass: bool = True, mass_delta: bool = False, fixed_modifications: list[str] = []) → str#

Returns the bracket string representation of the peptide

toString() → str#

Returns the peptide as string with modifications embedded in brackets

toUniModString() → str#

Returns the peptide as string with UniMod-style modifications embedded in brackets

toUnmodifiedString() → str#

Returns the peptide as string without any modifications