AASequence#

class pyopenms.AASequence#

Bases: object

Cython implementation of _AASequence

Original C++ documentation is available here

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

__init__()#

Overload:

__init__(self) None

Overload:

__init__(self, in_0: AASequence) None

Methods

__init__

Overload:

empty(self)

Check if sequence is empty

fromString

__static_AASequence_fromString(s: Union[bytes, str, String] ) -> AASequence

fromStringPermissive

__static_AASequence_fromStringPermissive(s: Union[bytes, str, String] , permissive: bool ) -> AASequence

getAAFrequencies

getAverageWeight

Overload:

getCTerminalModification(self)

Returns a copy of the name C-terminal modification object, or None

getCTerminalModificationName(self)

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

getFormula

Overload:

getMZ

Overload:

getMonoWeight

Overload:

getNTerminalModification(self)

Returns a copy of the name N-terminal modification object, or None

getNTerminalModificationName(self)

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

getPrefix(self, index)

Returns a peptide sequence of the first index residues

getResidue(self, index)

Returns the residue at position index

getSubsequence(self, index, number)

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

getSuffix(self, index)

Returns a peptide sequence of the last index residues

has(self, residue)

Returns true if the peptide contains the given residue

hasCTerminalModification(self)

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

hasNTerminalModification(self)

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

hasPrefix(self, peptide)

Returns true if the peptide has the given prefix

hasSubsequence(self, peptide)

Returns true if the peptide contains the given peptide

hasSuffix(self, peptide)

Returns true if the peptide has the given suffix

isModified(self)

Returns true if any of the residues or termini are modified

setCTerminalModification

Overload:

setCTerminalModificationByDiffMonoMass(self, ...)

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

setModification

Overload:

setModificationByDiffMonoMass(self, index, ...)

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

setNTerminalModification

Overload:

setNTerminalModificationByDiffMonoMass(self, ...)

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

size(self)

Returns the number of residues

toBracketString

Overload:

toString(self)

Returns the peptide as string with modifications embedded in brackets

toUniModString(self)

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

toUnmodifiedString(self)

Returns the peptide as string without any modifications

empty(self) bool#

Check if sequence is empty

fromString()#

__static_AASequence_fromString(s: Union[bytes, str, String] ) -> AASequence

fromStringPermissive()#

__static_AASequence_fromStringPermissive(s: Union[bytes, str, String] , permissive: bool ) -> AASequence

getAAFrequencies()#
getAverageWeight()#

Overload:

getAverageWeight(self) float

Returns the average weight of the peptide

Overload:

getAverageWeight(self, type_: int, charge: int) float
getCTerminalModification(self) ResidueModification#

Returns a copy of the name C-terminal modification object, or None

getCTerminalModificationName(self) bytes | str | String#

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

getFormula()#

Overload:

getFormula(self) EmpiricalFormula

Convenience function with ResidueType=Full and charge = 0 by default

Overload:

getFormula(self, type_: int, charge: int) EmpiricalFormula
getMZ()#

Overload:

getMZ(self, charge: int) float

Returns the mass-to-charge ratio of the peptide

Overload:

getMZ(self, charge: int, type_: int) float
getMonoWeight()#

Overload:

getMonoWeight(self) float

Returns the mono isotopic weight of the peptide

Overload:

getMonoWeight(self, type_: int, charge: int) float
getNTerminalModification(self) ResidueModification#

Returns a copy of the name N-terminal modification object, or None

getNTerminalModificationName(self) bytes | str | String#

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

getPrefix(self, index: int) AASequence#

Returns a peptide sequence of the first index residues

getResidue(self, index: int) Residue#

Returns the residue at position index

getSubsequence(self, index: int, number: int) AASequence#

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

getSuffix(self, index: int) AASequence#

Returns a peptide sequence of the last index residues

has(self, residue: Residue) bool#

Returns true if the peptide contains the given residue

hasCTerminalModification(self) bool#

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

hasNTerminalModification(self) bool#

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

hasPrefix(self, peptide: AASequence) bool#

Returns true if the peptide has the given prefix

hasSubsequence(self, peptide: AASequence) bool#

Returns true if the peptide contains the given peptide

hasSuffix(self, peptide: AASequence) bool#

Returns true if the peptide has the given suffix

isModified(self) bool#

Returns true if any of the residues or termini are modified

setCTerminalModification()#

Overload:

setCTerminalModification(self, modification: bytes | str | String) 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)

Overload:

setCTerminalModification(self, mod: ResidueModification) None

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

setCTerminalModificationByDiffMonoMass(self, 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()#

Overload:

setModification(self, index: int, modification: bytes | str | String) None

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

Overload:

setModification(self, index: int, modification: 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(self, index: int, diffMonoMass: float) None#

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

setNTerminalModification()#

Overload:

setNTerminalModification(self, modification: bytes | str | String) 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)

Overload:

setNTerminalModification(self, mod: ResidueModification) None

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

setNTerminalModificationByDiffMonoMass(self, 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(self) int#

Returns the number of residues

toBracketString()#

Overload:

toBracketString(self) bytes | str | String

Create a TPP compatible string of the modified sequence using bracket notation. Uses integer mass by default

Overload:

toBracketString(self, integer_mass: bool) bytes | str | String

Create a TPP compatible string of the modified sequence using bracket notation

Overload:

toBracketString(self, integer_mass: bool, mass_delta: bool) bytes | str | String

Create a TPP compatible string of the modified sequence using bracket notation.

Overload:

toBracketString(self, integer_mass: bool, mass_delta: bool, fixed_modifications: List[bytes]) bytes | str | String

Create a TPP compatible string of the modified sequence using bracket notation

toString(self) bytes | str | String#

Returns the peptide as string with modifications embedded in brackets

toUniModString(self) bytes | str | String#

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

toUnmodifiedString(self) bytes | str | String#

Returns the peptide as string without any modifications