schrodinger.protein.sequence module

Implementation of ProteinSequence, Sequence, and StructureSequence class.

StructureSequence allows iteration over all sequences in a given protein CT, and iteration over residues of each (in sequence order).

schrodinger.protein.sequence.guess_seq_type(res_names)

Takes an iterable of residue names and returns the appropriate sequence class

Parameters

res_names (Iterable(str)) – An iterable of residue names. Note that all residue names must be uppercase.

Returns

The appropriate class for the input sequence

Return type

Type[AbstractSingleChainSequence]

Note that we use a pretty simple heuristic here.

schrodinger.protein.sequence.make_sequence(elements, *args, **kwargs)

Guesses the appropriates Sequence type from the names of residues and returns an instance with those residues.

Parameters

elements (list(str)) – A list of strings to examine

Return type

protein.Sequence

Returns

An instance of the appropriate type

class schrodinger.protein.sequence.Sequence

Bases: object

class schrodinger.protein.sequence.AbstractSequence(*args, **kwargs)

Bases: schrodinger.protein.sequence.Sequence, PyQt6.QtCore.QObject

A base class for single-chain and combined-chain biological sequences.

Variables
  • ORIGIN (enum.Enum) – Possible sequence origins

  • AnnotationClass (annotation.SequenceAnnotations) – Class to use for annotations

  • ElementClass (Type[residue.Residue]) – Class to use for elements

  • ALPHABET (dict(str, residue.ElementType)) – A mapping of string representations of elements to element types. Concrete subclasses must define this.

  • _gap_chars (tuple(str)) – A tuple of permissible gap characters in the element list; the first item will be used for serialization.

  • _unknown_res_type (residue.ElementType) – The type for an unknown residue

  • residuesChanged (QtCore.pyqtSignal) – A signal emitted when sequence residues are changed. Emitted with the indices of the first and last changed residues.

  • lengthAboutToChange (QtCore.pyqtSignal) – A signal emitted when the sequence length is about to change. Emitted with the old and new lengths.

  • lengthChanged (QtCore.pyqtSignal) – A signal emitted when the sequence length is changed. Emitted with the old and new lengths.

  • nameChanged (QtCore.pyqtSignal) – A signal emitted when the sequence name is changed.

  • visibilityChanged (QtCore.pyqtSignal) – A signal emitted when the visibility is changed.

  • structureChanged (QtCore.pyqtSignal) – A signal emitted when the structure changes.

  • annotationTitleChanged (QtCore.pyqtSignal) – A signal emitted when an annotation title is changed.

class ORIGIN(value)

Bases: enum.Enum

An enumeration.

Maestro = 1
PyMOL = 2
AnnotationClass = None
ElementClass

alias of schrodinger.protein.residue.Residue

ALPHABET = {}
residuesRemoved
residuesAdded
residuesChanged
lengthAboutToChange
lengthChanged
nameChanged
visibilityChanged
structureChanged
annotationTitleChanged
pfamChanged
descriptorsCleared
__init__(*args, **kwargs)
residues()

Return an iterable of residues, ignoring gaps.

Returns

Iterable of residues

Return type

iter(Residue)

getNextResidue(res)

Return the next residue in the sequence (ignoring gaps) or None if this is the last residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getPreviousResidue(res)

Return the previous residue in the sequence (ignoring gaps) or None if this is the first residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

iterNeighbors()

Return an iterable of three element tuples consisting of (prev_res, curr_res, next_res), ignoring gaps.

None is used for neighbors of first and last residues in the sequence, and does not indicate gaps here.

Returns

Iterable of 3-tuples, each element of the each tuple being either a schrodinger.protein.residue.Residue or None

Return type

iter(tuple(Residue or NoneType, Residue, Residue or NoneType))

index(res)

Returns the index of the specified residue.

Parameters

res (residue.Residue) – The residue to find

Returns

The index of the residue

Return type

int

indices(residues)

Returns the indices of all specified residues. Note that there is no guarantee that the returned integers will be in the same order as the input residues. (For combined-chain sequences, it’s highly likely that they won’t be.)

Parameters

res (Iterable(residue.Residue)) – The residues to find indices of

Returns

The indices of the residues

Return type

list[int]

getRun(res)

For a given residue or gap, return a set of all adjacent element indices in the sequence that are also residues or gaps.

Parameters

res (residue.AbstractSequenceElement) – Residue to get the run of

Reuturn

Set of residue indices in the run

Return type

set(int)

insertElements(index, elements)

Insert a list of elements or sequence element into this sequence.

If elements is a string or iterable of strings, residue numbers will be automatically assigned.

Parameters
  • index (int) – The index at which to insert elements

  • elements (iterable(self.ElementClass) or iterable(str)) – A list of elements to insert

mutate(start, end, elements)

Mutate sequence elements starting at the given index to the provided elements.

Parameters
  • start (int) – The index at which to start mutating

  • end (int) – The index of the last mutated element (exclusive)

  • elements (iterable(self.ElementClass) or iterable(str)) – The elements to which to mutate the sequence

append(element)

Appends an element to the sequence

Parameters

element – The element to append to this sequence

Type

element: self.ElementClass or basestring

extend(elements)

Extends the sequence with elements from an iterable

Parameters

elements (iterable(self.ElementClass) or iterable(str)) – The iterable containing elements with which to extend this sequence

getSubsequence(start, end)

Return a sequence containing a subset of the elements in this one

Parameters
  • start (int) – The index at which the subsequence should start

  • end (int) – The index at which the subsequence should end (exclusive)

Returns

The requested subsequence

Return type

AbstractSequence

removeElements(eles)

Remove elements from the sequence.

Parameters

eles (list(residue.AbstractSequenceElement)) – A list of elements to remove from the sequence.

Raises

ValueError – If any of the given elements are not in the sequence.

property gap_char
getGaplessLength()
Returns

Length of this sequence ignoring gaps

Return type

int

getGaps()
Return type

list(residue.Gap)

Returns

The gaps in the sequence.

addGapsByIndices(gap_idxs)

Add gaps to the sequence from a list of gap indices. Note that these indices are based on numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see addGapsBeforeIndices.

Parameters

gap_idxs (list(int)) – A list of gap indices

validateGapIndices(gap_idxs)

Make sure that the specified gap indices are valid input for addGapsByIndices. If the indices are invalid, a ValueError will be raised. Indices are considered invalid if:

  • they refer to a position that’s more than one residue past the end of the sequence

  • they are negative

Parameters

gap_idxs (list[int]) – The gap indices to validate

addGapsBeforeIndices(indices)

Add one gap to the alignment before each of the specified residue positions. Note that these indices are based on numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices.

Parameters

indices (list(int)) – A list of indices to insert gaps before.

removeTerminalGaps()

Remove gaps from the end of the sequence

getTerminalGaps()

Return terminal gaps.

Returns

A list of terminal gaps (in ascending index order)

Return type

list(residue.Gap)

getGapCount()
Returns

the number of gaps in the sequence

Return type

int

removeAllGaps()

Remove gaps from the sequence

property annotations
getAnnotation(index, annotation)

Returns the annotation at the specified index or None for a gap.

Raises

ValueError – if the annotation is not available

getAnnotationValueForComparison(col, anno, ann_index=0, cdr_scheme=None, vernier=False)

Get an annotation value appropriate for determining whether two residues have the same annotation value. e.g. for binding site, only same-distance contacts of the same ligand should compare equal.

Parameters
  • anno (annotation.ProteinSequenceAnnotations.ANNOTATION_TYPES) – Protein sequence annotation enum member

  • ann_index (int) – Annotation index for multi-value annotations

  • cdr_scheme (annotation.AntibodyCDRScheme) – CDR scheme for antibody annotation. (Will be ignored if anno is not SEQ_ANNO_TYPES.antibody_cdr.)

  • vernier (bool) – Whether Vernier Zones are enabled

Returns

Annotation value for comparison or None if the corresponding residue is a gap or has no value for this annotation

Return type

object or None

getNumAnnValues(ann)
clearAllCaching()

This method should be implemented in subclasses that cache any data.

setPfam(new_pfam, pfam_name)
clearPfam()
hasPfam()
hasStructure()
Returns

Whether this sequence has an associated structure.

Return type

bool

getStructure()
Returns

The associated structure. Will return None if there is no associated structure.

Return type

schrodinger.structure.Structure or NoneType

setStructure(struc)

Set the associated structure. Can only be used on sequences with an associated structure.

Parameters

struc (schrodinger.structure.Structure) – The new structure for this sequence

Raises

RuntimeError – If there’s no structure associated with this sequence object.

getIdentity(other, consider_gaps=True, only_consider=None)

Return a float scoring the identity between the sequence and another sequence, assuming that they’re already aligned

Parameters
Returns

The sequence identity score (between 0.0 and 1.0)

Return type

float

getSimilarity(other, consider_gaps=True, only_consider=None)

Return a float score of the similarity count between the sequence and another sequence, assuming that they’re already aligned.

Parameters
Returns

The sequence similarity score (between 0.0 and 1.0)

Return type

float

getConservation(other, consider_gaps=True, only_consider=None)

Return a float scoring the homology conservation between the sequence and another sequence, assuming that they’re already aligned.

The homology criterion is based on “side chain chemistry” descriptor matching.

Parameters
Returns

The sequence conservation score (between 0.0 and 1.0)

Return type

float

getSimilarityScore(other, consider_gaps=True, only_consider=None)

Return the total score of similarity between the sequence and a other sequence, assuming that they’re already aligned.

Parameters
  • other (schrodinger.protein.sequence.Sequence) – A sequence to compare against

  • consider_gaps (bool) – Ignored because the similarity with a gap is 0.0

  • only_consider (set or None) – A set of residues to restrict attention to

Returns

The total sequence similarity score

Return type

int

getStructureResForRes(res)
Parameters

res (residue.Residue) – Residue to get structure residue for

Returns

Structure residue or None if no matching residue is found

Return type

schrodinger.structure._Residue or NoneType

structuredResidueCount()

Get the number of residues in this sequence with an associated structured residue. :rtype: int

hasStructuredResidues()

Return whether this sequence has any structured residues. This method is equivalent to bool(seq.structuredResidueCount()) but doesn’t (typically) require iterating through the entire sequence.

Return type

bool

getProperty(seq_prop)

Get the sequence’s value corresponding to the given SequenceProperty object

Parameters

seq_prop (schrodinger.protein.properties.SequenceProperty) – The object describing the sequence property

Returns

The value of the sequence property

Return type

float or None

updateDescriptors(descriptors, property_source)

Updates the descriptor dicts with new descriptor values

Parameters
  • descriptors (dict[str, float]) – A dict mapping descriptor names to their values

  • property_source (properties.PropertySource) – The source of the descriptors

clearDescriptors()
property descriptors
hasDescriptors()
blockSignals(self, b: bool) bool
childEvent(self, a0: QChildEvent)
children(self) List[QObject]
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent)
deleteLater(self)
destroyed

destroyed(self, object: typing.Optional[QObject] = None) [signal]

disconnect(a0: QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, signal: QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, a0: QEvent) bool
eventFilter(self, a0: QObject, a1: QEvent) bool
findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
inherits(self, classname: str) bool
installEventFilter(self, a0: QObject)
isSignalConnected(self, signal: QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
killTimer(self, id: int)
metaObject(self) QMetaObject
moveToThread(self, thread: QThread)
objectName(self) str
objectNameChanged

objectNameChanged(self, objectName: str) [signal]

parent(self) QObject
property(self, name: str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, signal: PYQT_SIGNAL) int
removeEventFilter(self, a0: QObject)
sender(self) QObject
senderSignalIndex(self) int
setObjectName(self, name: str)
setParent(self, a0: QObject)
setProperty(self, name: str, value: Any) bool
signalsBlocked(self) bool
startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
thread(self) QThread
timerEvent(self, a0: QTimerEvent)
tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str
class schrodinger.protein.sequence.AbstractSingleChainSequence(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=None)

Bases: schrodinger.protein.sequence.AbstractSequence

Base class for single-chain biological sequences

Note: Protein-specific functionality should go in ProteinSequence.

Variables

sequenceCopied (QtCore.pyqtSignal) – A signal emitted when this sequence is copied. Emitted with the sequence being copied and the newly created copy. This signal is used by the structure model to make sure that the newly created copy is kept in sync with the structure.

sequenceCopied
__init__(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=None)

Make a sequence object from a list of strings and/or self.ElementClass

Strings are converted to self.ElementClass using a mapping of strings to element types.

Parameters
  • elements (iterable(self.ElementClass or None) or iterable(str or None)) – An iterable of elements making up the sequence. None are interpretted as gaps.

  • name (str) – The name of the sequence (possibly shortened), used for display purposes. For a FASTA sequence, this should be a short identifier such as the Uniprot ID.

  • origin (Sequence.ORIGIN or None) – A piece of metadata indicating where the sequence came from

  • entry_id – An entry associated with the sequence, if any

  • entry_name – An entry name associated with the sequence, if any

  • pdb_id – An id associated with the sequence, if any

  • chain (str) – The chain to which the sequence belongs

  • structure_chain (str) – The chain of the structure this sequence is associated with. This is usually the same as chain if the sequence has a structure but isn’t necessarily.

  • long_name (str) – The full name of the sequence. For a FASTA sequence, this should be the full FASTA header.

  • resnums (Iterable(int)) – Residue numbers to assign to elements. If not given, residues will be numbered starting from one. Regardless of what’s given here, no residue numbering will occur if elements is an iterable of ElementClass and any element already has a residue number set. If this iterable is shorter than elements, additional numbers will be generated by incrementing the last number present.

Type

str

Type

str

Type

str

__len__()
__contains__(item)
classmethod makeSeqElement(element)
Parameters

element (str or cls.ElementClass) – A sequence element or string representation thereof

Returns

sequence element

Return type

cls.ElementClass

classmethod isValid(elements)
Parameters

elements (iterable(str) or str) – An iterable of string representations of elements making up the sequence

Returns

Tuple indicating whether valid and a set of invalid characters, if any

Return type

tuple(bool, set(str))

property name
property chain
property fullname
Returns

a formatted name + optional chain name for the sequence

Return type

str

property visibility
index(res, ignore_gaps=False)

Returns the index of the specified residue

Parameters
  • res (residue.Residue) – The residue to find

  • ignore_gaps (bool) – Whether the index returned should ignore gaps in the sequence or not.

Raises

A ValueError if the residue is not present

Return type

int

Returns

The index of the residue

indices(residues, ignore_gaps=False)

Returns the indices of all specified residues. Note that there is no guarantee that the returned integers will be in the same order as the input residues. (For combined-chain sequences, it’s highly likely that they won’t be.)

Parameters
  • res (Iterable(residue.Residue)) – The residues to find indices of

  • ignore_gaps (bool) – Whether the indices returned should ignore gaps in the sequence or not.

Returns

The indices of the residues

Return type

list[int]

insertElements(index, elements)

Insert a list of elements or sequence element into this sequence.

If elements is a string or iterable of strings, residue numbers will be automatically assigned.

Parameters
  • index (int) – The index at which to insert elements

  • elements (iterable(self.ElementClass) or iterable(str)) – A list of elements to insert

mutate(start, end, elements)

Mutate sequence elements starting at the given index to the provided elements.

Parameters
  • start (int) – The index at which to start mutating

  • end (int) – The index of the last mutated element (exclusive)

  • elements (iterable(self.ElementClass) or iterable(str)) – The elements to which to mutate the sequence

append(element)

Appends an element to the sequence

Parameters

element – The element to append to this sequence

Type

element: self.ElementClass or basestring

extend(elements)

Extends the sequence with elements from an iterable

Parameters

elements (iterable(self.ElementClass) or iterable(str)) – The iterable containing elements with which to extend this sequence

getSubsequence(start, end)

Return a sequence containing a subset of the elements in this one

Parameters
  • start (int) – The index at which the subsequence should start

  • end (int) – The index at which the subsequence should end (exclusive)

Returns

The requested subsequence

Return type

AbstractSequence

removeElements(eles)

Remove elements from the sequence.

Parameters

eles (list(residue.AbstractSequenceElement)) – A list of elements to remove from the sequence.

Raises

ValueError – If any of the given elements are not in the sequence.

getGaplessLength()
Returns

Length of this sequence ignoring gaps

Return type

int

addGapsByIndices(gap_idxs)

Add gaps to the sequence from a list of gap indices. Note that these indices are based on numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see addGapsBeforeIndices.

Parameters

gap_idxs (list(int)) – A list of gap indices

setSSA(new_ssa)
setSSAPredictions(pred)
setDisorderedRegionsPredictions(pred)
setDomainArrangementPredictions(pred)
setSolventAccessibilityPredictions(pred)
deletePrediction(prediction_type)
deleteAllPredictions()
property origin
Returns

A piece of metadata indicating where the sequence came from

Rtype origin

Sequence.ORIGIN or None

hasStructure()
Returns

Whether this sequence has an associated structure.

Return type

bool

getStructure()
Returns

The associated structure. Will return None if there is no associated structure.

Return type

schrodinger.structure.Structure or NoneType

setStructure(struc)

Set the associated structure. Can only be used on sequences with an associated structure.

Parameters

struc (schrodinger.structure.Structure) – The new structure for this sequence

Raises

RuntimeError – If there’s no structure associated with this sequence object.

onStructureChanged()
setResidueMap(residue_map)

Set a new mapping between ResidueKey and structured residues.

Note: the only intended user of this method is schrodinger.application.msv.seqio.StructureConverter, where the ResidueKey is computed from the structure._Residue used to create the residue.Residue. If the sequence has a structure, the map can be generated using generateResidueMap.

Parameters

residue_map (dict(residue.ResidueKey, residue.Residue)) – Mapping between residue key and Residue

generateResidueMap()

Create residue map based on current structured residues.

Note: this method requires self.hasStructure() to be True and self.entry_id to be set. If this sequence was produced by schrodinger.application.msv.seqio.StructureConverter, there should already be a residue map and this method does not need to be called.

Raises

RuntimeError – If sequence has no structure or entry id

getResByKey(res_key)
Parameters

res_key (residue.ResidueKey) – Residue key: (entry_id, chain, resnum, inscode)

Returns

Residue matching key or None if no matching residue is found

Return type

residue.Residue or NoneType

Raises

RuntimeError – If sequence has no structure

getStructureResForRes(res)
Parameters

res (residue.Residue) – Residue to get structure residue for

Returns

Structure residue or None if no matching residue is found

Return type

schrodinger.structure._Residue or NoneType

ALPHABET = {}
AnnotationClass = None
ElementClass

alias of schrodinger.protein.residue.Residue

class ORIGIN(value)

Bases: enum.Enum

An enumeration.

Maestro = 1
PyMOL = 2
addGapsBeforeIndices(indices)

Add one gap to the alignment before each of the specified residue positions. Note that these indices are based on numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices.

Parameters

indices (list(int)) – A list of indices to insert gaps before.

annotationTitleChanged
property annotations
blockSignals(self, b: bool) bool
childEvent(self, a0: QChildEvent)
children(self) List[QObject]
clearAllCaching()

This method should be implemented in subclasses that cache any data.

clearDescriptors()
clearPfam()
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent)
deleteLater(self)
property descriptors
descriptorsCleared
destroyed

destroyed(self, object: typing.Optional[QObject] = None) [signal]

disconnect(a0: QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, signal: QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, a0: QEvent) bool
eventFilter(self, a0: QObject, a1: QEvent) bool
findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
property gap_char
getAnnotation(index, annotation)

Returns the annotation at the specified index or None for a gap.

Raises

ValueError – if the annotation is not available

getAnnotationValueForComparison(col, anno, ann_index=0, cdr_scheme=None, vernier=False)

Get an annotation value appropriate for determining whether two residues have the same annotation value. e.g. for binding site, only same-distance contacts of the same ligand should compare equal.

Parameters
  • anno (annotation.ProteinSequenceAnnotations.ANNOTATION_TYPES) – Protein sequence annotation enum member

  • ann_index (int) – Annotation index for multi-value annotations

  • cdr_scheme (annotation.AntibodyCDRScheme) – CDR scheme for antibody annotation. (Will be ignored if anno is not SEQ_ANNO_TYPES.antibody_cdr.)

  • vernier (bool) – Whether Vernier Zones are enabled

Returns

Annotation value for comparison or None if the corresponding residue is a gap or has no value for this annotation

Return type

object or None

getConservation(other, consider_gaps=True, only_consider=None)

Return a float scoring the homology conservation between the sequence and another sequence, assuming that they’re already aligned.

The homology criterion is based on “side chain chemistry” descriptor matching.

Parameters
Returns

The sequence conservation score (between 0.0 and 1.0)

Return type

float

getGapCount()
Returns

the number of gaps in the sequence

Return type

int

getGaps()
Return type

list(residue.Gap)

Returns

The gaps in the sequence.

getIdentity(other, consider_gaps=True, only_consider=None)

Return a float scoring the identity between the sequence and another sequence, assuming that they’re already aligned

Parameters
Returns

The sequence identity score (between 0.0 and 1.0)

Return type

float

getNextResidue(res)

Return the next residue in the sequence (ignoring gaps) or None if this is the last residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getNumAnnValues(ann)
getPreviousResidue(res)

Return the previous residue in the sequence (ignoring gaps) or None if this is the first residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getProperty(seq_prop)

Get the sequence’s value corresponding to the given SequenceProperty object

Parameters

seq_prop (schrodinger.protein.properties.SequenceProperty) – The object describing the sequence property

Returns

The value of the sequence property

Return type

float or None

getRun(res)

For a given residue or gap, return a set of all adjacent element indices in the sequence that are also residues or gaps.

Parameters

res (residue.AbstractSequenceElement) – Residue to get the run of

Reuturn

Set of residue indices in the run

Return type

set(int)

getSimilarity(other, consider_gaps=True, only_consider=None)

Return a float score of the similarity count between the sequence and another sequence, assuming that they’re already aligned.

Parameters
Returns

The sequence similarity score (between 0.0 and 1.0)

Return type

float

getSimilarityScore(other, consider_gaps=True, only_consider=None)

Return the total score of similarity between the sequence and a other sequence, assuming that they’re already aligned.

Parameters
  • other (schrodinger.protein.sequence.Sequence) – A sequence to compare against

  • consider_gaps (bool) – Ignored because the similarity with a gap is 0.0

  • only_consider (set or None) – A set of residues to restrict attention to

Returns

The total sequence similarity score

Return type

int

getTerminalGaps()

Return terminal gaps.

Returns

A list of terminal gaps (in ascending index order)

Return type

list(residue.Gap)

hasDescriptors()
hasPfam()
hasStructuredResidues()

Return whether this sequence has any structured residues. This method is equivalent to bool(seq.structuredResidueCount()) but doesn’t (typically) require iterating through the entire sequence.

Return type

bool

inherits(self, classname: str) bool
installEventFilter(self, a0: QObject)
isSignalConnected(self, signal: QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
iterNeighbors()

Return an iterable of three element tuples consisting of (prev_res, curr_res, next_res), ignoring gaps.

None is used for neighbors of first and last residues in the sequence, and does not indicate gaps here.

Returns

Iterable of 3-tuples, each element of the each tuple being either a schrodinger.protein.residue.Residue or None

Return type

iter(tuple(Residue or NoneType, Residue, Residue or NoneType))

killTimer(self, id: int)
lengthAboutToChange
lengthChanged
metaObject(self) QMetaObject
moveToThread(self, thread: QThread)
nameChanged
objectName(self) str
objectNameChanged

objectNameChanged(self, objectName: str) [signal]

parent(self) QObject
pfamChanged
property(self, name: str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, signal: PYQT_SIGNAL) int
removeAllGaps()

Remove gaps from the sequence

removeEventFilter(self, a0: QObject)
removeTerminalGaps()

Remove gaps from the end of the sequence

residues()

Return an iterable of residues, ignoring gaps.

Returns

Iterable of residues

Return type

iter(Residue)

residuesAdded
residuesChanged
residuesRemoved
sender(self) QObject
senderSignalIndex(self) int
setObjectName(self, name: str)
setParent(self, a0: QObject)
setPfam(new_pfam, pfam_name)
setProperty(self, name: str, value: Any) bool
signalsBlocked(self) bool
startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
structureChanged
structuredResidueCount()

Get the number of residues in this sequence with an associated structured residue. :rtype: int

thread(self) QThread
timerEvent(self, a0: QTimerEvent)
tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str
updateDescriptors(descriptors, property_source)

Updates the descriptor dicts with new descriptor values

Parameters
  • descriptors (dict[str, float]) – A dict mapping descriptor names to their values

  • property_source (properties.PropertySource) – The source of the descriptors

validateGapIndices(gap_idxs)

Make sure that the specified gap indices are valid input for addGapsByIndices. If the indices are invalid, a ValueError will be raised. Indices are considered invalid if:

  • they refer to a position that’s more than one residue past the end of the sequence

  • they are negative

Parameters

gap_idxs (list[int]) – The gap indices to validate

visibilityChanged
class schrodinger.protein.sequence.ProteinSequenceMeta

Bases: PyQt6.sip.wrappertype

Metaclass for split-chain and combined-chain protein sequences

property ALPHABET
__init__(*args, **kwargs)
mro()

Return a type’s method resolution order.

class schrodinger.protein.sequence.AbstractProteinSequenceMixin(*args, **kwargs)

Bases: object

A mixin for code shared between split-chain and combined-chain protein sequences.

disulfideBondsCacheCleared
predictionsChanged
secondaryStructureChanged
kinaseFeaturesChanged
kinaseConservationChanged
property ALPHABET
__init__(*args, **kwargs)
property disulfide_bonds
Returns

A sorted tuple of the valid disulfide bonds.

Return type

tuple(residue.DisulfideBond)

property secondary_structures

A list of _SecondaryStructure namedtuples containing the type of secondary structure and where the secondary structures begin and end.

Returns

A list of namedtuples containing an SS_TYPE from schrodinger.structure and the residue indexes marking the limits of the secondary structure.

Return type

list(_SecondaryStructure)

clearDisulfideBondsCache()
isKinaseChain() bool
hasDisorderedRegionsPredictions()
hasDisulfideBondPredictions()
hasDomainArrangementPredictions()
hasSolventAccessibility()
hasSSAPredictions()
property pred_secondary_structures
class schrodinger.protein.sequence.ProteinSequence(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

Bases: schrodinger.models.json.JsonableClassMixin, schrodinger.protein.sequence.AbstractProteinSequenceMixin, schrodinger.protein.sequence.AbstractSingleChainSequence

A single-chain protein sequence.

Variables

secondaryStructureCacheCleared – A signal emitted when the secondary structure cache has been cleared. Used to keep the CombinedChainProteinSequence cache in sync. If listening for changes in the secondary structure values, use secondaryStructureChanged instead.

AnnotationClass

alias of schrodinger.protein.annotation.ProteinSequenceAnnotations

ElementClass

alias of schrodinger.protein.residue.Residue

secondaryStructureCacheCleared
__init__(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

See AbstractSingleChainSequence for additional documentation.

Parameters
  • disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via disulfide bonds.

  • pred_disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via predicted disulfide bonds.

toJsonImplementation()

Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.

Returns

A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders

classmethod fromJsonImplementation(json_obj)

Abstract method that must be defined by all derived classes. Takes in a dictionary and constructs an instance of the derived class.

Parameters

json_dict (dict) – A dictionary loaded from a JSON string or file.

Returns

An instance of the derived class.

Return type

cls

classmethod adapter47007(json_dict)
classmethod adapter48002(json_dict)
classmethod adapter52065(json_dict)
classmethod isValid(elements)
Parameters

elements (iterable(str) or str) – An iterable of string representations of elements making up the sequence

Returns

Tuple indicating whether valid and a set of invalid characters, if any

Return type

tuple(bool, set(str))

renumberResidues(new_rescode_map)

Renumber residues in this sequence given a dictionary mapping old rescodes to the new desired rescodes.

isKinaseChain()
property is_kinase_annotated
setKinaseFeatures(feature_map: Dict[schrodinger.protein.residue.Residue, schrodinger.protein.annotation.KinaseFeatureLabel])
Parameters

feature_map – Map of residue to kinase feature label

property is_kinase_cons_annotated
setKinaseConservation(cons_map, lig_asl)
Parameters
property disulfide_bonds
Returns

A sorted tuple of the valid disulfide bonds.

Return type

tuple(residue.DisulfideBond)

property pred_disulfide_bonds
removeStructurelessResidues(start=0, end=None)

Remove any structureless residues

Parameters
  • start (int) – The index at which to start filtering structureless residues.

  • end (int) – The index at which to end filtering

encodeForPatternSearch(with_ss=False, with_flex=False, with_asa=False)

Convert to sequence dict expected by find_generalized_pattern.

Parameters
  • with_ss (bool) – Whether to include secondary structure information.

  • with_flex (bool) – Whether to include flexibility information.

  • with_asa (bool) – Whether to include accessible surface area information.

Return type

dict

Returns

dictionary of sequence data

clearAllCaching()

This method should be implemented in subclasses that cache any data.

setGPCRAnnotations(gpcr_annotation_map)
ALPHABET = mappingproxy({'DAL': ResidueType('X', 'DAL', 'Unknown'), 'DAR': ResidueType('X', 'DAR', 'Unknown'), 'DSG': ResidueType('X', 'DSG', 'Unknown'), 'DAS': ResidueType('X', 'DAS', 'Unknown'), 'DCY': ResidueType('X', 'DCY', 'Unknown'), 'DGL': ResidueType('X', 'DGL', 'Unknown'), 'DGN': ResidueType('X', 'DGN', 'Unknown'), 'DHI': ResidueType('X', 'DHI', 'Unknown'), 'DIL': ResidueType('X', 'DIL', 'Unknown'), 'DLE': ResidueType('X', 'DLE', 'Unknown'), 'DLY': ResidueType('X', 'DLY', 'Unknown'), 'MED': ResidueType('X', 'MED', 'Unknown'), 'DPN': ResidueType('X', 'DPN', 'Unknown'), 'DPR': ResidueType('X', 'DPR', 'Unknown'), 'DSN': ResidueType('X', 'DSN', 'Unknown'), 'DTH': ResidueType('X', 'DTH', 'Unknown'), 'DTR': ResidueType('X', 'DTR', 'Unknown'), 'DTY': ResidueType('X', 'DTY', 'Unknown'), 'DVA': ResidueType('X', 'DVA', 'Unknown'), 'NLE': ResidueType('X', 'NLE', 'Unknown'), 'NVA': ResidueType('X', 'NVA', 'Unknown'), '200': ResidueType('X', '200', 'Unknown'), 'GNC': ResidueType('X', 'GNC', 'Unknown'), '0AO': ResidueType('X', '0AO', 'Unknown'), 'NA8': ResidueType('X', 'NA8', 'Unknown'), 'MEA': ResidueType('X', 'MEA', 'Unknown'), 'BCS': ResidueType('X', 'BCS', 'Unknown'), 'EBZ': ResidueType('X', 'EBZ', 'Unknown'), 'HBZ': ResidueType('X', 'HBZ', 'Unknown'), 'SEM': ResidueType('X', 'SEM', 'Unknown'), 'Z3E': ResidueType('X', 'Z3E', 'Unknown'), 'TY5': ResidueType('X', 'TY5', 'Unknown'), 'HYP': ResidueType('X', 'HYP', 'Unknown'), 'PTR': ResidueType('y', 'PTR', 'Tyrosine'), 'SEP': ResidueType('s', 'SEP', 'Serine'), 'TPO': ResidueType('t', 'TPO', 'Threonine'), 'ASQ': ResidueType('X', 'ASQ', 'Unknown'), 'MSE': ResidueType('M', 'MSE', 'Methionine'), 'THP': ResidueType('X', 'THP', 'Unknown'), 'ABA': ResidueType('X', 'ABA', 'Unknown'), 'AIB': ResidueType('X', 'AIB', 'Unknown'), 'A': ResidueType('A', 'ALA', 'Alanine'), 'C': ResidueType('C', 'CYS', 'Cysteine'), 'D': ResidueType('D', 'ASP', 'Aspartic acid'), 'E': ResidueType('E', 'GLU', 'Glutamic acid'), 'F': ResidueType('F', 'PHE', 'Phenylalanine'), 'G': ResidueType('G', 'GLY', 'Glycine'), 'H': ResidueType('H', 'HIS', 'Histidine'), 'I': ResidueType('I', 'ILE', 'Isoleucine'), 'K': ResidueType('K', 'LYS', 'Lysine'), 'L': ResidueType('L', 'LEU', 'Leucine'), 'M': ResidueType('M', 'MET', 'Methionine'), 'N': ResidueType('N', 'ASN', 'Asparagine'), 'P': ResidueType('P', 'PRO', 'Proline'), 'Q': ResidueType('Q', 'GLN', 'Glutamine'), 'R': ResidueType('R', 'ARG', 'Arginine'), 'S': ResidueType('S', 'SER', 'Serine'), 'T': ResidueType('T', 'THR', 'Threonine'), 'V': ResidueType('V', 'VAL', 'Valine'), 'W': ResidueType('W', 'TRP', 'Tryptophan'), 'Y': ResidueType('Y', 'TYR', 'Tyrosine'), 'ALA': ResidueType('A', 'ALA', 'Alanine'), 'CYS': ResidueType('C', 'CYS', 'Cysteine'), 'ASP': ResidueType('D', 'ASP', 'Aspartic acid'), 'GLU': ResidueType('E', 'GLU', 'Glutamic acid'), 'PHE': ResidueType('F', 'PHE', 'Phenylalanine'), 'GLY': ResidueType('G', 'GLY', 'Glycine'), 'HIS': ResidueType('H', 'HIS', 'Histidine'), 'ILE': ResidueType('I', 'ILE', 'Isoleucine'), 'LYS': ResidueType('K', 'LYS', 'Lysine'), 'LEU': ResidueType('L', 'LEU', 'Leucine'), 'MET': ResidueType('M', 'MET', 'Methionine'), 'ASN': ResidueType('N', 'ASN', 'Asparagine'), 'PRO': ResidueType('P', 'PRO', 'Proline'), 'GLN': ResidueType('Q', 'GLN', 'Glutamine'), 'ARG': ResidueType('R', 'ARG', 'Arginine'), 'SER': ResidueType('S', 'SER', 'Serine'), 'THR': ResidueType('T', 'THR', 'Threonine'), 'VAL': ResidueType('V', 'VAL', 'Valine'), 'TRP': ResidueType('W', 'TRP', 'Tryptophan'), 'TYR': ResidueType('Y', 'TYR', 'Tyrosine'), 'ACE': ResidueType('X', 'ACE', 'Capping Group'), 'NMA': ResidueType('X', 'NMA', 'Capping Group'), 'IND': ResidueType('X', 'IND', 'Capping Group'), 'NCO': ResidueType('X', 'NCO', 'Capping Group'), 'ANF': ResidueType('X', 'ANF', 'Capping Group'), 'TOSG': ResidueType('X', 'TOSG', 'Capping Group'), 'FCO': ResidueType('X', 'FCO', 'Capping Group'), 'MPA': ResidueType('X', 'MPA', 'Capping Group'), 'NH2': ResidueType('X', 'NH2', 'Capping Group'), 'THO': ResidueType('T', 'THO', 'Threonine'), 'CYX': ResidueType('C', 'CYX', 'Cysteine'), 'HID': ResidueType('H', 'HID', 'Histidine'), 'CYT': ResidueType('C', 'CYT', 'Cysteine'), 'LYN': ResidueType('K', 'LYN', 'Lysine'), 'SRO': ResidueType('S', 'SRO', 'Serine'), 'GLH': ResidueType('E', 'GLH', 'Glutamic acid'), 'ASH': ResidueType('D', 'ASH', 'Aspartic acid'), 'ARN': ResidueType('R', 'ARN', 'Arginine'), 'TYO': ResidueType('Y', 'TYO', 'Tyrosine'), 'HIE': ResidueType('H', 'HIE', 'Histidine'), 'HSD': ResidueType('H', 'HSD', 'Histidine'), 'HIP': ResidueType('H', 'HIP', 'Histidine'), 'HSE': ResidueType('H', 'HSE', 'Histidine'), 'HSP': ResidueType('H', 'HSP', 'Histidine'), 'CYM': ResidueType('C', 'CYM', 'Cysteine'), 'X': ResidueType('X', 'UNK', 'Unknown'), 'UNK': ResidueType('X', 'UNK', 'Unknown')})
class ORIGIN(value)

Bases: enum.Enum

An enumeration.

Maestro = 1
PyMOL = 2
__contains__(item)
__len__()
addGapsBeforeIndices(indices)

Add one gap to the alignment before each of the specified residue positions. Note that these indices are based on numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices.

Parameters

indices (list(int)) – A list of indices to insert gaps before.

addGapsByIndices(gap_idxs)

Add gaps to the sequence from a list of gap indices. Note that these indices are based on numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see addGapsBeforeIndices.

Parameters

gap_idxs (list(int)) – A list of gap indices

annotationTitleChanged
property annotations
append(element)

Appends an element to the sequence

Parameters

element – The element to append to this sequence

Type

element: self.ElementClass or basestring

blockSignals(self, b: bool) bool
property chain
childEvent(self, a0: QChildEvent)
children(self) List[QObject]
clearDescriptors()
clearDisulfideBondsCache()
clearPfam()
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent)
deleteAllPredictions()
deleteLater(self)
deletePrediction(prediction_type)
property descriptors
descriptorsCleared
destroyed

destroyed(self, object: typing.Optional[QObject] = None) [signal]

disconnect(a0: QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, signal: QMetaMethod)
disulfideBondsCacheCleared
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, a0: QEvent) bool
eventFilter(self, a0: QObject, a1: QEvent) bool
extend(elements)

Extends the sequence with elements from an iterable

Parameters

elements (iterable(self.ElementClass) or iterable(str)) – The iterable containing elements with which to extend this sequence

findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
classmethod fromJson(json_obj)

A factory method which constructs a new object from a given dict loaded from a json string or file.

Parameters

json_obj (dict) – A json-loaded dictionary to create an object from.

Returns

An instance of this class.

Return type

cls

property fullname
Returns

a formatted name + optional chain name for the sequence

Return type

str

property gap_char
generateResidueMap()

Create residue map based on current structured residues.

Note: this method requires self.hasStructure() to be True and self.entry_id to be set. If this sequence was produced by schrodinger.application.msv.seqio.StructureConverter, there should already be a residue map and this method does not need to be called.

Raises

RuntimeError – If sequence has no structure or entry id

getAnnotation(index, annotation)

Returns the annotation at the specified index or None for a gap.

Raises

ValueError – if the annotation is not available

getAnnotationValueForComparison(col, anno, ann_index=0, cdr_scheme=None, vernier=False)

Get an annotation value appropriate for determining whether two residues have the same annotation value. e.g. for binding site, only same-distance contacts of the same ligand should compare equal.

Parameters
  • anno (annotation.ProteinSequenceAnnotations.ANNOTATION_TYPES) – Protein sequence annotation enum member

  • ann_index (int) – Annotation index for multi-value annotations

  • cdr_scheme (annotation.AntibodyCDRScheme) – CDR scheme for antibody annotation. (Will be ignored if anno is not SEQ_ANNO_TYPES.antibody_cdr.)

  • vernier (bool) – Whether Vernier Zones are enabled

Returns

Annotation value for comparison or None if the corresponding residue is a gap or has no value for this annotation

Return type

object or None

getConservation(other, consider_gaps=True, only_consider=None)

Return a float scoring the homology conservation between the sequence and another sequence, assuming that they’re already aligned.

The homology criterion is based on “side chain chemistry” descriptor matching.

Parameters
Returns

The sequence conservation score (between 0.0 and 1.0)

Return type

float

getGapCount()
Returns

the number of gaps in the sequence

Return type

int

getGaplessLength()
Returns

Length of this sequence ignoring gaps

Return type

int

getGaps()
Return type

list(residue.Gap)

Returns

The gaps in the sequence.

getIdentity(other, consider_gaps=True, only_consider=None)

Return a float scoring the identity between the sequence and another sequence, assuming that they’re already aligned

Parameters
Returns

The sequence identity score (between 0.0 and 1.0)

Return type

float

getNextResidue(res)

Return the next residue in the sequence (ignoring gaps) or None if this is the last residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getNumAnnValues(ann)
getPreviousResidue(res)

Return the previous residue in the sequence (ignoring gaps) or None if this is the first residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getProperty(seq_prop)

Get the sequence’s value corresponding to the given SequenceProperty object

Parameters

seq_prop (schrodinger.protein.properties.SequenceProperty) – The object describing the sequence property

Returns

The value of the sequence property

Return type

float or None

getResByKey(res_key)
Parameters

res_key (residue.ResidueKey) – Residue key: (entry_id, chain, resnum, inscode)

Returns

Residue matching key or None if no matching residue is found

Return type

residue.Residue or NoneType

Raises

RuntimeError – If sequence has no structure

getRun(res)

For a given residue or gap, return a set of all adjacent element indices in the sequence that are also residues or gaps.

Parameters

res (residue.AbstractSequenceElement) – Residue to get the run of

Reuturn

Set of residue indices in the run

Return type

set(int)

getSimilarity(other, consider_gaps=True, only_consider=None)

Return a float score of the similarity count between the sequence and another sequence, assuming that they’re already aligned.

Parameters
Returns

The sequence similarity score (between 0.0 and 1.0)

Return type

float

getSimilarityScore(other, consider_gaps=True, only_consider=None)

Return the total score of similarity between the sequence and a other sequence, assuming that they’re already aligned.

Parameters
  • other (schrodinger.protein.sequence.Sequence) – A sequence to compare against

  • consider_gaps (bool) – Ignored because the similarity with a gap is 0.0

  • only_consider (set or None) – A set of residues to restrict attention to

Returns

The total sequence similarity score

Return type

int

getStructure()
Returns

The associated structure. Will return None if there is no associated structure.

Return type

schrodinger.structure.Structure or NoneType

getStructureResForRes(res)
Parameters

res (residue.Residue) – Residue to get structure residue for

Returns

Structure residue or None if no matching residue is found

Return type

schrodinger.structure._Residue or NoneType

getSubsequence(start, end)

Return a sequence containing a subset of the elements in this one

Parameters
  • start (int) – The index at which the subsequence should start

  • end (int) – The index at which the subsequence should end (exclusive)

Returns

The requested subsequence

Return type

AbstractSequence

getTerminalGaps()

Return terminal gaps.

Returns

A list of terminal gaps (in ascending index order)

Return type

list(residue.Gap)

get_version()

Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.

hasDescriptors()
hasDisorderedRegionsPredictions()
hasDisulfideBondPredictions()
hasDomainArrangementPredictions()
hasPfam()
hasSSAPredictions()
hasSolventAccessibility()
hasStructure()
Returns

Whether this sequence has an associated structure.

Return type

bool

hasStructuredResidues()

Return whether this sequence has any structured residues. This method is equivalent to bool(seq.structuredResidueCount()) but doesn’t (typically) require iterating through the entire sequence.

Return type

bool

index(res, ignore_gaps=False)

Returns the index of the specified residue

Parameters
  • res (residue.Residue) – The residue to find

  • ignore_gaps (bool) – Whether the index returned should ignore gaps in the sequence or not.

Raises

A ValueError if the residue is not present

Return type

int

Returns

The index of the residue

indices(residues, ignore_gaps=False)

Returns the indices of all specified residues. Note that there is no guarantee that the returned integers will be in the same order as the input residues. (For combined-chain sequences, it’s highly likely that they won’t be.)

Parameters
  • res (Iterable(residue.Residue)) – The residues to find indices of

  • ignore_gaps (bool) – Whether the indices returned should ignore gaps in the sequence or not.

Returns

The indices of the residues

Return type

list[int]

inherits(self, classname: str) bool
insertElements(index, elements)

Insert a list of elements or sequence element into this sequence.

If elements is a string or iterable of strings, residue numbers will be automatically assigned.

Parameters
  • index (int) – The index at which to insert elements

  • elements (iterable(self.ElementClass) or iterable(str)) – A list of elements to insert

installEventFilter(self, a0: QObject)
isSignalConnected(self, signal: QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
iterNeighbors()

Return an iterable of three element tuples consisting of (prev_res, curr_res, next_res), ignoring gaps.

None is used for neighbors of first and last residues in the sequence, and does not indicate gaps here.

Returns

Iterable of 3-tuples, each element of the each tuple being either a schrodinger.protein.residue.Residue or None

Return type

iter(tuple(Residue or NoneType, Residue, Residue or NoneType))

killTimer(self, id: int)
kinaseConservationChanged
kinaseFeaturesChanged
lengthAboutToChange
lengthChanged
classmethod makeSeqElement(element)
Parameters

element (str or cls.ElementClass) – A sequence element or string representation thereof

Returns

sequence element

Return type

cls.ElementClass

metaObject(self) QMetaObject
moveToThread(self, thread: QThread)
mutate(start, end, elements)

Mutate sequence elements starting at the given index to the provided elements.

Parameters
  • start (int) – The index at which to start mutating

  • end (int) – The index of the last mutated element (exclusive)

  • elements (iterable(self.ElementClass) or iterable(str)) – The elements to which to mutate the sequence

property name
nameChanged
objectName(self) str
objectNameChanged

objectNameChanged(self, objectName: str) [signal]

onStructureChanged()
property origin
Returns

A piece of metadata indicating where the sequence came from

Rtype origin

Sequence.ORIGIN or None

parent(self) QObject
pfamChanged
property pred_secondary_structures
predictionsChanged
property(self, name: str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, signal: PYQT_SIGNAL) int
removeAllGaps()

Remove gaps from the sequence

removeElements(eles)

Remove elements from the sequence.

Parameters

eles (list(residue.AbstractSequenceElement)) – A list of elements to remove from the sequence.

Raises

ValueError – If any of the given elements are not in the sequence.

removeEventFilter(self, a0: QObject)
removeTerminalGaps()

Remove gaps from the end of the sequence

residues()

Return an iterable of residues, ignoring gaps.

Returns

Iterable of residues

Return type

iter(Residue)

residuesAdded
residuesChanged
residuesRemoved
secondaryStructureChanged
property secondary_structures

A list of _SecondaryStructure namedtuples containing the type of secondary structure and where the secondary structures begin and end.

Returns

A list of namedtuples containing an SS_TYPE from schrodinger.structure and the residue indexes marking the limits of the secondary structure.

Return type

list(_SecondaryStructure)

sender(self) QObject
senderSignalIndex(self) int
sequenceCopied
setDisorderedRegionsPredictions(pred)
setDomainArrangementPredictions(pred)
setObjectName(self, name: str)
setParent(self, a0: QObject)
setPfam(new_pfam, pfam_name)
setProperty(self, name: str, value: Any) bool
setResidueMap(residue_map)

Set a new mapping between ResidueKey and structured residues.

Note: the only intended user of this method is schrodinger.application.msv.seqio.StructureConverter, where the ResidueKey is computed from the structure._Residue used to create the residue.Residue. If the sequence has a structure, the map can be generated using generateResidueMap.

Parameters

residue_map (dict(residue.ResidueKey, residue.Residue)) – Mapping between residue key and Residue

setSSA(new_ssa)
setSSAPredictions(pred)
setSolventAccessibilityPredictions(pred)
setStructure(struc)

Set the associated structure. Can only be used on sequences with an associated structure.

Parameters

struc (schrodinger.structure.Structure) – The new structure for this sequence

Raises

RuntimeError – If there’s no structure associated with this sequence object.

signalsBlocked(self) bool
startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
structureChanged
structuredResidueCount()

Get the number of residues in this sequence with an associated structured residue. :rtype: int

thread(self) QThread
timerEvent(self, a0: QTimerEvent)
toJson(_mark_version=True)

Create and returns a data structure made up of jsonable items.

Return type

An instance of one the classes from NATIVE_JSON_DATATYPES

tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str
updateDescriptors(descriptors, property_source)

Updates the descriptor dicts with new descriptor values

Parameters
  • descriptors (dict[str, float]) – A dict mapping descriptor names to their values

  • property_source (properties.PropertySource) – The source of the descriptors

validateGapIndices(gap_idxs)

Make sure that the specified gap indices are valid input for addGapsByIndices. If the indices are invalid, a ValueError will be raised. Indices are considered invalid if:

  • they refer to a position that’s more than one residue past the end of the sequence

  • they are negative

Parameters

gap_idxs (list[int]) – The gap indices to validate

property visibility
visibilityChanged
class schrodinger.protein.sequence.NucleicSequenceMeta

Bases: schrodinger.protein.sequence.ProteinSequenceMeta

ALPHABET = None
__init__(*args, **kwargs)
mro()

Return a type’s method resolution order.

class schrodinger.protein.sequence.NucleicAcidSequence(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

Bases: schrodinger.protein.sequence.ProteinSequence

AnnotationClass

alias of schrodinger.protein.annotation.NucleicAcidSequenceAnnotations

ElementClass

alias of schrodinger.protein.residue.Nucleotide

ALPHABET = None
property is_kinase_cons_annotated
property is_kinase_annotated
isKinaseChain()
getTranslation()

Get a translated sequence. This method uses BioPython’s translate method to convert a nucleic acid sequence into an amino acid sequence

Returns

A translated protein sequence. The name and chain from the nucleic acid sequence are copied over

Return type

ProteinSequence

getReverse()

Get the reverse of a DNA or RNA sequence. Residues are renumbered. Creates a new Sequence; original object is unmodified.

Returns

The reversed nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getComplement()

Get the complement of a DNA or RNA sequence. This method uses BioPython’s complement method for nucleic acid sequences. Supports gaps and unknown residues; does not support ambiguous residues (since NucleicAcidSequence doesn’t). Creates a new Sequence; original object is unmodified.

Returns

The complementary nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getReverseComplement()

Get the reverse complement of a DNA or RNA sequence. Supports gaps and unknown residues; does not support ambiguous residues (since NucleicAcidSequence doesn’t). Creates a new Sequence; original object is unmodified.

Returns

The reverse complement nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

encodeForPatternSearch(with_ss=False, with_flex=False, with_asa=False)

Convert to sequence dict expected by find_generalized_pattern.

Parameters
  • with_ss (bool) – Whether to include secondary structure information.

  • with_flex (bool) – Whether to include flexibility information.

  • with_asa (bool) – Whether to include accessible surface area information.

Return type

dict

Returns

dictionary of sequence data

class ORIGIN(value)

Bases: enum.Enum

An enumeration.

Maestro = 1
PyMOL = 2
__contains__(item)
__init__(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

See AbstractSingleChainSequence for additional documentation.

Parameters
  • disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via disulfide bonds.

  • pred_disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via predicted disulfide bonds.

__len__()
classmethod adapter47007(json_dict)
classmethod adapter48002(json_dict)
classmethod adapter52065(json_dict)
addGapsBeforeIndices(indices)

Add one gap to the alignment before each of the specified residue positions. Note that these indices are based on numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices.

Parameters

indices (list(int)) – A list of indices to insert gaps before.

addGapsByIndices(gap_idxs)

Add gaps to the sequence from a list of gap indices. Note that these indices are based on numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see addGapsBeforeIndices.

Parameters

gap_idxs (list(int)) – A list of gap indices

annotationTitleChanged
property annotations
append(element)

Appends an element to the sequence

Parameters

element – The element to append to this sequence

Type

element: self.ElementClass or basestring

blockSignals(self, b: bool) bool
property chain
childEvent(self, a0: QChildEvent)
children(self) List[QObject]
clearAllCaching()

This method should be implemented in subclasses that cache any data.

clearDescriptors()
clearDisulfideBondsCache()
clearPfam()
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent)
deleteAllPredictions()
deleteLater(self)
deletePrediction(prediction_type)
property descriptors
descriptorsCleared
destroyed

destroyed(self, object: typing.Optional[QObject] = None) [signal]

disconnect(a0: QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, signal: QMetaMethod)
disulfideBondsCacheCleared
property disulfide_bonds
Returns

A sorted tuple of the valid disulfide bonds.

Return type

tuple(residue.DisulfideBond)

dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, a0: QEvent) bool
eventFilter(self, a0: QObject, a1: QEvent) bool
extend(elements)

Extends the sequence with elements from an iterable

Parameters

elements (iterable(self.ElementClass) or iterable(str)) – The iterable containing elements with which to extend this sequence

findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
classmethod fromJson(json_obj)

A factory method which constructs a new object from a given dict loaded from a json string or file.

Parameters

json_obj (dict) – A json-loaded dictionary to create an object from.

Returns

An instance of this class.

Return type

cls

classmethod fromJsonImplementation(json_obj)

Abstract method that must be defined by all derived classes. Takes in a dictionary and constructs an instance of the derived class.

Parameters

json_dict (dict) – A dictionary loaded from a JSON string or file.

Returns

An instance of the derived class.

Return type

cls

property fullname
Returns

a formatted name + optional chain name for the sequence

Return type

str

property gap_char
generateResidueMap()

Create residue map based on current structured residues.

Note: this method requires self.hasStructure() to be True and self.entry_id to be set. If this sequence was produced by schrodinger.application.msv.seqio.StructureConverter, there should already be a residue map and this method does not need to be called.

Raises

RuntimeError – If sequence has no structure or entry id

getAnnotation(index, annotation)

Returns the annotation at the specified index or None for a gap.

Raises

ValueError – if the annotation is not available

getAnnotationValueForComparison(col, anno, ann_index=0, cdr_scheme=None, vernier=False)

Get an annotation value appropriate for determining whether two residues have the same annotation value. e.g. for binding site, only same-distance contacts of the same ligand should compare equal.

Parameters
  • anno (annotation.ProteinSequenceAnnotations.ANNOTATION_TYPES) – Protein sequence annotation enum member

  • ann_index (int) – Annotation index for multi-value annotations

  • cdr_scheme (annotation.AntibodyCDRScheme) – CDR scheme for antibody annotation. (Will be ignored if anno is not SEQ_ANNO_TYPES.antibody_cdr.)

  • vernier (bool) – Whether Vernier Zones are enabled

Returns

Annotation value for comparison or None if the corresponding residue is a gap or has no value for this annotation

Return type

object or None

getConservation(other, consider_gaps=True, only_consider=None)

Return a float scoring the homology conservation between the sequence and another sequence, assuming that they’re already aligned.

The homology criterion is based on “side chain chemistry” descriptor matching.

Parameters
Returns

The sequence conservation score (between 0.0 and 1.0)

Return type

float

getGapCount()
Returns

the number of gaps in the sequence

Return type

int

getGaplessLength()
Returns

Length of this sequence ignoring gaps

Return type

int

getGaps()
Return type

list(residue.Gap)

Returns

The gaps in the sequence.

getIdentity(other, consider_gaps=True, only_consider=None)

Return a float scoring the identity between the sequence and another sequence, assuming that they’re already aligned

Parameters
Returns

The sequence identity score (between 0.0 and 1.0)

Return type

float

getNextResidue(res)

Return the next residue in the sequence (ignoring gaps) or None if this is the last residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getNumAnnValues(ann)
getPreviousResidue(res)

Return the previous residue in the sequence (ignoring gaps) or None if this is the first residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getProperty(seq_prop)

Get the sequence’s value corresponding to the given SequenceProperty object

Parameters

seq_prop (schrodinger.protein.properties.SequenceProperty) – The object describing the sequence property

Returns

The value of the sequence property

Return type

float or None

getResByKey(res_key)
Parameters

res_key (residue.ResidueKey) – Residue key: (entry_id, chain, resnum, inscode)

Returns

Residue matching key or None if no matching residue is found

Return type

residue.Residue or NoneType

Raises

RuntimeError – If sequence has no structure

getRun(res)

For a given residue or gap, return a set of all adjacent element indices in the sequence that are also residues or gaps.

Parameters

res (residue.AbstractSequenceElement) – Residue to get the run of

Reuturn

Set of residue indices in the run

Return type

set(int)

getSimilarity(other, consider_gaps=True, only_consider=None)

Return a float score of the similarity count between the sequence and another sequence, assuming that they’re already aligned.

Parameters
Returns

The sequence similarity score (between 0.0 and 1.0)

Return type

float

getSimilarityScore(other, consider_gaps=True, only_consider=None)

Return the total score of similarity between the sequence and a other sequence, assuming that they’re already aligned.

Parameters
  • other (schrodinger.protein.sequence.Sequence) – A sequence to compare against

  • consider_gaps (bool) – Ignored because the similarity with a gap is 0.0

  • only_consider (set or None) – A set of residues to restrict attention to

Returns

The total sequence similarity score

Return type

int

getStructure()
Returns

The associated structure. Will return None if there is no associated structure.

Return type

schrodinger.structure.Structure or NoneType

getStructureResForRes(res)
Parameters

res (residue.Residue) – Residue to get structure residue for

Returns

Structure residue or None if no matching residue is found

Return type

schrodinger.structure._Residue or NoneType

getSubsequence(start, end)

Return a sequence containing a subset of the elements in this one

Parameters
  • start (int) – The index at which the subsequence should start

  • end (int) – The index at which the subsequence should end (exclusive)

Returns

The requested subsequence

Return type

AbstractSequence

getTerminalGaps()

Return terminal gaps.

Returns

A list of terminal gaps (in ascending index order)

Return type

list(residue.Gap)

get_version()

Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.

hasDescriptors()
hasDisorderedRegionsPredictions()
hasDisulfideBondPredictions()
hasDomainArrangementPredictions()
hasPfam()
hasSSAPredictions()
hasSolventAccessibility()
hasStructure()
Returns

Whether this sequence has an associated structure.

Return type

bool

hasStructuredResidues()

Return whether this sequence has any structured residues. This method is equivalent to bool(seq.structuredResidueCount()) but doesn’t (typically) require iterating through the entire sequence.

Return type

bool

index(res, ignore_gaps=False)

Returns the index of the specified residue

Parameters
  • res (residue.Residue) – The residue to find

  • ignore_gaps (bool) – Whether the index returned should ignore gaps in the sequence or not.

Raises

A ValueError if the residue is not present

Return type

int

Returns

The index of the residue

indices(residues, ignore_gaps=False)

Returns the indices of all specified residues. Note that there is no guarantee that the returned integers will be in the same order as the input residues. (For combined-chain sequences, it’s highly likely that they won’t be.)

Parameters
  • res (Iterable(residue.Residue)) – The residues to find indices of

  • ignore_gaps (bool) – Whether the indices returned should ignore gaps in the sequence or not.

Returns

The indices of the residues

Return type

list[int]

inherits(self, classname: str) bool
insertElements(index, elements)

Insert a list of elements or sequence element into this sequence.

If elements is a string or iterable of strings, residue numbers will be automatically assigned.

Parameters
  • index (int) – The index at which to insert elements

  • elements (iterable(self.ElementClass) or iterable(str)) – A list of elements to insert

installEventFilter(self, a0: QObject)
isSignalConnected(self, signal: QMetaMethod) bool
classmethod isValid(elements)
Parameters

elements (iterable(str) or str) – An iterable of string representations of elements making up the sequence

Returns

Tuple indicating whether valid and a set of invalid characters, if any

Return type

tuple(bool, set(str))

isWidgetType(self) bool
isWindowType(self) bool
iterNeighbors()

Return an iterable of three element tuples consisting of (prev_res, curr_res, next_res), ignoring gaps.

None is used for neighbors of first and last residues in the sequence, and does not indicate gaps here.

Returns

Iterable of 3-tuples, each element of the each tuple being either a schrodinger.protein.residue.Residue or None

Return type

iter(tuple(Residue or NoneType, Residue, Residue or NoneType))

killTimer(self, id: int)
kinaseConservationChanged
kinaseFeaturesChanged
lengthAboutToChange
lengthChanged
classmethod makeSeqElement(element)
Parameters

element (str or cls.ElementClass) – A sequence element or string representation thereof

Returns

sequence element

Return type

cls.ElementClass

metaObject(self) QMetaObject
moveToThread(self, thread: QThread)
mutate(start, end, elements)

Mutate sequence elements starting at the given index to the provided elements.

Parameters
  • start (int) – The index at which to start mutating

  • end (int) – The index of the last mutated element (exclusive)

  • elements (iterable(self.ElementClass) or iterable(str)) – The elements to which to mutate the sequence

property name
nameChanged
objectName(self) str
objectNameChanged

objectNameChanged(self, objectName: str) [signal]

onStructureChanged()
property origin
Returns

A piece of metadata indicating where the sequence came from

Rtype origin

Sequence.ORIGIN or None

parent(self) QObject
pfamChanged
property pred_disulfide_bonds
property pred_secondary_structures
predictionsChanged
property(self, name: str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, signal: PYQT_SIGNAL) int
removeAllGaps()

Remove gaps from the sequence

removeElements(eles)

Remove elements from the sequence.

Parameters

eles (list(residue.AbstractSequenceElement)) – A list of elements to remove from the sequence.

Raises

ValueError – If any of the given elements are not in the sequence.

removeEventFilter(self, a0: QObject)
removeStructurelessResidues(start=0, end=None)

Remove any structureless residues

Parameters
  • start (int) – The index at which to start filtering structureless residues.

  • end (int) – The index at which to end filtering

removeTerminalGaps()

Remove gaps from the end of the sequence

renumberResidues(new_rescode_map)

Renumber residues in this sequence given a dictionary mapping old rescodes to the new desired rescodes.

residues()

Return an iterable of residues, ignoring gaps.

Returns

Iterable of residues

Return type

iter(Residue)

residuesAdded
residuesChanged
residuesRemoved
secondaryStructureCacheCleared
secondaryStructureChanged
property secondary_structures

A list of _SecondaryStructure namedtuples containing the type of secondary structure and where the secondary structures begin and end.

Returns

A list of namedtuples containing an SS_TYPE from schrodinger.structure and the residue indexes marking the limits of the secondary structure.

Return type

list(_SecondaryStructure)

sender(self) QObject
senderSignalIndex(self) int
sequenceCopied
setDisorderedRegionsPredictions(pred)
setDomainArrangementPredictions(pred)
setGPCRAnnotations(gpcr_annotation_map)
setKinaseConservation(cons_map, lig_asl)
Parameters
setKinaseFeatures(feature_map: Dict[schrodinger.protein.residue.Residue, schrodinger.protein.annotation.KinaseFeatureLabel])
Parameters

feature_map – Map of residue to kinase feature label

setObjectName(self, name: str)
setParent(self, a0: QObject)
setPfam(new_pfam, pfam_name)
setProperty(self, name: str, value: Any) bool
setResidueMap(residue_map)

Set a new mapping between ResidueKey and structured residues.

Note: the only intended user of this method is schrodinger.application.msv.seqio.StructureConverter, where the ResidueKey is computed from the structure._Residue used to create the residue.Residue. If the sequence has a structure, the map can be generated using generateResidueMap.

Parameters

residue_map (dict(residue.ResidueKey, residue.Residue)) – Mapping between residue key and Residue

setSSA(new_ssa)
setSSAPredictions(pred)
setSolventAccessibilityPredictions(pred)
setStructure(struc)

Set the associated structure. Can only be used on sequences with an associated structure.

Parameters

struc (schrodinger.structure.Structure) – The new structure for this sequence

Raises

RuntimeError – If there’s no structure associated with this sequence object.

signalsBlocked(self) bool
startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
structureChanged
structuredResidueCount()

Get the number of residues in this sequence with an associated structured residue. :rtype: int

thread(self) QThread
timerEvent(self, a0: QTimerEvent)
toJson(_mark_version=True)

Create and returns a data structure made up of jsonable items.

Return type

An instance of one the classes from NATIVE_JSON_DATATYPES

toJsonImplementation()

Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.

Returns

A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders

tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str
updateDescriptors(descriptors, property_source)

Updates the descriptor dicts with new descriptor values

Parameters
  • descriptors (dict[str, float]) – A dict mapping descriptor names to their values

  • property_source (properties.PropertySource) – The source of the descriptors

validateGapIndices(gap_idxs)

Make sure that the specified gap indices are valid input for addGapsByIndices. If the indices are invalid, a ValueError will be raised. Indices are considered invalid if:

  • they refer to a position that’s more than one residue past the end of the sequence

  • they are negative

Parameters

gap_idxs (list[int]) – The gap indices to validate

property visibility
visibilityChanged
class schrodinger.protein.sequence.DNASequence(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

Bases: schrodinger.protein.sequence.NucleicAcidSequence

ALPHABET = mappingproxy({'DA': DeoxyribonucleotideType('A', 'DA', 'Adenine'), 'DC': DeoxyribonucleotideType('C', 'DC', 'Cytosine'), 'DG': DeoxyribonucleotideType('G', 'DG', 'Guanine'), 'DT': DeoxyribonucleotideType('T', 'DT', 'Thymine'), 'A': DeoxyribonucleotideType('A', 'DA', 'Adenine'), 'C': DeoxyribonucleotideType('C', 'DC', 'Cytosine'), 'G': DeoxyribonucleotideType('G', 'DG', 'Guanine'), 'T': DeoxyribonucleotideType('T', 'DT', 'Thymine')})
AnnotationClass

alias of schrodinger.protein.annotation.NucleicAcidSequenceAnnotations

ElementClass

alias of schrodinger.protein.residue.Nucleotide

class ORIGIN(value)

Bases: enum.Enum

An enumeration.

Maestro = 1
PyMOL = 2
__contains__(item)
__init__(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

See AbstractSingleChainSequence for additional documentation.

Parameters
  • disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via disulfide bonds.

  • pred_disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via predicted disulfide bonds.

__len__()
classmethod adapter47007(json_dict)
classmethod adapter48002(json_dict)
classmethod adapter52065(json_dict)
addGapsBeforeIndices(indices)

Add one gap to the alignment before each of the specified residue positions. Note that these indices are based on numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices.

Parameters

indices (list(int)) – A list of indices to insert gaps before.

addGapsByIndices(gap_idxs)

Add gaps to the sequence from a list of gap indices. Note that these indices are based on numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see addGapsBeforeIndices.

Parameters

gap_idxs (list(int)) – A list of gap indices

annotationTitleChanged
property annotations
append(element)

Appends an element to the sequence

Parameters

element – The element to append to this sequence

Type

element: self.ElementClass or basestring

blockSignals(self, b: bool) bool
property chain
childEvent(self, a0: QChildEvent)
children(self) List[QObject]
clearAllCaching()

This method should be implemented in subclasses that cache any data.

clearDescriptors()
clearDisulfideBondsCache()
clearPfam()
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent)
deleteAllPredictions()
deleteLater(self)
deletePrediction(prediction_type)
property descriptors
descriptorsCleared
destroyed

destroyed(self, object: typing.Optional[QObject] = None) [signal]

disconnect(a0: QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, signal: QMetaMethod)
disulfideBondsCacheCleared
property disulfide_bonds
Returns

A sorted tuple of the valid disulfide bonds.

Return type

tuple(residue.DisulfideBond)

dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
encodeForPatternSearch(with_ss=False, with_flex=False, with_asa=False)

Convert to sequence dict expected by find_generalized_pattern.

Parameters
  • with_ss (bool) – Whether to include secondary structure information.

  • with_flex (bool) – Whether to include flexibility information.

  • with_asa (bool) – Whether to include accessible surface area information.

Return type

dict

Returns

dictionary of sequence data

event(self, a0: QEvent) bool
eventFilter(self, a0: QObject, a1: QEvent) bool
extend(elements)

Extends the sequence with elements from an iterable

Parameters

elements (iterable(self.ElementClass) or iterable(str)) – The iterable containing elements with which to extend this sequence

findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
classmethod fromJson(json_obj)

A factory method which constructs a new object from a given dict loaded from a json string or file.

Parameters

json_obj (dict) – A json-loaded dictionary to create an object from.

Returns

An instance of this class.

Return type

cls

classmethod fromJsonImplementation(json_obj)

Abstract method that must be defined by all derived classes. Takes in a dictionary and constructs an instance of the derived class.

Parameters

json_dict (dict) – A dictionary loaded from a JSON string or file.

Returns

An instance of the derived class.

Return type

cls

property fullname
Returns

a formatted name + optional chain name for the sequence

Return type

str

property gap_char
generateResidueMap()

Create residue map based on current structured residues.

Note: this method requires self.hasStructure() to be True and self.entry_id to be set. If this sequence was produced by schrodinger.application.msv.seqio.StructureConverter, there should already be a residue map and this method does not need to be called.

Raises

RuntimeError – If sequence has no structure or entry id

getAnnotation(index, annotation)

Returns the annotation at the specified index or None for a gap.

Raises

ValueError – if the annotation is not available

getAnnotationValueForComparison(col, anno, ann_index=0, cdr_scheme=None, vernier=False)

Get an annotation value appropriate for determining whether two residues have the same annotation value. e.g. for binding site, only same-distance contacts of the same ligand should compare equal.

Parameters
  • anno (annotation.ProteinSequenceAnnotations.ANNOTATION_TYPES) – Protein sequence annotation enum member

  • ann_index (int) – Annotation index for multi-value annotations

  • cdr_scheme (annotation.AntibodyCDRScheme) – CDR scheme for antibody annotation. (Will be ignored if anno is not SEQ_ANNO_TYPES.antibody_cdr.)

  • vernier (bool) – Whether Vernier Zones are enabled

Returns

Annotation value for comparison or None if the corresponding residue is a gap or has no value for this annotation

Return type

object or None

getComplement()

Get the complement of a DNA or RNA sequence. This method uses BioPython’s complement method for nucleic acid sequences. Supports gaps and unknown residues; does not support ambiguous residues (since NucleicAcidSequence doesn’t). Creates a new Sequence; original object is unmodified.

Returns

The complementary nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getConservation(other, consider_gaps=True, only_consider=None)

Return a float scoring the homology conservation between the sequence and another sequence, assuming that they’re already aligned.

The homology criterion is based on “side chain chemistry” descriptor matching.

Parameters
Returns

The sequence conservation score (between 0.0 and 1.0)

Return type

float

getGapCount()
Returns

the number of gaps in the sequence

Return type

int

getGaplessLength()
Returns

Length of this sequence ignoring gaps

Return type

int

getGaps()
Return type

list(residue.Gap)

Returns

The gaps in the sequence.

getIdentity(other, consider_gaps=True, only_consider=None)

Return a float scoring the identity between the sequence and another sequence, assuming that they’re already aligned

Parameters
Returns

The sequence identity score (between 0.0 and 1.0)

Return type

float

getNextResidue(res)

Return the next residue in the sequence (ignoring gaps) or None if this is the last residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getNumAnnValues(ann)
getPreviousResidue(res)

Return the previous residue in the sequence (ignoring gaps) or None if this is the first residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getProperty(seq_prop)

Get the sequence’s value corresponding to the given SequenceProperty object

Parameters

seq_prop (schrodinger.protein.properties.SequenceProperty) – The object describing the sequence property

Returns

The value of the sequence property

Return type

float or None

getResByKey(res_key)
Parameters

res_key (residue.ResidueKey) – Residue key: (entry_id, chain, resnum, inscode)

Returns

Residue matching key or None if no matching residue is found

Return type

residue.Residue or NoneType

Raises

RuntimeError – If sequence has no structure

getReverse()

Get the reverse of a DNA or RNA sequence. Residues are renumbered. Creates a new Sequence; original object is unmodified.

Returns

The reversed nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getReverseComplement()

Get the reverse complement of a DNA or RNA sequence. Supports gaps and unknown residues; does not support ambiguous residues (since NucleicAcidSequence doesn’t). Creates a new Sequence; original object is unmodified.

Returns

The reverse complement nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getRun(res)

For a given residue or gap, return a set of all adjacent element indices in the sequence that are also residues or gaps.

Parameters

res (residue.AbstractSequenceElement) – Residue to get the run of

Reuturn

Set of residue indices in the run

Return type

set(int)

getSimilarity(other, consider_gaps=True, only_consider=None)

Return a float score of the similarity count between the sequence and another sequence, assuming that they’re already aligned.

Parameters
Returns

The sequence similarity score (between 0.0 and 1.0)

Return type

float

getSimilarityScore(other, consider_gaps=True, only_consider=None)

Return the total score of similarity between the sequence and a other sequence, assuming that they’re already aligned.

Parameters
  • other (schrodinger.protein.sequence.Sequence) – A sequence to compare against

  • consider_gaps (bool) – Ignored because the similarity with a gap is 0.0

  • only_consider (set or None) – A set of residues to restrict attention to

Returns

The total sequence similarity score

Return type

int

getStructure()
Returns

The associated structure. Will return None if there is no associated structure.

Return type

schrodinger.structure.Structure or NoneType

getStructureResForRes(res)
Parameters

res (residue.Residue) – Residue to get structure residue for

Returns

Structure residue or None if no matching residue is found

Return type

schrodinger.structure._Residue or NoneType

getSubsequence(start, end)

Return a sequence containing a subset of the elements in this one

Parameters
  • start (int) – The index at which the subsequence should start

  • end (int) – The index at which the subsequence should end (exclusive)

Returns

The requested subsequence

Return type

AbstractSequence

getTerminalGaps()

Return terminal gaps.

Returns

A list of terminal gaps (in ascending index order)

Return type

list(residue.Gap)

getTranslation()

Get a translated sequence. This method uses BioPython’s translate method to convert a nucleic acid sequence into an amino acid sequence

Returns

A translated protein sequence. The name and chain from the nucleic acid sequence are copied over

Return type

ProteinSequence

get_version()

Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.

hasDescriptors()
hasDisorderedRegionsPredictions()
hasDisulfideBondPredictions()
hasDomainArrangementPredictions()
hasPfam()
hasSSAPredictions()
hasSolventAccessibility()
hasStructure()
Returns

Whether this sequence has an associated structure.

Return type

bool

hasStructuredResidues()

Return whether this sequence has any structured residues. This method is equivalent to bool(seq.structuredResidueCount()) but doesn’t (typically) require iterating through the entire sequence.

Return type

bool

index(res, ignore_gaps=False)

Returns the index of the specified residue

Parameters
  • res (residue.Residue) – The residue to find

  • ignore_gaps (bool) – Whether the index returned should ignore gaps in the sequence or not.

Raises

A ValueError if the residue is not present

Return type

int

Returns

The index of the residue

indices(residues, ignore_gaps=False)

Returns the indices of all specified residues. Note that there is no guarantee that the returned integers will be in the same order as the input residues. (For combined-chain sequences, it’s highly likely that they won’t be.)

Parameters
  • res (Iterable(residue.Residue)) – The residues to find indices of

  • ignore_gaps (bool) – Whether the indices returned should ignore gaps in the sequence or not.

Returns

The indices of the residues

Return type

list[int]

inherits(self, classname: str) bool
insertElements(index, elements)

Insert a list of elements or sequence element into this sequence.

If elements is a string or iterable of strings, residue numbers will be automatically assigned.

Parameters
  • index (int) – The index at which to insert elements

  • elements (iterable(self.ElementClass) or iterable(str)) – A list of elements to insert

installEventFilter(self, a0: QObject)
isKinaseChain()
isSignalConnected(self, signal: QMetaMethod) bool
classmethod isValid(elements)
Parameters

elements (iterable(str) or str) – An iterable of string representations of elements making up the sequence

Returns

Tuple indicating whether valid and a set of invalid characters, if any

Return type

tuple(bool, set(str))

isWidgetType(self) bool
isWindowType(self) bool
property is_kinase_annotated
property is_kinase_cons_annotated
iterNeighbors()

Return an iterable of three element tuples consisting of (prev_res, curr_res, next_res), ignoring gaps.

None is used for neighbors of first and last residues in the sequence, and does not indicate gaps here.

Returns

Iterable of 3-tuples, each element of the each tuple being either a schrodinger.protein.residue.Residue or None

Return type

iter(tuple(Residue or NoneType, Residue, Residue or NoneType))

killTimer(self, id: int)
kinaseConservationChanged
kinaseFeaturesChanged
lengthAboutToChange
lengthChanged
classmethod makeSeqElement(element)
Parameters

element (str or cls.ElementClass) – A sequence element or string representation thereof

Returns

sequence element

Return type

cls.ElementClass

metaObject(self) QMetaObject
moveToThread(self, thread: QThread)
mutate(start, end, elements)

Mutate sequence elements starting at the given index to the provided elements.

Parameters
  • start (int) – The index at which to start mutating

  • end (int) – The index of the last mutated element (exclusive)

  • elements (iterable(self.ElementClass) or iterable(str)) – The elements to which to mutate the sequence

property name
nameChanged
objectName(self) str
objectNameChanged

objectNameChanged(self, objectName: str) [signal]

onStructureChanged()
property origin
Returns

A piece of metadata indicating where the sequence came from

Rtype origin

Sequence.ORIGIN or None

parent(self) QObject
pfamChanged
property pred_disulfide_bonds
property pred_secondary_structures
predictionsChanged
property(self, name: str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, signal: PYQT_SIGNAL) int
removeAllGaps()

Remove gaps from the sequence

removeElements(eles)

Remove elements from the sequence.

Parameters

eles (list(residue.AbstractSequenceElement)) – A list of elements to remove from the sequence.

Raises

ValueError – If any of the given elements are not in the sequence.

removeEventFilter(self, a0: QObject)
removeStructurelessResidues(start=0, end=None)

Remove any structureless residues

Parameters
  • start (int) – The index at which to start filtering structureless residues.

  • end (int) – The index at which to end filtering

removeTerminalGaps()

Remove gaps from the end of the sequence

renumberResidues(new_rescode_map)

Renumber residues in this sequence given a dictionary mapping old rescodes to the new desired rescodes.

residues()

Return an iterable of residues, ignoring gaps.

Returns

Iterable of residues

Return type

iter(Residue)

residuesAdded
residuesChanged
residuesRemoved
secondaryStructureCacheCleared
secondaryStructureChanged
property secondary_structures

A list of _SecondaryStructure namedtuples containing the type of secondary structure and where the secondary structures begin and end.

Returns

A list of namedtuples containing an SS_TYPE from schrodinger.structure and the residue indexes marking the limits of the secondary structure.

Return type

list(_SecondaryStructure)

sender(self) QObject
senderSignalIndex(self) int
sequenceCopied
setDisorderedRegionsPredictions(pred)
setDomainArrangementPredictions(pred)
setGPCRAnnotations(gpcr_annotation_map)
setKinaseConservation(cons_map, lig_asl)
Parameters
setKinaseFeatures(feature_map: Dict[schrodinger.protein.residue.Residue, schrodinger.protein.annotation.KinaseFeatureLabel])
Parameters

feature_map – Map of residue to kinase feature label

setObjectName(self, name: str)
setParent(self, a0: QObject)
setPfam(new_pfam, pfam_name)
setProperty(self, name: str, value: Any) bool
setResidueMap(residue_map)

Set a new mapping between ResidueKey and structured residues.

Note: the only intended user of this method is schrodinger.application.msv.seqio.StructureConverter, where the ResidueKey is computed from the structure._Residue used to create the residue.Residue. If the sequence has a structure, the map can be generated using generateResidueMap.

Parameters

residue_map (dict(residue.ResidueKey, residue.Residue)) – Mapping between residue key and Residue

setSSA(new_ssa)
setSSAPredictions(pred)
setSolventAccessibilityPredictions(pred)
setStructure(struc)

Set the associated structure. Can only be used on sequences with an associated structure.

Parameters

struc (schrodinger.structure.Structure) – The new structure for this sequence

Raises

RuntimeError – If there’s no structure associated with this sequence object.

signalsBlocked(self) bool
startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
structureChanged
structuredResidueCount()

Get the number of residues in this sequence with an associated structured residue. :rtype: int

thread(self) QThread
timerEvent(self, a0: QTimerEvent)
toJson(_mark_version=True)

Create and returns a data structure made up of jsonable items.

Return type

An instance of one the classes from NATIVE_JSON_DATATYPES

toJsonImplementation()

Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.

Returns

A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders

tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str
updateDescriptors(descriptors, property_source)

Updates the descriptor dicts with new descriptor values

Parameters
  • descriptors (dict[str, float]) – A dict mapping descriptor names to their values

  • property_source (properties.PropertySource) – The source of the descriptors

validateGapIndices(gap_idxs)

Make sure that the specified gap indices are valid input for addGapsByIndices. If the indices are invalid, a ValueError will be raised. Indices are considered invalid if:

  • they refer to a position that’s more than one residue past the end of the sequence

  • they are negative

Parameters

gap_idxs (list[int]) – The gap indices to validate

property visibility
visibilityChanged
class schrodinger.protein.sequence.RNASequence(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

Bases: schrodinger.protein.sequence.NucleicAcidSequence

ALPHABET = mappingproxy({'A': RibonucleotideType('A', 'A', 'Adenine'), 'C': RibonucleotideType('C', 'C', 'Cytosine'), 'G': RibonucleotideType('G', 'G', 'Guanine'), 'U': RibonucleotideType('U', 'U', 'Uracil')})
AnnotationClass

alias of schrodinger.protein.annotation.NucleicAcidSequenceAnnotations

ElementClass

alias of schrodinger.protein.residue.Nucleotide

class ORIGIN(value)

Bases: enum.Enum

An enumeration.

Maestro = 1
PyMOL = 2
__contains__(item)
__init__(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

See AbstractSingleChainSequence for additional documentation.

Parameters
  • disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via disulfide bonds.

  • pred_disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via predicted disulfide bonds.

__len__()
classmethod adapter47007(json_dict)
classmethod adapter48002(json_dict)
classmethod adapter52065(json_dict)
addGapsBeforeIndices(indices)

Add one gap to the alignment before each of the specified residue positions. Note that these indices are based on numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices.

Parameters

indices (list(int)) – A list of indices to insert gaps before.

addGapsByIndices(gap_idxs)

Add gaps to the sequence from a list of gap indices. Note that these indices are based on numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see addGapsBeforeIndices.

Parameters

gap_idxs (list(int)) – A list of gap indices

annotationTitleChanged
property annotations
append(element)

Appends an element to the sequence

Parameters

element – The element to append to this sequence

Type

element: self.ElementClass or basestring

blockSignals(self, b: bool) bool
property chain
childEvent(self, a0: QChildEvent)
children(self) List[QObject]
clearAllCaching()

This method should be implemented in subclasses that cache any data.

clearDescriptors()
clearDisulfideBondsCache()
clearPfam()
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent)
deleteAllPredictions()
deleteLater(self)
deletePrediction(prediction_type)
property descriptors
descriptorsCleared
destroyed

destroyed(self, object: typing.Optional[QObject] = None) [signal]

disconnect(a0: QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, signal: QMetaMethod)
disulfideBondsCacheCleared
property disulfide_bonds
Returns

A sorted tuple of the valid disulfide bonds.

Return type

tuple(residue.DisulfideBond)

dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
encodeForPatternSearch(with_ss=False, with_flex=False, with_asa=False)

Convert to sequence dict expected by find_generalized_pattern.

Parameters
  • with_ss (bool) – Whether to include secondary structure information.

  • with_flex (bool) – Whether to include flexibility information.

  • with_asa (bool) – Whether to include accessible surface area information.

Return type

dict

Returns

dictionary of sequence data

event(self, a0: QEvent) bool
eventFilter(self, a0: QObject, a1: QEvent) bool
extend(elements)

Extends the sequence with elements from an iterable

Parameters

elements (iterable(self.ElementClass) or iterable(str)) – The iterable containing elements with which to extend this sequence

findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
classmethod fromJson(json_obj)

A factory method which constructs a new object from a given dict loaded from a json string or file.

Parameters

json_obj (dict) – A json-loaded dictionary to create an object from.

Returns

An instance of this class.

Return type

cls

classmethod fromJsonImplementation(json_obj)

Abstract method that must be defined by all derived classes. Takes in a dictionary and constructs an instance of the derived class.

Parameters

json_dict (dict) – A dictionary loaded from a JSON string or file.

Returns

An instance of the derived class.

Return type

cls

property fullname
Returns

a formatted name + optional chain name for the sequence

Return type

str

property gap_char
generateResidueMap()

Create residue map based on current structured residues.

Note: this method requires self.hasStructure() to be True and self.entry_id to be set. If this sequence was produced by schrodinger.application.msv.seqio.StructureConverter, there should already be a residue map and this method does not need to be called.

Raises

RuntimeError – If sequence has no structure or entry id

getAnnotation(index, annotation)

Returns the annotation at the specified index or None for a gap.

Raises

ValueError – if the annotation is not available

getAnnotationValueForComparison(col, anno, ann_index=0, cdr_scheme=None, vernier=False)

Get an annotation value appropriate for determining whether two residues have the same annotation value. e.g. for binding site, only same-distance contacts of the same ligand should compare equal.

Parameters
  • anno (annotation.ProteinSequenceAnnotations.ANNOTATION_TYPES) – Protein sequence annotation enum member

  • ann_index (int) – Annotation index for multi-value annotations

  • cdr_scheme (annotation.AntibodyCDRScheme) – CDR scheme for antibody annotation. (Will be ignored if anno is not SEQ_ANNO_TYPES.antibody_cdr.)

  • vernier (bool) – Whether Vernier Zones are enabled

Returns

Annotation value for comparison or None if the corresponding residue is a gap or has no value for this annotation

Return type

object or None

getComplement()

Get the complement of a DNA or RNA sequence. This method uses BioPython’s complement method for nucleic acid sequences. Supports gaps and unknown residues; does not support ambiguous residues (since NucleicAcidSequence doesn’t). Creates a new Sequence; original object is unmodified.

Returns

The complementary nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getConservation(other, consider_gaps=True, only_consider=None)

Return a float scoring the homology conservation between the sequence and another sequence, assuming that they’re already aligned.

The homology criterion is based on “side chain chemistry” descriptor matching.

Parameters
Returns

The sequence conservation score (between 0.0 and 1.0)

Return type

float

getGapCount()
Returns

the number of gaps in the sequence

Return type

int

getGaplessLength()
Returns

Length of this sequence ignoring gaps

Return type

int

getGaps()
Return type

list(residue.Gap)

Returns

The gaps in the sequence.

getIdentity(other, consider_gaps=True, only_consider=None)

Return a float scoring the identity between the sequence and another sequence, assuming that they’re already aligned

Parameters
Returns

The sequence identity score (between 0.0 and 1.0)

Return type

float

getNextResidue(res)

Return the next residue in the sequence (ignoring gaps) or None if this is the last residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getNumAnnValues(ann)
getPreviousResidue(res)

Return the previous residue in the sequence (ignoring gaps) or None if this is the first residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getProperty(seq_prop)

Get the sequence’s value corresponding to the given SequenceProperty object

Parameters

seq_prop (schrodinger.protein.properties.SequenceProperty) – The object describing the sequence property

Returns

The value of the sequence property

Return type

float or None

getResByKey(res_key)
Parameters

res_key (residue.ResidueKey) – Residue key: (entry_id, chain, resnum, inscode)

Returns

Residue matching key or None if no matching residue is found

Return type

residue.Residue or NoneType

Raises

RuntimeError – If sequence has no structure

getReverse()

Get the reverse of a DNA or RNA sequence. Residues are renumbered. Creates a new Sequence; original object is unmodified.

Returns

The reversed nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getReverseComplement()

Get the reverse complement of a DNA or RNA sequence. Supports gaps and unknown residues; does not support ambiguous residues (since NucleicAcidSequence doesn’t). Creates a new Sequence; original object is unmodified.

Returns

The reverse complement nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getRun(res)

For a given residue or gap, return a set of all adjacent element indices in the sequence that are also residues or gaps.

Parameters

res (residue.AbstractSequenceElement) – Residue to get the run of

Reuturn

Set of residue indices in the run

Return type

set(int)

getSimilarity(other, consider_gaps=True, only_consider=None)

Return a float score of the similarity count between the sequence and another sequence, assuming that they’re already aligned.

Parameters
Returns

The sequence similarity score (between 0.0 and 1.0)

Return type

float

getSimilarityScore(other, consider_gaps=True, only_consider=None)

Return the total score of similarity between the sequence and a other sequence, assuming that they’re already aligned.

Parameters
  • other (schrodinger.protein.sequence.Sequence) – A sequence to compare against

  • consider_gaps (bool) – Ignored because the similarity with a gap is 0.0

  • only_consider (set or None) – A set of residues to restrict attention to

Returns

The total sequence similarity score

Return type

int

getStructure()
Returns

The associated structure. Will return None if there is no associated structure.

Return type

schrodinger.structure.Structure or NoneType

getStructureResForRes(res)
Parameters

res (residue.Residue) – Residue to get structure residue for

Returns

Structure residue or None if no matching residue is found

Return type

schrodinger.structure._Residue or NoneType

getSubsequence(start, end)

Return a sequence containing a subset of the elements in this one

Parameters
  • start (int) – The index at which the subsequence should start

  • end (int) – The index at which the subsequence should end (exclusive)

Returns

The requested subsequence

Return type

AbstractSequence

getTerminalGaps()

Return terminal gaps.

Returns

A list of terminal gaps (in ascending index order)

Return type

list(residue.Gap)

getTranslation()

Get a translated sequence. This method uses BioPython’s translate method to convert a nucleic acid sequence into an amino acid sequence

Returns

A translated protein sequence. The name and chain from the nucleic acid sequence are copied over

Return type

ProteinSequence

get_version()

Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.

hasDescriptors()
hasDisorderedRegionsPredictions()
hasDisulfideBondPredictions()
hasDomainArrangementPredictions()
hasPfam()
hasSSAPredictions()
hasSolventAccessibility()
hasStructure()
Returns

Whether this sequence has an associated structure.

Return type

bool

hasStructuredResidues()

Return whether this sequence has any structured residues. This method is equivalent to bool(seq.structuredResidueCount()) but doesn’t (typically) require iterating through the entire sequence.

Return type

bool

index(res, ignore_gaps=False)

Returns the index of the specified residue

Parameters
  • res (residue.Residue) – The residue to find

  • ignore_gaps (bool) – Whether the index returned should ignore gaps in the sequence or not.

Raises

A ValueError if the residue is not present

Return type

int

Returns

The index of the residue

indices(residues, ignore_gaps=False)

Returns the indices of all specified residues. Note that there is no guarantee that the returned integers will be in the same order as the input residues. (For combined-chain sequences, it’s highly likely that they won’t be.)

Parameters
  • res (Iterable(residue.Residue)) – The residues to find indices of

  • ignore_gaps (bool) – Whether the indices returned should ignore gaps in the sequence or not.

Returns

The indices of the residues

Return type

list[int]

inherits(self, classname: str) bool
insertElements(index, elements)

Insert a list of elements or sequence element into this sequence.

If elements is a string or iterable of strings, residue numbers will be automatically assigned.

Parameters
  • index (int) – The index at which to insert elements

  • elements (iterable(self.ElementClass) or iterable(str)) – A list of elements to insert

installEventFilter(self, a0: QObject)
isKinaseChain()
isSignalConnected(self, signal: QMetaMethod) bool
classmethod isValid(elements)
Parameters

elements (iterable(str) or str) – An iterable of string representations of elements making up the sequence

Returns

Tuple indicating whether valid and a set of invalid characters, if any

Return type

tuple(bool, set(str))

isWidgetType(self) bool
isWindowType(self) bool
property is_kinase_annotated
property is_kinase_cons_annotated
iterNeighbors()

Return an iterable of three element tuples consisting of (prev_res, curr_res, next_res), ignoring gaps.

None is used for neighbors of first and last residues in the sequence, and does not indicate gaps here.

Returns

Iterable of 3-tuples, each element of the each tuple being either a schrodinger.protein.residue.Residue or None

Return type

iter(tuple(Residue or NoneType, Residue, Residue or NoneType))

killTimer(self, id: int)
kinaseConservationChanged
kinaseFeaturesChanged
lengthAboutToChange
lengthChanged
classmethod makeSeqElement(element)
Parameters

element (str or cls.ElementClass) – A sequence element or string representation thereof

Returns

sequence element

Return type

cls.ElementClass

metaObject(self) QMetaObject
moveToThread(self, thread: QThread)
mutate(start, end, elements)

Mutate sequence elements starting at the given index to the provided elements.

Parameters
  • start (int) – The index at which to start mutating

  • end (int) – The index of the last mutated element (exclusive)

  • elements (iterable(self.ElementClass) or iterable(str)) – The elements to which to mutate the sequence

property name
nameChanged
objectName(self) str
objectNameChanged

objectNameChanged(self, objectName: str) [signal]

onStructureChanged()
property origin
Returns

A piece of metadata indicating where the sequence came from

Rtype origin

Sequence.ORIGIN or None

parent(self) QObject
pfamChanged
property pred_disulfide_bonds
property pred_secondary_structures
predictionsChanged
property(self, name: str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, signal: PYQT_SIGNAL) int
removeAllGaps()

Remove gaps from the sequence

removeElements(eles)

Remove elements from the sequence.

Parameters

eles (list(residue.AbstractSequenceElement)) – A list of elements to remove from the sequence.

Raises

ValueError – If any of the given elements are not in the sequence.

removeEventFilter(self, a0: QObject)
removeStructurelessResidues(start=0, end=None)

Remove any structureless residues

Parameters
  • start (int) – The index at which to start filtering structureless residues.

  • end (int) – The index at which to end filtering

removeTerminalGaps()

Remove gaps from the end of the sequence

renumberResidues(new_rescode_map)

Renumber residues in this sequence given a dictionary mapping old rescodes to the new desired rescodes.

residues()

Return an iterable of residues, ignoring gaps.

Returns

Iterable of residues

Return type

iter(Residue)

residuesAdded
residuesChanged
residuesRemoved
secondaryStructureCacheCleared
secondaryStructureChanged
property secondary_structures

A list of _SecondaryStructure namedtuples containing the type of secondary structure and where the secondary structures begin and end.

Returns

A list of namedtuples containing an SS_TYPE from schrodinger.structure and the residue indexes marking the limits of the secondary structure.

Return type

list(_SecondaryStructure)

sender(self) QObject
senderSignalIndex(self) int
sequenceCopied
setDisorderedRegionsPredictions(pred)
setDomainArrangementPredictions(pred)
setGPCRAnnotations(gpcr_annotation_map)
setKinaseConservation(cons_map, lig_asl)
Parameters
setKinaseFeatures(feature_map: Dict[schrodinger.protein.residue.Residue, schrodinger.protein.annotation.KinaseFeatureLabel])
Parameters

feature_map – Map of residue to kinase feature label

setObjectName(self, name: str)
setParent(self, a0: QObject)
setPfam(new_pfam, pfam_name)
setProperty(self, name: str, value: Any) bool
setResidueMap(residue_map)

Set a new mapping between ResidueKey and structured residues.

Note: the only intended user of this method is schrodinger.application.msv.seqio.StructureConverter, where the ResidueKey is computed from the structure._Residue used to create the residue.Residue. If the sequence has a structure, the map can be generated using generateResidueMap.

Parameters

residue_map (dict(residue.ResidueKey, residue.Residue)) – Mapping between residue key and Residue

setSSA(new_ssa)
setSSAPredictions(pred)
setSolventAccessibilityPredictions(pred)
setStructure(struc)

Set the associated structure. Can only be used on sequences with an associated structure.

Parameters

struc (schrodinger.structure.Structure) – The new structure for this sequence

Raises

RuntimeError – If there’s no structure associated with this sequence object.

signalsBlocked(self) bool
startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
structureChanged
structuredResidueCount()

Get the number of residues in this sequence with an associated structured residue. :rtype: int

thread(self) QThread
timerEvent(self, a0: QTimerEvent)
toJson(_mark_version=True)

Create and returns a data structure made up of jsonable items.

Return type

An instance of one the classes from NATIVE_JSON_DATATYPES

toJsonImplementation()

Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.

Returns

A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders

tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str
updateDescriptors(descriptors, property_source)

Updates the descriptor dicts with new descriptor values

Parameters
  • descriptors (dict[str, float]) – A dict mapping descriptor names to their values

  • property_source (properties.PropertySource) – The source of the descriptors

validateGapIndices(gap_idxs)

Make sure that the specified gap indices are valid input for addGapsByIndices. If the indices are invalid, a ValueError will be raised. Indices are considered invalid if:

  • they refer to a position that’s more than one residue past the end of the sequence

  • they are negative

Parameters

gap_idxs (list[int]) – The gap indices to validate

property visibility
visibilityChanged
class schrodinger.protein.sequence.NASequence(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

Bases: schrodinger.protein.sequence.NucleicAcidSequence

A nucleic acid sequence. Agnostic to backbone type and capable of representing bases typical to either DNA or RNA.

ALPHABET = mappingproxy({'A': RibonucleotideType('A', '6MA', 'Adenine'), 'C': RibonucleotideType('C', 'OMC', 'Cytosine'), 'G': RibonucleotideType('G', 'OMG', 'Guanine'), 'U': RibonucleotideType('U', 'DU', 'Uracil'), 'DA': DeoxyribonucleotideType('A', 'DA', 'Adenine'), 'DC': DeoxyribonucleotideType('C', 'DC', 'Cytosine'), 'DG': DeoxyribonucleotideType('G', 'DG', 'Guanine'), 'DT': DeoxyribonucleotideType('T', 'DT', 'Thymine'), 'AMP': RibonucleotideType('A', 'AMP', 'Adenine'), 'ADP': RibonucleotideType('A', 'ADP', 'Adenine'), 'ATP': RibonucleotideType('A', 'ATP', 'Adenine'), '1MA': RibonucleotideType('A', '1MA', 'Adenine'), '6MA': RibonucleotideType('A', '6MA', 'Adenine'), 'CMP': RibonucleotideType('C', 'CMP', 'Cytosine'), 'CDP': RibonucleotideType('C', 'CDP', 'Cytosine'), 'CTP': RibonucleotideType('C', 'CTP', 'Cytosine'), '5MC': RibonucleotideType('C', '5MC', 'Cytosine'), '5HC': RibonucleotideType('C', '5HC', 'Cytosine'), '5FC': RibonucleotideType('C', '5FC', 'Cytosine'), '1CC': RibonucleotideType('C', '1CC', 'Cytosine'), 'OMC': RibonucleotideType('C', 'OMC', 'Cytosine'), 'GMP': RibonucleotideType('G', 'GMP', 'Guanine'), 'GDP': RibonucleotideType('G', 'GDP', 'Guanine'), 'GTP': RibonucleotideType('G', 'GTP', 'Guanine'), '1MG': RibonucleotideType('G', '1MG', 'Guanine'), '2MG': RibonucleotideType('G', '2MG', 'Guanine'), 'M2G': RibonucleotideType('G', 'M2G', 'Guanine'), '7MG': RibonucleotideType('G', '7MG', 'Guanine'), 'OMG': RibonucleotideType('G', 'OMG', 'Guanine'), 'UMP': RibonucleotideType('U', 'UMP', 'Uracil'), 'UDP': RibonucleotideType('U', 'UDP', 'Uracil'), 'UTP': RibonucleotideType('U', 'UTP', 'Uracil'), 'PSU': RibonucleotideType('Ψ', 'PSU', 'Uracil'), 'H2U': RibonucleotideType('U', 'H2U', 'Uracil'), '5MU': RibonucleotideType('U', '5MU', 'Uracil'), 'DU': RibonucleotideType('U', 'DU', 'Uracil'), 'TMP': DeoxyribonucleotideType('T', 'TMP', 'Thymine'), 'TDP': DeoxyribonucleotideType('T', 'TDP', 'Thymine'), 'TTP': DeoxyribonucleotideType('T', 'TTP', 'Thymine'), 'YYG': NucleotideType('N', 'YYG', 'Unknown'), 'I': NucleotideType('I', 'I', 'Unknown'), 'DI': NucleotideType('DI', 'DI', 'Unknown'), 'T': DeoxyribonucleotideType('T', 'TTP', 'Thymine'), 'Ψ': RibonucleotideType('Ψ', 'PSU', 'Uracil'), 'N': NucleotideType('N', 'YYG', 'Unknown')})
getTranslation()

Get a translated sequence. This method uses BioPython’s translate method to convert a nucleic acid sequence into an amino acid sequence

Returns

A translated protein sequence. The name and chain from the nucleic acid sequence are copied over

Return type

ProteinSequence

getComplement()

Get the complement of a DNA or RNA sequence. This method uses BioPython’s complement method for nucleic acid sequences. Supports gaps and unknown residues; does not support ambiguous residues (since NucleicAcidSequence doesn’t). Creates a new Sequence; original object is unmodified.

Returns

The complementary nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getReverseComplement()

Get the reverse complement of a DNA or RNA sequence. Supports gaps and unknown residues; does not support ambiguous residues (since NucleicAcidSequence doesn’t). Creates a new Sequence; original object is unmodified.

Returns

The reverse complement nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

AnnotationClass

alias of schrodinger.protein.annotation.NucleicAcidSequenceAnnotations

ElementClass

alias of schrodinger.protein.residue.Nucleotide

class ORIGIN(value)

Bases: enum.Enum

An enumeration.

Maestro = 1
PyMOL = 2
__contains__(item)
__init__(elements='', name='', origin=None, entry_id=None, entry_name='', pdb_id='', chain='', structure_chain=None, long_name='', resnums=(), disulfide_bonds=None, pred_disulfide_bonds=None)

See AbstractSingleChainSequence for additional documentation.

Parameters
  • disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via disulfide bonds.

  • pred_disulfide_bonds (Iterable(tuple(int, int))) – A list of pairs of residue indices to link via predicted disulfide bonds.

__len__()
classmethod adapter47007(json_dict)
classmethod adapter48002(json_dict)
classmethod adapter52065(json_dict)
addGapsBeforeIndices(indices)

Add one gap to the alignment before each of the specified residue positions. Note that these indices are based on numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices.

Parameters

indices (list(int)) – A list of indices to insert gaps before.

addGapsByIndices(gap_idxs)

Add gaps to the sequence from a list of gap indices. Note that these indices are based on numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see addGapsBeforeIndices.

Parameters

gap_idxs (list(int)) – A list of gap indices

annotationTitleChanged
property annotations
append(element)

Appends an element to the sequence

Parameters

element – The element to append to this sequence

Type

element: self.ElementClass or basestring

blockSignals(self, b: bool) bool
property chain
childEvent(self, a0: QChildEvent)
children(self) List[QObject]
clearAllCaching()

This method should be implemented in subclasses that cache any data.

clearDescriptors()
clearDisulfideBondsCache()
clearPfam()
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent)
deleteAllPredictions()
deleteLater(self)
deletePrediction(prediction_type)
property descriptors
descriptorsCleared
destroyed

destroyed(self, object: typing.Optional[QObject] = None) [signal]

disconnect(a0: QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, signal: QMetaMethod)
disulfideBondsCacheCleared
property disulfide_bonds
Returns

A sorted tuple of the valid disulfide bonds.

Return type

tuple(residue.DisulfideBond)

dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
encodeForPatternSearch(with_ss=False, with_flex=False, with_asa=False)

Convert to sequence dict expected by find_generalized_pattern.

Parameters
  • with_ss (bool) – Whether to include secondary structure information.

  • with_flex (bool) – Whether to include flexibility information.

  • with_asa (bool) – Whether to include accessible surface area information.

Return type

dict

Returns

dictionary of sequence data

event(self, a0: QEvent) bool
eventFilter(self, a0: QObject, a1: QEvent) bool
extend(elements)

Extends the sequence with elements from an iterable

Parameters

elements (iterable(self.ElementClass) or iterable(str)) – The iterable containing elements with which to extend this sequence

findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
classmethod fromJson(json_obj)

A factory method which constructs a new object from a given dict loaded from a json string or file.

Parameters

json_obj (dict) – A json-loaded dictionary to create an object from.

Returns

An instance of this class.

Return type

cls

classmethod fromJsonImplementation(json_obj)

Abstract method that must be defined by all derived classes. Takes in a dictionary and constructs an instance of the derived class.

Parameters

json_dict (dict) – A dictionary loaded from a JSON string or file.

Returns

An instance of the derived class.

Return type

cls

property fullname
Returns

a formatted name + optional chain name for the sequence

Return type

str

property gap_char
generateResidueMap()

Create residue map based on current structured residues.

Note: this method requires self.hasStructure() to be True and self.entry_id to be set. If this sequence was produced by schrodinger.application.msv.seqio.StructureConverter, there should already be a residue map and this method does not need to be called.

Raises

RuntimeError – If sequence has no structure or entry id

getAnnotation(index, annotation)

Returns the annotation at the specified index or None for a gap.

Raises

ValueError – if the annotation is not available

getAnnotationValueForComparison(col, anno, ann_index=0, cdr_scheme=None, vernier=False)

Get an annotation value appropriate for determining whether two residues have the same annotation value. e.g. for binding site, only same-distance contacts of the same ligand should compare equal.

Parameters
  • anno (annotation.ProteinSequenceAnnotations.ANNOTATION_TYPES) – Protein sequence annotation enum member

  • ann_index (int) – Annotation index for multi-value annotations

  • cdr_scheme (annotation.AntibodyCDRScheme) – CDR scheme for antibody annotation. (Will be ignored if anno is not SEQ_ANNO_TYPES.antibody_cdr.)

  • vernier (bool) – Whether Vernier Zones are enabled

Returns

Annotation value for comparison or None if the corresponding residue is a gap or has no value for this annotation

Return type

object or None

getConservation(other, consider_gaps=True, only_consider=None)

Return a float scoring the homology conservation between the sequence and another sequence, assuming that they’re already aligned.

The homology criterion is based on “side chain chemistry” descriptor matching.

Parameters
Returns

The sequence conservation score (between 0.0 and 1.0)

Return type

float

getGapCount()
Returns

the number of gaps in the sequence

Return type

int

getGaplessLength()
Returns

Length of this sequence ignoring gaps

Return type

int

getGaps()
Return type

list(residue.Gap)

Returns

The gaps in the sequence.

getIdentity(other, consider_gaps=True, only_consider=None)

Return a float scoring the identity between the sequence and another sequence, assuming that they’re already aligned

Parameters
Returns

The sequence identity score (between 0.0 and 1.0)

Return type

float

getNextResidue(res)

Return the next residue in the sequence (ignoring gaps) or None if this is the last residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getNumAnnValues(ann)
getPreviousResidue(res)

Return the previous residue in the sequence (ignoring gaps) or None if this is the first residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getProperty(seq_prop)

Get the sequence’s value corresponding to the given SequenceProperty object

Parameters

seq_prop (schrodinger.protein.properties.SequenceProperty) – The object describing the sequence property

Returns

The value of the sequence property

Return type

float or None

getResByKey(res_key)
Parameters

res_key (residue.ResidueKey) – Residue key: (entry_id, chain, resnum, inscode)

Returns

Residue matching key or None if no matching residue is found

Return type

residue.Residue or NoneType

Raises

RuntimeError – If sequence has no structure

getReverse()

Get the reverse of a DNA or RNA sequence. Residues are renumbered. Creates a new Sequence; original object is unmodified.

Returns

The reversed nucleic acid sequence, of the same type as self. The name and chain from the nucleic acid sequence are copied over.

Return type

NucleicAcidSequence

getRun(res)

For a given residue or gap, return a set of all adjacent element indices in the sequence that are also residues or gaps.

Parameters

res (residue.AbstractSequenceElement) – Residue to get the run of

Reuturn

Set of residue indices in the run

Return type

set(int)

getSimilarity(other, consider_gaps=True, only_consider=None)

Return a float score of the similarity count between the sequence and another sequence, assuming that they’re already aligned.

Parameters
Returns

The sequence similarity score (between 0.0 and 1.0)

Return type

float

getSimilarityScore(other, consider_gaps=True, only_consider=None)

Return the total score of similarity between the sequence and a other sequence, assuming that they’re already aligned.

Parameters
  • other (schrodinger.protein.sequence.Sequence) – A sequence to compare against

  • consider_gaps (bool) – Ignored because the similarity with a gap is 0.0

  • only_consider (set or None) – A set of residues to restrict attention to

Returns

The total sequence similarity score

Return type

int

getStructure()
Returns

The associated structure. Will return None if there is no associated structure.

Return type

schrodinger.structure.Structure or NoneType

getStructureResForRes(res)
Parameters

res (residue.Residue) – Residue to get structure residue for

Returns

Structure residue or None if no matching residue is found

Return type

schrodinger.structure._Residue or NoneType

getSubsequence(start, end)

Return a sequence containing a subset of the elements in this one

Parameters
  • start (int) – The index at which the subsequence should start

  • end (int) – The index at which the subsequence should end (exclusive)

Returns

The requested subsequence

Return type

AbstractSequence

getTerminalGaps()

Return terminal gaps.

Returns

A list of terminal gaps (in ascending index order)

Return type

list(residue.Gap)

get_version()

Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.

hasDescriptors()
hasDisorderedRegionsPredictions()
hasDisulfideBondPredictions()
hasDomainArrangementPredictions()
hasPfam()
hasSSAPredictions()
hasSolventAccessibility()
hasStructure()
Returns

Whether this sequence has an associated structure.

Return type

bool

hasStructuredResidues()

Return whether this sequence has any structured residues. This method is equivalent to bool(seq.structuredResidueCount()) but doesn’t (typically) require iterating through the entire sequence.

Return type

bool

index(res, ignore_gaps=False)

Returns the index of the specified residue

Parameters
  • res (residue.Residue) – The residue to find

  • ignore_gaps (bool) – Whether the index returned should ignore gaps in the sequence or not.

Raises

A ValueError if the residue is not present

Return type

int

Returns

The index of the residue

indices(residues, ignore_gaps=False)

Returns the indices of all specified residues. Note that there is no guarantee that the returned integers will be in the same order as the input residues. (For combined-chain sequences, it’s highly likely that they won’t be.)

Parameters
  • res (Iterable(residue.Residue)) – The residues to find indices of

  • ignore_gaps (bool) – Whether the indices returned should ignore gaps in the sequence or not.

Returns

The indices of the residues

Return type

list[int]

inherits(self, classname: str) bool
insertElements(index, elements)

Insert a list of elements or sequence element into this sequence.

If elements is a string or iterable of strings, residue numbers will be automatically assigned.

Parameters
  • index (int) – The index at which to insert elements

  • elements (iterable(self.ElementClass) or iterable(str)) – A list of elements to insert

installEventFilter(self, a0: QObject)
isKinaseChain()
isSignalConnected(self, signal: QMetaMethod) bool
classmethod isValid(elements)
Parameters

elements (iterable(str) or str) – An iterable of string representations of elements making up the sequence

Returns

Tuple indicating whether valid and a set of invalid characters, if any

Return type

tuple(bool, set(str))

isWidgetType(self) bool
isWindowType(self) bool
property is_kinase_annotated
property is_kinase_cons_annotated
iterNeighbors()

Return an iterable of three element tuples consisting of (prev_res, curr_res, next_res), ignoring gaps.

None is used for neighbors of first and last residues in the sequence, and does not indicate gaps here.

Returns

Iterable of 3-tuples, each element of the each tuple being either a schrodinger.protein.residue.Residue or None

Return type

iter(tuple(Residue or NoneType, Residue, Residue or NoneType))

killTimer(self, id: int)
kinaseConservationChanged
kinaseFeaturesChanged
lengthAboutToChange
lengthChanged
classmethod makeSeqElement(element)
Parameters

element (str or cls.ElementClass) – A sequence element or string representation thereof

Returns

sequence element

Return type

cls.ElementClass

metaObject(self) QMetaObject
moveToThread(self, thread: QThread)
mutate(start, end, elements)

Mutate sequence elements starting at the given index to the provided elements.

Parameters
  • start (int) – The index at which to start mutating

  • end (int) – The index of the last mutated element (exclusive)

  • elements (iterable(self.ElementClass) or iterable(str)) – The elements to which to mutate the sequence

property name
nameChanged
objectName(self) str
objectNameChanged

objectNameChanged(self, objectName: str) [signal]

onStructureChanged()
property origin
Returns

A piece of metadata indicating where the sequence came from

Rtype origin

Sequence.ORIGIN or None

parent(self) QObject
pfamChanged
property pred_disulfide_bonds
property pred_secondary_structures
predictionsChanged
property(self, name: str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, signal: PYQT_SIGNAL) int
removeAllGaps()

Remove gaps from the sequence

removeElements(eles)

Remove elements from the sequence.

Parameters

eles (list(residue.AbstractSequenceElement)) – A list of elements to remove from the sequence.

Raises

ValueError – If any of the given elements are not in the sequence.

removeEventFilter(self, a0: QObject)
removeStructurelessResidues(start=0, end=None)

Remove any structureless residues

Parameters
  • start (int) – The index at which to start filtering structureless residues.

  • end (int) – The index at which to end filtering

removeTerminalGaps()

Remove gaps from the end of the sequence

renumberResidues(new_rescode_map)

Renumber residues in this sequence given a dictionary mapping old rescodes to the new desired rescodes.

residues()

Return an iterable of residues, ignoring gaps.

Returns

Iterable of residues

Return type

iter(Residue)

residuesAdded
residuesChanged
residuesRemoved
secondaryStructureCacheCleared
secondaryStructureChanged
property secondary_structures

A list of _SecondaryStructure namedtuples containing the type of secondary structure and where the secondary structures begin and end.

Returns

A list of namedtuples containing an SS_TYPE from schrodinger.structure and the residue indexes marking the limits of the secondary structure.

Return type

list(_SecondaryStructure)

sender(self) QObject
senderSignalIndex(self) int
sequenceCopied
setDisorderedRegionsPredictions(pred)
setDomainArrangementPredictions(pred)
setGPCRAnnotations(gpcr_annotation_map)
setKinaseConservation(cons_map, lig_asl)
Parameters
setKinaseFeatures(feature_map: Dict[schrodinger.protein.residue.Residue, schrodinger.protein.annotation.KinaseFeatureLabel])
Parameters

feature_map – Map of residue to kinase feature label

setObjectName(self, name: str)
setParent(self, a0: QObject)
setPfam(new_pfam, pfam_name)
setProperty(self, name: str, value: Any) bool
setResidueMap(residue_map)

Set a new mapping between ResidueKey and structured residues.

Note: the only intended user of this method is schrodinger.application.msv.seqio.StructureConverter, where the ResidueKey is computed from the structure._Residue used to create the residue.Residue. If the sequence has a structure, the map can be generated using generateResidueMap.

Parameters

residue_map (dict(residue.ResidueKey, residue.Residue)) – Mapping between residue key and Residue

setSSA(new_ssa)
setSSAPredictions(pred)
setSolventAccessibilityPredictions(pred)
setStructure(struc)

Set the associated structure. Can only be used on sequences with an associated structure.

Parameters

struc (schrodinger.structure.Structure) – The new structure for this sequence

Raises

RuntimeError – If there’s no structure associated with this sequence object.

signalsBlocked(self) bool
startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
structureChanged
structuredResidueCount()

Get the number of residues in this sequence with an associated structured residue. :rtype: int

thread(self) QThread
timerEvent(self, a0: QTimerEvent)
toJson(_mark_version=True)

Create and returns a data structure made up of jsonable items.

Return type

An instance of one the classes from NATIVE_JSON_DATATYPES

toJsonImplementation()

Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.

Returns

A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders

tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str
updateDescriptors(descriptors, property_source)

Updates the descriptor dicts with new descriptor values

Parameters
  • descriptors (dict[str, float]) – A dict mapping descriptor names to their values

  • property_source (properties.PropertySource) – The source of the descriptors

validateGapIndices(gap_idxs)

Make sure that the specified gap indices are valid input for addGapsByIndices. If the indices are invalid, a ValueError will be raised. Indices are considered invalid if:

  • they refer to a position that’s more than one residue past the end of the sequence

  • they are negative

Parameters

gap_idxs (list[int]) – The gap indices to validate

property visibility
visibilityChanged
class schrodinger.protein.sequence.CombinedChainSequenceMeta(cls, bases, classdict, *, wraps=None, wrapped_constants=(), wrapped_properties=(), wrapped_getters=(), wrapped_setters=())

Bases: schrodinger.application.msv.utils.DocstringWrapperMetaClass, schrodinger.protein.sequence.ProteinSequenceMeta

The metaclass for CombinedChainProteinSequence. This metaclass wraps the specified class attributes.

property ALPHABET
__init__(*args, **kwargs)
mro()

Return a type’s method resolution order.

class schrodinger.protein.sequence.GapRegion(from_start: int, from_end: int)

Bases: object

Container for information about gaps to add to or remove from the start and end of a chain

from_start: int
from_end: int
__init__(from_start: int, from_end: int) None
class schrodinger.protein.sequence.CombinedChainProteinSequence(seqs)

Bases: schrodinger.protein.sequence.AbstractProteinSequenceMixin, schrodinger.protein.sequence.AbstractSequence

A sequence that contains multiple chains from the same protein. Instances of this class do not directly contain any residues themselves and instead wrap one or several ProteinSequence objects.

Note

CombinedChainProteinSequence.visibility properly reports entry inclusion state, but it may not correctly report entry visibility (e.g. partially visible vs. fully visible). The MSV structure icons only report inclusion state and the visibility of included entries isn’t reported anywhere in the panel, though, so this limitation doesn’t have any impact on functionality.

AnnotationClass

alias of schrodinger.protein.annotation.CombinedChainProteinSequenceAnnotations

__init__(seqs)
Parameters

seqs (list(ProteinSequence)) – A list of the split-chain sequences to wrap.

__len__()
property fullname
index(res)

Returns the index of the specified residue

Parameters
  • res (residue.Residue) – The residue to find

  • ignore_gaps (bool) – Whether the index returned should ignore gaps in the sequence or not.

Raises

A ValueError if the residue is not present

Return type

int

Returns

The index of the residue

indices(residues)

Returns the indices of all specified residues. Note that the returned integers will likely not be in the same order as the input residues.

Parameters

res (Iterable(residue.CombinedChainResidueWrapper)) – The residues to find indices of

Returns

The indices of the residues

Return type

list[int]

insertElements(index, elements)

Insert a list of elements or sequence element into this sequence.

If elements is a string or iterable of strings, residue numbers will be automatically assigned.

Parameters
  • index (int) – The index at which to insert elements

  • elements (iterable(self.ElementClass) or iterable(str)) – A list of elements to insert

mutate(start, end, elements)

Mutate sequence elements. See parent class for additional method documentation.

Raises

MultipleChainsError – If the specified residue range spans multiple chains.

assertCanMutateResidues(start, end)

Make sure that we can mutate the specified residues. If not, raise an exception.

Parameters
  • start (int) – The index at which to start mutating

  • end (int) – The index of the last mutated element (exclusive)

Raises

MultipleChainsError – If the specified residue range spans multiple chains.

append(element)

Appends an element to the sequence

Parameters

element – The element to append to this sequence

Type

element: self.ElementClass or basestring

extend(elements)

Extends the sequence with elements from an iterable

Parameters

elements (iterable(self.ElementClass) or iterable(str)) – The iterable containing elements with which to extend this sequence

getSubsequence(start, end)

Return a sequence containing a subset of the elements in this one. Note that the new sequence will be a split-chain sequence and will ignore any chain breaks present in the requested subset of elements.

Parameters
  • start (int) – The index at which the subsequence should start

  • end (int) – The index at which the subsequence should end (exclusive)

Returns

The requested subsequence

Return type

ProteinSequence

removeElements(eles)

Remove elements from the sequence.

Parameters

eles (list(residue.AbstractSequenceElement)) – A list of elements to remove from the sequence.

Raises

ValueError – If any of the given elements are not in the sequence.

getStructureResForRes(res)
Parameters

res (residue.Residue) – Residue to get structure residue for

Returns

Structure residue or None if no matching residue is found

Return type

schrodinger.structure._Residue or NoneType

getGaplessLength()
Returns

Length of this sequence ignoring gaps

Return type

int

addGapsByIndices(gap_idxs)

Add gaps to the sequence from a list of gap indices. Note that these indices are based on numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see addGapsBeforeIndices.

Parameters

gap_idxs (list(int)) – A list of gap indices

addGapsToChainStartsAndEnds(gaps: List[schrodinger.protein.sequence.GapRegion])

Add the specified numbers of gaps to the starts and ends of each chain.

Parameters

gaps – The numbers of gaps to add

removeGapsFromChainStartsAndEnds(gaps: List[schrodinger.protein.sequence.GapRegion])

Remove the specified numbers of gaps from the starts and ends of each chain.

Parameters

gaps – The numbers of gaps to remove

validateGapsToRemoveFromChainStartAndEnds(gaps: List[schrodinger.protein.sequence.GapRegion])

Make sure that we can remove the specified numbers of gaps from the starts and ends of each chain.

Parameters

gaps – The numbers of gaps to remove

Raises

AssertionError – If some of the sequence elements to be removed aren’t actually gaps.

property disulfide_bonds
Returns

A sorted tuple of the valid disulfide bonds.

Return type

tuple(residue.CombinedChainDisulfideBond)

isKinaseChain()
property pred_disulfide_bonds
indexToSeqAndIndex(index)

Convert a combined-chain residue index to a split-chain sequence and a residue index within the specified sequence.

Parameters

index (int) – A valid combined-chain residue index

Returns

A tuple of - the split-chain sequence - residue index - the starting index of the split-chain sequence

Return type

tuple(ProteinSequence, int, int)

property chain
property chains
property chain_offsets
hasChain(chain_name)

Does this sequence contain a chain with the specified name?

Parameters

chain_name (str) – The chain name to check

Return type

bool

addChain(seq)

Add a new chain to this sequence.

Parameters

seq (ProteinSequence) – The chain to add

removeChain(seq)

Remove a chain from this sequence. Note that you should not remove the last chain; instead, remove this sequence from the alignment.

Parameters

seq (ProteinSequence) – The chain to remove

removeChains(seqs)

Remove multiple chains from this sequence. Note that you should not all chain from a combine-chain sequence; instead, remove the sequence from the alignment.

Parameters

seqs (list[ProteinSequence]) – The chains to remove

insertElementByChain(index, chain, element)

Add the given element to the specified chain of a sequence.

Parameters
offsetForChain(chain)

Get the combined-chain residue index for the first residue of the specified chain.

Parameters

chain (ProteinSequence) – The chain

Returns

The offset

Return type

int

clearAllCaching()

This method should be implemented in subclasses that cache any data.

ALPHABET = mappingproxy({'DAL': ResidueType('X', 'DAL', 'Unknown'), 'DAR': ResidueType('X', 'DAR', 'Unknown'), 'DSG': ResidueType('X', 'DSG', 'Unknown'), 'DAS': ResidueType('X', 'DAS', 'Unknown'), 'DCY': ResidueType('X', 'DCY', 'Unknown'), 'DGL': ResidueType('X', 'DGL', 'Unknown'), 'DGN': ResidueType('X', 'DGN', 'Unknown'), 'DHI': ResidueType('X', 'DHI', 'Unknown'), 'DIL': ResidueType('X', 'DIL', 'Unknown'), 'DLE': ResidueType('X', 'DLE', 'Unknown'), 'DLY': ResidueType('X', 'DLY', 'Unknown'), 'MED': ResidueType('X', 'MED', 'Unknown'), 'DPN': ResidueType('X', 'DPN', 'Unknown'), 'DPR': ResidueType('X', 'DPR', 'Unknown'), 'DSN': ResidueType('X', 'DSN', 'Unknown'), 'DTH': ResidueType('X', 'DTH', 'Unknown'), 'DTR': ResidueType('X', 'DTR', 'Unknown'), 'DTY': ResidueType('X', 'DTY', 'Unknown'), 'DVA': ResidueType('X', 'DVA', 'Unknown'), 'NLE': ResidueType('X', 'NLE', 'Unknown'), 'NVA': ResidueType('X', 'NVA', 'Unknown'), '200': ResidueType('X', '200', 'Unknown'), 'GNC': ResidueType('X', 'GNC', 'Unknown'), '0AO': ResidueType('X', '0AO', 'Unknown'), 'NA8': ResidueType('X', 'NA8', 'Unknown'), 'MEA': ResidueType('X', 'MEA', 'Unknown'), 'BCS': ResidueType('X', 'BCS', 'Unknown'), 'EBZ': ResidueType('X', 'EBZ', 'Unknown'), 'HBZ': ResidueType('X', 'HBZ', 'Unknown'), 'SEM': ResidueType('X', 'SEM', 'Unknown'), 'Z3E': ResidueType('X', 'Z3E', 'Unknown'), 'TY5': ResidueType('X', 'TY5', 'Unknown'), 'HYP': ResidueType('X', 'HYP', 'Unknown'), 'PTR': ResidueType('y', 'PTR', 'Tyrosine'), 'SEP': ResidueType('s', 'SEP', 'Serine'), 'TPO': ResidueType('t', 'TPO', 'Threonine'), 'ASQ': ResidueType('X', 'ASQ', 'Unknown'), 'MSE': ResidueType('M', 'MSE', 'Methionine'), 'THP': ResidueType('X', 'THP', 'Unknown'), 'ABA': ResidueType('X', 'ABA', 'Unknown'), 'AIB': ResidueType('X', 'AIB', 'Unknown'), 'A': ResidueType('A', 'ALA', 'Alanine'), 'C': ResidueType('C', 'CYS', 'Cysteine'), 'D': ResidueType('D', 'ASP', 'Aspartic acid'), 'E': ResidueType('E', 'GLU', 'Glutamic acid'), 'F': ResidueType('F', 'PHE', 'Phenylalanine'), 'G': ResidueType('G', 'GLY', 'Glycine'), 'H': ResidueType('H', 'HIS', 'Histidine'), 'I': ResidueType('I', 'ILE', 'Isoleucine'), 'K': ResidueType('K', 'LYS', 'Lysine'), 'L': ResidueType('L', 'LEU', 'Leucine'), 'M': ResidueType('M', 'MET', 'Methionine'), 'N': ResidueType('N', 'ASN', 'Asparagine'), 'P': ResidueType('P', 'PRO', 'Proline'), 'Q': ResidueType('Q', 'GLN', 'Glutamine'), 'R': ResidueType('R', 'ARG', 'Arginine'), 'S': ResidueType('S', 'SER', 'Serine'), 'T': ResidueType('T', 'THR', 'Threonine'), 'V': ResidueType('V', 'VAL', 'Valine'), 'W': ResidueType('W', 'TRP', 'Tryptophan'), 'Y': ResidueType('Y', 'TYR', 'Tyrosine'), 'ALA': ResidueType('A', 'ALA', 'Alanine'), 'CYS': ResidueType('C', 'CYS', 'Cysteine'), 'ASP': ResidueType('D', 'ASP', 'Aspartic acid'), 'GLU': ResidueType('E', 'GLU', 'Glutamic acid'), 'PHE': ResidueType('F', 'PHE', 'Phenylalanine'), 'GLY': ResidueType('G', 'GLY', 'Glycine'), 'HIS': ResidueType('H', 'HIS', 'Histidine'), 'ILE': ResidueType('I', 'ILE', 'Isoleucine'), 'LYS': ResidueType('K', 'LYS', 'Lysine'), 'LEU': ResidueType('L', 'LEU', 'Leucine'), 'MET': ResidueType('M', 'MET', 'Methionine'), 'ASN': ResidueType('N', 'ASN', 'Asparagine'), 'PRO': ResidueType('P', 'PRO', 'Proline'), 'GLN': ResidueType('Q', 'GLN', 'Glutamine'), 'ARG': ResidueType('R', 'ARG', 'Arginine'), 'SER': ResidueType('S', 'SER', 'Serine'), 'THR': ResidueType('T', 'THR', 'Threonine'), 'VAL': ResidueType('V', 'VAL', 'Valine'), 'TRP': ResidueType('W', 'TRP', 'Tryptophan'), 'TYR': ResidueType('Y', 'TYR', 'Tyrosine'), 'ACE': ResidueType('X', 'ACE', 'Capping Group'), 'NMA': ResidueType('X', 'NMA', 'Capping Group'), 'IND': ResidueType('X', 'IND', 'Capping Group'), 'NCO': ResidueType('X', 'NCO', 'Capping Group'), 'ANF': ResidueType('X', 'ANF', 'Capping Group'), 'TOSG': ResidueType('X', 'TOSG', 'Capping Group'), 'FCO': ResidueType('X', 'FCO', 'Capping Group'), 'MPA': ResidueType('X', 'MPA', 'Capping Group'), 'NH2': ResidueType('X', 'NH2', 'Capping Group'), 'THO': ResidueType('T', 'THO', 'Threonine'), 'CYX': ResidueType('C', 'CYX', 'Cysteine'), 'HID': ResidueType('H', 'HID', 'Histidine'), 'CYT': ResidueType('C', 'CYT', 'Cysteine'), 'LYN': ResidueType('K', 'LYN', 'Lysine'), 'SRO': ResidueType('S', 'SRO', 'Serine'), 'GLH': ResidueType('E', 'GLH', 'Glutamic acid'), 'ASH': ResidueType('D', 'ASH', 'Aspartic acid'), 'ARN': ResidueType('R', 'ARN', 'Arginine'), 'TYO': ResidueType('Y', 'TYO', 'Tyrosine'), 'HIE': ResidueType('H', 'HIE', 'Histidine'), 'HSD': ResidueType('H', 'HSD', 'Histidine'), 'HIP': ResidueType('H', 'HIP', 'Histidine'), 'HSE': ResidueType('H', 'HSE', 'Histidine'), 'HSP': ResidueType('H', 'HSP', 'Histidine'), 'CYM': ResidueType('C', 'CYM', 'Cysteine'), 'X': ResidueType('X', 'UNK', 'Unknown'), 'UNK': ResidueType('X', 'UNK', 'Unknown')})
ElementClass

alias of schrodinger.protein.residue.Residue

class ORIGIN(value)

Bases: enum.Enum

An enumeration.

Maestro = 1
PyMOL = 2
addGapsBeforeIndices(indices)

Add one gap to the alignment before each of the specified residue positions. Note that these indices are based on numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices.

Parameters

indices (list(int)) – A list of indices to insert gaps before.

annotationTitleChanged
property annotations
blockSignals(self, b: bool) bool
childEvent(self, a0: QChildEvent)
children(self) List[QObject]
clearDescriptors()
clearDisulfideBondsCache()
clearPfam()
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent)
deleteLater(self)
property descriptors
descriptorsCleared
destroyed

destroyed(self, object: typing.Optional[QObject] = None) [signal]

disconnect(a0: QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, signal: QMetaMethod)
disulfideBondsCacheCleared
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
property entry_id
property entry_name
event(self, a0: QEvent) bool
eventFilter(self, a0: QObject, a1: QEvent) bool
findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
property gap_char
getAnnotation(index, annotation)

Returns the annotation at the specified index or None for a gap.

Raises

ValueError – if the annotation is not available

getAnnotationValueForComparison(col, anno, ann_index=0, cdr_scheme=None, vernier=False)

Get an annotation value appropriate for determining whether two residues have the same annotation value. e.g. for binding site, only same-distance contacts of the same ligand should compare equal.

Parameters
  • anno (annotation.ProteinSequenceAnnotations.ANNOTATION_TYPES) – Protein sequence annotation enum member

  • ann_index (int) – Annotation index for multi-value annotations

  • cdr_scheme (annotation.AntibodyCDRScheme) – CDR scheme for antibody annotation. (Will be ignored if anno is not SEQ_ANNO_TYPES.antibody_cdr.)

  • vernier (bool) – Whether Vernier Zones are enabled

Returns

Annotation value for comparison or None if the corresponding residue is a gap or has no value for this annotation

Return type

object or None

getConservation(other, consider_gaps=True, only_consider=None)

Return a float scoring the homology conservation between the sequence and another sequence, assuming that they’re already aligned.

The homology criterion is based on “side chain chemistry” descriptor matching.

Parameters
Returns

The sequence conservation score (between 0.0 and 1.0)

Return type

float

getGapCount()
Returns

the number of gaps in the sequence

Return type

int

getGaps()
Return type

list(residue.Gap)

Returns

The gaps in the sequence.

getIdentity(other, consider_gaps=True, only_consider=None)

Return a float scoring the identity between the sequence and another sequence, assuming that they’re already aligned

Parameters
Returns

The sequence identity score (between 0.0 and 1.0)

Return type

float

getNextResidue(res)

Return the next residue in the sequence (ignoring gaps) or None if this is the last residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getNumAnnValues(ann)
getPreviousResidue(res)

Return the previous residue in the sequence (ignoring gaps) or None if this is the first residue.

Parameters

res (schrodinger.protein.residue.Residue) – A given residue in the sequence

Returns

The previous residue in the sequence

Return type

schrodinger.protein.residue.Residue

getProperty(seq_prop)

Get the sequence’s value corresponding to the given SequenceProperty object

Parameters

seq_prop (