schrodinger.protein.alignment module¶
Classes for working with sequences containing alignment information (gaps) and collections thereof.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.protein.alignment.
ResidueSelection
(residues, indices)¶ Bases:
tuple
-
__add__
¶ Return self+value.
-
__class__
¶ alias of
builtins.type
-
__contains__
¶ Return key in self.
-
__delattr__
¶ Implement delattr(self, name).
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__getitem__
¶ Return self[key].
-
__getnewargs__
()¶ Return self as a plain tuple. Used by copy and pickle.
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__iter__
¶ Implement iter(self).
-
__le__
¶ Return self<=value.
-
__len__
¶ Return len(self).
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.protein.alignment'¶
-
__mul__
¶ Return self*value.n
-
__ne__
¶ Return self!=value.
-
static
__new__
(_cls, residues, indices)¶ Create new instance of ResidueSelection(residues, indices)
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
()¶ Return a nicely formatted representation string
-
__rmul__
¶ Return self*value.
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__slots__
= ()¶
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
count
(value) → integer -- return number of occurrences of value¶
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
indices
¶ Alias for field number 1
-
residues
¶ Alias for field number 0
-
-
class
schrodinger.protein.alignment.
ResidueSimilarity
¶ Bases:
enum.Enum
An enumeration.
-
Dissimilar
= 3¶
-
Identical
= 1¶
-
NA
= 4¶
-
Similar
= 2¶
-
__class__
¶ alias of
enum.EnumMeta
-
__members__
= mappingproxy(OrderedDict([('Identical', <ResidueSimilarity.Identical: 1>), ('Similar', <ResidueSimilarity.Similar: 2>), ('Dissimilar', <ResidueSimilarity.Dissimilar: 3>), ('NA', <ResidueSimilarity.NA: 4>)]))¶
-
__module__
= 'schrodinger.protein.alignment'¶
-
-
exception
schrodinger.protein.alignment.
AnchoredResidueError
¶ Bases:
RuntimeError
-
__cause__
¶ exception cause
-
__class__
¶ alias of
builtins.type
-
__context__
¶ exception context
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.protein.alignment', '__weakref__': <attribute '__weakref__' of 'AnchoredResidueError' objects>, '__doc__': None})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.protein.alignment'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__setstate__
()¶
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__suppress_context__
¶
-
__traceback__
¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
schrodinger.protein.alignment.
StructuredResidueError
¶ Bases:
RuntimeError
-
__cause__
¶ exception cause
-
__class__
¶ alias of
builtins.type
-
__context__
¶ exception context
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.protein.alignment', '__weakref__': <attribute '__weakref__' of 'StructuredResidueError' objects>, '__doc__': None})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.protein.alignment'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__setstate__
()¶
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__suppress_context__
¶
-
__traceback__
¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
schrodinger.protein.alignment.
AlignmentSignals
¶ Bases:
PyQt5.QtCore.QObject
A collection of signals that can be emitted by an alignment
Variables: - sequencesAboutToBeInserted (
QtCore.pyqtSignal
) – A signal emitted before sequences are inserted into the alignment. Emitted with: (The index of the first sequence to be inserted, The index of the last sequence to be inserted) - sequencesInserted (
QtCore.pyqtSignal
) – A signal emitted after sequences are inserted into the alignment. Emitted with: (The index of the first sequence inserted, The index of the last sequence inserted) - sequencesAboutToBeRemoved (
QtCore.pyqtSignal
) – A signal emitted before sequences are removed from the alignment. Emitted with: (The index of the first sequence to be removed, The index of the last sequence to be removed) - sequencesRemoved (
QtCore.pyqtSignal
) – A signal emitted after sequences are removed from the alignment. Emitted with: (The index of the first sequence removed, The index of the last sequence removed) - sequenceResiduesChanged (
QtCore.pyqtSignal
) – A signal emitted after the contents of a sequence have changed. Note that this signal may also be emitted in response to a sequence changing length, as positions in the alignment may switch from blank to occupied or vice versa. Emitted with: (The modified sequence, The position of the first modified residue, The position of the last modified residue) - sequencesAboutToBeReordered – Signal emitted before reordering sequences
- sequencesReordered – Signal emitted after sequences have been reordered
- sequenceNameChanged (
QtCore.pyqtSignal
) – A signal emitted after a sequence has changed names. Emitted with: (The modified sequence) - annotationTitleChanged (
QtCore.pyqtSignal
) – A signal emitted after a sequence’s annotation has changed titles. Emitted with: (The sequence whose annotation title has been modified) - alignmentNumColumnsAboutToChange (
QtCore.pyqtSignal
) – A signal emitted before the alignment changes length. Emitted with: (The current length of the alignment, The new length of the alignment) - alignmentNumColumnsChanged (
QtCore.pyqtSignal
) – A signal emitted after the alignment changes length. Emitted with: (The old length of the alignment, The current length of the alignment) - residuesAboutToBeRemoved (
QtCore.pyqtSignal
) – A signal emitted before residues are to be removed. Emitted with a list of the residues to be removed. - residuesRemoved (
QtCore.pyqtSignal
) – A signal emitted after residues are removed. This signal is not emitted with any parameters, but the residues that were removed were listed with the corresponding residuesAboutToBeRemoved signal. - residuesAdded (
QtCore.pyqtSignal
) – A signal emitted with added residues. Note that this signal will be only be emitted once even if residues are added to multiple sequences. In addition, each individual sequence will emit a lengthChanged signal. - sequenceVisibilityChanged (
QtCore.pyqtSignal
) – A signal emitted when visibility of a sequence changes. Emitted with: (the sequence whose visibility is changing, the index of the sequence) - sequenceStructureChanged (
QtCore.pyqtSignal
) – A signal emitted when structure of a sequence changes. Emitted with: (the sequence whose visibility is changing, the index of the sequence) - alignmentAboutToBeCleared (
QtCore.pyqtSignal
) – A signal emitted just before all sequences are removed from the alignment. - alignmentCleared (
QtCore.pyqtSignal
) – A signal emitted just after all sequences have been removed from the alignment. - anchoredResiduesChanged – A signal emitted when one or more residues are anchored or unanchored.
Type: sequencesAboutToBeReordered:
QtCore.pyqtSignals
Type: sequencesReordered:
QtCore.pyqtSignals
-
sequencesAboutToBeInserted
¶
-
sequencesInserted
¶
-
sequencesAboutToBeRemoved
¶
-
sequencesRemoved
¶
-
sequenceResiduesChanged
¶
-
sequencesAboutToBeReordered
¶
-
sequencesReordered
¶
-
sequenceNameChanged
¶
-
annotationTitleChanged
¶
-
alignmentNumColumnsAboutToChange
¶
-
alignmentNumColumnsChanged
¶
-
residuesAboutToBeRemoved
¶
-
residuesRemoved
¶
-
residuesAdded
¶
-
sequenceVisibilityChanged
¶
-
sequenceStructureChanged
¶
-
alignmentAboutToBeCleared
¶
-
alignmentCleared
¶
-
anchoredResiduesChanged
¶
-
emitSeqResChanged
(first_res, last_res)¶
-
emitSeqNameChanged
()¶
-
emitAnnTitleChanged
()¶
-
__class__
¶ alias of
sip.wrappertype
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.protein.alignment', '__doc__': "\n A collection of signals that can be emitted by an alignment\n\n :ivar sequencesAboutToBeInserted: A signal emitted before sequences are\n inserted into the alignment. Emitted with: (The index of the first\n sequence to be inserted, The index of the last sequence to be inserted)\n :vartype sequencesAboutToBeInserted: `QtCore.pyqtSignal`\n\n :ivar sequencesInserted: A signal emitted after sequences are\n inserted into the alignment. Emitted with: (The index of the first\n sequence inserted, The index of the last sequence inserted)\n :vartype sequencesInserted: `QtCore.pyqtSignal`\n\n :ivar sequencesAboutToBeRemoved: A signal emitted before sequences are\n removed from the alignment. Emitted with: (The index of the first\n sequence to be removed, The index of the last sequence to be removed)\n :vartype sequencesAboutToBeRemoved: `QtCore.pyqtSignal`\n\n :ivar sequencesRemoved: A signal emitted after sequences are\n removed from the alignment. Emitted with: (The index of the first\n sequence removed, The index of the last sequence removed)\n :vartype sequencesRemoved: `QtCore.pyqtSignal`\n\n :ivar sequenceResiduesChanged: A signal emitted after the contents of a\n sequence have changed. Note that this signal may also be emitted in\n response to a sequence changing length, as positions in the alignment\n may switch from blank to occupied or vice versa. Emitted with: (The\n modified sequence, The position of the first modified residue, The\n position of the last modified residue)\n :vartype sequenceResiduesChanged: `QtCore.pyqtSignal`\n\n :ivar sequencesAboutToBeReordered: Signal emitted before reordering\n sequences\n :type: sequencesAboutToBeReordered: `QtCore.pyqtSignals`\n\n :ivar sequencesReordered: Signal emitted after sequences have been reordered\n :type: sequencesReordered: `QtCore.pyqtSignals`\n\n :ivar sequenceNameChanged: A signal emitted after a sequence has changed\n names. Emitted with: (The modified sequence)\n :vartype sequenceNameChanged: `QtCore.pyqtSignal`\n\n :ivar annotationTitleChanged: A signal emitted after a sequence's annotation\n has changed titles. Emitted with: (The sequence whose annotation title\n has been modified)\n :vartype annotationTitleChanged: `QtCore.pyqtSignal`\n\n :ivar alignmentNumColumnsAboutToChange: A signal emitted before the\n alignment changes length. Emitted with: (The current length of the\n alignment, The new length of the alignment)\n :vartype alignmentNumColumnsAboutToChange: `QtCore.pyqtSignal`\n\n :ivar alignmentNumColumnsChanged: A signal emitted after the alignment\n changes length. Emitted with: (The old length of the alignment, The\n current length of the alignment)\n :vartype alignmentNumColumnsChanged: `QtCore.pyqtSignal`\n\n :ivar residuesAboutToBeRemoved: A signal emitted before residues are to be\n removed. Emitted with a list of the residues to be removed.\n :vartype residuesAboutToBeRemoved: `QtCore.pyqtSignal`\n\n :ivar residuesRemoved: A signal emitted after residues are removed. This\n signal is not emitted with any parameters, but the residues that were\n removed were listed with the corresponding residuesAboutToBeRemoved\n signal.\n :vartype residuesRemoved: `QtCore.pyqtSignal`\n\n :ivar residuesAdded: A signal emitted with added residues. Note that this\n signal will be only be emitted once even if residues are added to\n multiple sequences. In addition, each individual sequence will emit a\n lengthChanged signal.\n :vartype residuesAdded: `QtCore.pyqtSignal`\n\n :ivar sequenceVisibilityChanged: A signal emitted when visibility of a\n sequence changes. Emitted with: (the sequence whose visibility is\n changing, the index of the sequence)\n :vartype sequenceVisibilityChanged: `QtCore.pyqtSignal`\n\n :ivar sequenceStructureChanged: A signal emitted when structure of a\n sequence changes. Emitted with: (the sequence whose visibility is\n changing, the index of the sequence)\n :vartype sequenceStructureChanged: `QtCore.pyqtSignal`\n\n :ivar alignmentAboutToBeCleared: A signal emitted just before all sequences\n are removed from the alignment.\n :vartype alignmentAboutToBeCleared: `QtCore.pyqtSignal`\n\n :ivar alignmentCleared: A signal emitted just after all sequences have been\n removed from the alignment.\n :vartype alignmentCleared: `QtCore.pyqtSignal`\n\n :ivar anchoredResiduesChanged: A signal emitted when one or more residues\n are anchored or unanchored.\n :vartype alignmentCleared: `QtCore.pyqtSignal`\n ", 'sequencesAboutToBeInserted': <unbound PYQT_SIGNAL AlignmentSignals.sequencesAboutToBeInserted[int, int]>, 'sequencesInserted': <unbound PYQT_SIGNAL AlignmentSignals.sequencesInserted[int, int]>, 'sequencesAboutToBeRemoved': <unbound PYQT_SIGNAL AlignmentSignals.sequencesAboutToBeRemoved[int, int]>, 'sequencesRemoved': <unbound PYQT_SIGNAL AlignmentSignals.sequencesRemoved[int, int]>, 'sequenceResiduesChanged': <unbound PYQT_SIGNAL AlignmentSignals.sequenceResiduesChanged[Sequence, int, int]>, 'sequencesAboutToBeReordered': <unbound PYQT_SIGNAL AlignmentSignals.sequencesAboutToBeReordered[]>, 'sequencesReordered': <unbound PYQT_SIGNAL AlignmentSignals.sequencesReordered[list]>, 'sequenceNameChanged': <unbound PYQT_SIGNAL AlignmentSignals.sequenceNameChanged[Sequence]>, 'annotationTitleChanged': <unbound PYQT_SIGNAL AlignmentSignals.annotationTitleChanged[Sequence]>, 'alignmentNumColumnsAboutToChange': <unbound PYQT_SIGNAL AlignmentSignals.alignmentNumColumnsAboutToChange[int, int]>, 'alignmentNumColumnsChanged': <unbound PYQT_SIGNAL AlignmentSignals.alignmentNumColumnsChanged[int, int]>, 'residuesAboutToBeRemoved': <unbound PYQT_SIGNAL AlignmentSignals.residuesAboutToBeRemoved[list]>, 'residuesRemoved': <unbound PYQT_SIGNAL AlignmentSignals.residuesRemoved[]>, 'residuesAdded': <unbound PYQT_SIGNAL AlignmentSignals.residuesAdded[list]>, 'sequenceVisibilityChanged': <unbound PYQT_SIGNAL AlignmentSignals.sequenceVisibilityChanged[Sequence, int]>, 'sequenceStructureChanged': <unbound PYQT_SIGNAL AlignmentSignals.sequenceStructureChanged[Sequence, int]>, 'alignmentAboutToBeCleared': <unbound PYQT_SIGNAL AlignmentSignals.alignmentAboutToBeCleared[]>, 'alignmentCleared': <unbound PYQT_SIGNAL AlignmentSignals.alignmentCleared[]>, 'anchoredResiduesChanged': <unbound PYQT_SIGNAL AlignmentSignals.anchoredResiduesChanged[]>, 'emitSeqResChanged': <function AlignmentSignals.emitSeqResChanged>, 'emitSeqNameChanged': <function AlignmentSignals.emitSeqNameChanged>, 'emitAnnTitleChanged': <function AlignmentSignals.emitAnnTitleChanged>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattr__
(self, str) → object¶
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.protein.alignment'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
blockSignals
(self, bool) → bool¶
-
childEvent
(self, QChildEvent)¶
-
children
(self) → object¶
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → object¶
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
-
inherits
(self, str) → bool¶
-
installEventFilter
(self, QObject)¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
killTimer
(self, int)¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
parent
(self) → QObject¶
-
property
(self, 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, PYQT_SIGNAL) → int¶
-
removeEventFilter
(self, QObject)¶
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
setObjectName
(self, str)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
signalsBlocked
(self) → bool¶
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶
- sequencesAboutToBeInserted (
-
class
schrodinger.protein.alignment.
BaseAlignment
(sequences=None)¶ Bases:
PyQt5.QtCore.QObject
Abstract base class for classes which handle alignment of various sequences and corresponding annotations.
This is a pure domain object intended to make it easy to work with aligned collections of sequences.
Some methods are decorated with @msv_utils.const in order to make it easy to write a wrapper for this class that supports undo/redo operations.
Variables: - _ALN_ANNOTATION_CLASS (type) – The class for alignment annotations. This value should be overriden in subclasses.
- _SEQ_ANNOTATION_CLASS (type) – The class for sequence annotations. This value should be overriden in subclasses.
-
__init__
(sequences=None)¶ Parameters: sequences (list) – An optional iterable of sequences
-
__len__
()¶ Returns the number of sequences in the alignment
-
__iter__
()¶ Returns an iterable of the sequences held in the alignment
-
__contains__
(seq)¶ Returns whether the sequence is present in the alignment
-
__getitem__
(index)¶ Returns the sequence at the index in the alignment
-
__str__
()¶ Returns a str representation of the alignment
This is fairly detailed since it is very useful for debugging
-
__repr__
()¶ Return type: str Returns: A str representation of the alignment
-
__deepcopy__
(memo)¶ We should be able to copy an alignment, getting back an alignment with all the essential data in the original alignment and sharing no references with it
-
global_annotations
¶ Returns the alignment-level annotations available for the alignment
-
seq_annotations
¶ Returns the sequence-level annotations available for sequences held in the alignment
-
all_annotations
¶ Return a list of all annotations types in this alignment
-
getGlobalAnnotationData
(index, annotation)¶ Returns column-level annotation data at an index in the alignment
Parameters: - index (int) – The index in the alignment
- annotation (
enum.Enum
) – An enum representing the requested annotation, if any
-
num_columns
¶
-
getWorkspaceCounts
()¶ Summarize the visibility status of the alignment’s sequences
Returns: Counts of each type of visibility Return type: collections.Counter
-
index
(seq)¶ Returns the index of the specified sequence.
Parameters: seq ( sequence.Sequence
) – The requested sequenceReturn type: int Returns: The index of the requested sequence
-
reorderSequences
(seq_indices)¶ Reorder the sequences in the alignment using the specified list of indices.
In the undoable version of this class, the private function is needed to perform the operation in an undoable operation.
Parameters: seq_indices – A list with the new indices for sequences Type: list of int Raises: ValueError – In the event that the list of indices does not match the length of the alignment
-
sort
(*, key, reverse=False)¶ Sort the alignment by the specified criteria.
NOTE: Query sequence is not included in the sort.
Parameters: - key (function) – A function that takes a sequence and returns a value to sort by for each sequence. (required keyword-only argument)
- reverse (bool) – Whether to sort in reverse (descending) order.
-
addSeq
(seq, index=None)¶ Parameters: - seq (
sequence.Sequence
) – The sequence to add - start (int) – The index at which to insert; if None, seq is appended
- seq (
-
addSeqs
(sequences, start=None)¶ Add multiple sequences to the alignment
Parameters: - sequences (list of
sequence.Sequence
) – Sequences to add - start (int) – The index at which to insert; if None, seqs are appended
- sequences (list of
-
addSeqsByIndices
(seq_index_map)¶ Insert a sequences at the specified indices in the alignment. The sequences will be added from lowest to highest to allow for specification of indexes that may be out of range of the current alignment until lower-indexed sequences have been added. Note that indexes that remain out of range will result in their corresponding sequence simply being appended to the end of the alignment.
Parameters: seq_index_map – Map of insertion indices to sequences to be added.
-
removeSeq
(seq)¶ Remove a sequence from the alignment
Parameters: seq ( sequence.Sequence
) – The sequence to remove
-
removeSeqs
(seqs)¶ Remove multiple sequences from the alignment
-
clear
()¶ Clears the entire alignment of sequences
-
setReferenceSeq
(seq)¶ Set the specified sequence as the reference sequence.
Parameters: seq ( sequence
) – Sequence to set as reference sequence
-
getReferenceSeq
()¶ Returns the sequence that has been set as reference sequence or None if there is no reference sequence.
Returns: The reference sequence or None Return type: Sequence
or None
-
isReferenceSeq
(seq)¶ Return whether or not a sequence is the reference sequence.
Parameters: seq ( Sequence
) – Sequence to checkReturns: True if the sequence is the reference sequence, False otherwise. Return type: bool
-
getResidueIndices
(residues)¶ Returns the indices (in the alignment) of the specified residues
Parameters: residues (list[residue.AbstractSequenceElement]) – The list of residues and gaps to get indices for. Return type: A sorted list of (sequence index, residue index) tuples Returns: list[tuple(int, int)]
-
removeElements
(elements)¶ Removes the specified elements from the alignment.
Parameters: elements (iterable(residue.AbstractSequenceElement)) – An iterable of elements.
Raises: - AnchoredResidueError – if the elements cannot be removed
- StructuredResidueError – In the event that this method attempts to mutate structured residues
-
mutateResidues
(seq_i, start, end, elements)¶ Mutate a sequence.
Parameters: - seq_i (int) – Index of seq to mutate
- start (int) – Start index of seq region to mutate
- end (int) – End index of seq region to mutate
- elements (iterable(str) or iterable(ElementClass)) – Elements to mutate to
Raises: - AnchoredResidueError – if the mutation violates anchoring
- StructuredResidueError – In the event that this method attempts to mutate structured residues
-
replaceResiduesWithGaps
(residues)¶ Replaces the specified residues with gaps
Parameters: residues (list) – A list of residues to replace with gaps
-
addElements
(seq, res_i, elements)¶ Adds the specified elements (residues and/or gaps) to the alignment.
Parameters: - seq (sequence.Sequence) – A sequence in the alignment
- res_i (int) – Index to insert the elements
- elements (iterable(str or residue.AbstractSequenceElement)) – elements to insert
-
modifyingStructure
()¶
-
suspendAnchors
()¶ While inside this context, all anchors will be ignored. Upon exit, the anchors will be restored and an exception will be raised if any of the anchors are not aligned to the same reference residues they were aligned to at the start.
-
anchorResidues
(residues)¶ Anchor the specified residues. If passed reference residues, all residues aligned to the reference residues will be anchored.
Anchored residues are constrained to stay aligned to the reference residue with the same column index at the time of anchoring. If elements are removed from the alignment, gaps are added before anchors to maintain alignment. If any other modifications are made to the alignment that would break an anchor, an exception is raised. However, calling code can temporarily take responsibility for maintaining the anchors within the
suspendAnchors
context.Parameters: residues (list(residue.Residue)) – Residues to anchor.
-
getAnchoredResidues
()¶ Returns: A frozenset of residues that are currently anchored. :rtype : frozenset(residue.Residue)
-
getAnchoredResiduesWithRef
()¶ Returns: A frozenset of residues that are currently anchored with the corresponding reference sequence residues :rtype : frozenset(residue.Residue)
-
clearAnchors
()¶
-
removeAnchors
(residues)¶ Unanchor residues. If passed reference residues, all residues anchored to those reference residues will be unanchored.
Parameters: residues (iterable(residue.Residue)) – The residues to unanchor. Raises: ValueError – When a residue is passed in that isn’t currently anchored.
-
getSubalignment
(start, end)¶ Return another alignment containing the elements within the specified start and end indices
Parameters: - start (int) – The index at which the subalignment should start
- end (int) – The index at which the subalignment should end (exclusive)
Return type: BaseAligment
Returns: An alignment corresponding to the start and end point specified
-
getDiscontinuousSubalignment
(indices)¶ Given a list of indices, return a new alignment of sequences made up of the residues at those specified indices within this alignment.
Parameters: indices (list of (int, int)) – List of (seq index, residue index) tuples Returns: A new subalignment Return type: BaseAlignment
-
removeSubalignment
(start, end)¶ Remove a block of the subalignment from the start to end points.
Parameters: - start (int) – The start index of the columns to remove
- end (int) – The end index of the columns to remove (exclusive)
-
is_rectangular
¶
-
insertSubalignment
(aln, start)¶ Insert an alignment into the current alignment at the specified index
Parameters: - aln (
BaseAlignment
) – The alignment to insert - start (int) – The index at which to insert the alignment
Raises: ValueError – if either alignment is not rectangular
- aln (
-
replaceSubalignment
(aln, start, end)¶ Replace a subsection of the alignment indicated by start and end indices with the specified alignment
Parameters: - aln (
BaseAlignment
) – The alignment to insert - start (int) – The starting index of the subsection to replace.
- end (int) – The ending index of the subsection to replace.
Raises: ValueError – if either alignment is not rectangular
- aln (
-
getGaps
()¶ Returns a list of list of gaps.
Returns: list(list(residue.Gap)) Return type: list
-
getTerminalGaps
()¶ Returns the terminal gaps in all the sequences
Return type: list Returns: list(list(residue.Gap))
-
removeAllGaps
()¶ Removes all the gaps of the sequences in the alignment.
-
removeTerminalGaps
()¶ Removes the gaps from the ends of every sequence in the alignment
-
addGapsByIndices
(gap_indices)¶ Adds gaps to the alignment
Note: the length of the gap_indices list must match the number of sequences in the alignment.
Parameters: gap_indices (list[list[int]]) – A list of lists of gap indices, one for each sequence in the alignment. Note that these indices are based on residue/gap numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see
addGapsBeforeIndices
.Raises: - ValueError – if
gap_indices
is the wrong length - AnchoredResidueError – if any gap index is before an anchored col
- ValueError – if
-
addGapsBeforeIndices
(indices)¶ Add one gap to the alignment before each of the specified residue positions.
Note: the length of the gap_indices list must match the number of sequences in the alignment. Parameters: indices – A list of lists of indices to insert gaps before, one for each sequence in the alignment. Note that these indices are based on residue/gap numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices
.
-
padAlignment
()¶ Insert gaps into an alignment so that it forms a rectangular block
-
getGapOnlyColumns
()¶ Returns a list of lists of indices columns that contain only gaps
Return type: list Returns: List of list of indices
-
minimizeAlignment
()¶ Minimizes the alignment, i.e. removes all gaps from the gap-only columns.
-
getColumn
(index, omit_gaps=False)¶ Returns single alignment column at index position. Optionally, filters out gaps if omit_gaps is True.
Parameters: - index (int) – The index in the alignment
- omit_gaps (bool) – Whether to omit the gaps
Returns: Single alignment column at index position. Returns None to represent terminal gaps.
Return type: tuple(residue.Residue or residue.Gap or None)
-
columns
(omit_gaps=False)¶ A generator over all columns.
Parameters: omit_gaps (bool) – Whether to omit gaps
-
columnHasAllSameResidues
(index)¶ Return whether or not the column at a specified index has all the same residues (excluding gaps).
Note that if any unknown residues are present, the column will not be considered to be of all the same residue type.
Parameters: index (int) – Index to check for uniformity` Returns: True if the column is of uniform identity, False otherwise. Return type: bool
-
getResidueSimilarity
(res)¶ Return the similarity score of a residue to the current reference residue at the residues position in the alignment.
Parameters: res ( residue.Residue
) – Residue to get the similarity score forReturns: Similarity score for this residue Return type: float or None
-
elementsToContiguousColumns
(elements, invert=False)¶ Get elements marking contiguous columns containing any of the passed elements
Parameters: - elements (iterable(AbstractSequenceElement)) – Elements to convert to columns
- invert (bool) – Whether to invert logic (i.e. return columns not containing the passed elements)
Returns: [start, end] elements of contiguous columns. Will be from the ref sequence unless the ref sequence is shorter than
num_columns
Return type: iterable(tuple(AbstractSequenceElement, AbstractSequenceElement))
-
getIdentities
(omit_gaps=True)¶ Returns an alignment-length list of bools indicating which columns have identical residues
Parameters: omit_gaps (bool) – Whether gaps should be excluded from a column.
-
getSimilarityScore
(seq)¶ Returns a sequence length array of similarity scores against the reference sequence
Gaps in the sequences are coded as None values.
-
getEntropy
(frequencies)¶ Returns an alignment length array of residue entropy scores
-
getRedundantSequences
(value)¶ Returns the indices of sequences below a specified identity threshold value.
Returns: The indices of sequences in the alignment below specified identity threshold Return type: list of int
-
calculateMatrix
()¶ Calculates a substitution matrix based on the current alignment.
-
clearAllCaching
()¶
-
__class__
¶ alias of
sip.wrappertype
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.protein.alignment', '__doc__': '\n Abstract base class for classes which handle alignment of various sequences\n and corresponding annotations.\n\n This is a pure domain object intended to make it easy to work with aligned\n collections of sequences.\n\n Some methods are decorated with @msv_utils.const in order to make it easy to\n write a wrapper for this class that supports undo/redo operations.\n\n :cvar _ALN_ANNOTATION_CLASS: The class for alignment annotations. This\n value should be overriden in subclasses.\n :vartype _ALN_ANNOTATION_CLASS: type\n\n :cvar _SEQ_ANNOTATION_CLASS: The class for sequence annotations. This\n value should be overriden in subclasses.\n :vartype _SEQ_ANNOTATION_CLASS: type\n ', '_ALN_ANNOTATION_CLASS': None, '_SEQ_ANNOTATION_CLASS': None, '__init__': <function BaseAlignment.__init__>, '__len__': <function BaseAlignment.__len__>, '__iter__': <function BaseAlignment.__iter__>, '__contains__': <function BaseAlignment.__contains__>, '__getitem__': <function BaseAlignment.__getitem__>, '_getTextFormattedAlignment': <function BaseAlignment._getTextFormattedAlignment>, '_getAlignmentDescription': <function BaseAlignment._getAlignmentDescription>, '__str__': <function BaseAlignment.__str__>, '__repr__': <function BaseAlignment.__repr__>, '__deepcopy__': <function BaseAlignment.__deepcopy__>, '_copyAnchoringTo': <function BaseAlignment._copyAnchoringTo>, '_mapResidues': <function BaseAlignment._mapResidues>, 'global_annotations': <property object>, 'seq_annotations': <property object>, 'all_annotations': <property object>, 'getGlobalAnnotationData': <function BaseAlignment.getGlobalAnnotationData>, 'num_columns': <property object>, 'getWorkspaceCounts': <function BaseAlignment.getWorkspaceCounts>, '_sequenceVisibilityChanged': <function BaseAlignment._sequenceVisibilityChanged>, '_sequenceStructureChanged': <function BaseAlignment._sequenceStructureChanged>, 'index': <function BaseAlignment.index>, 'reorderSequences': <function BaseAlignment.reorderSequences>, 'sort': <function BaseAlignment.sort>, '_getSortIndices': <function BaseAlignment._getSortIndices>, '_recalculateNumColumns': <function BaseAlignment._recalculateNumColumns>, '_monitorSequence': <function BaseAlignment._monitorSequence>, '_stopMonitoringSequence': <function BaseAlignment._stopMonitoringSequence>, '_getSeqSignalsAndSlots': <function BaseAlignment._getSeqSignalsAndSlots>, '_sequenceLengthAboutToChange': <function BaseAlignment._sequenceLengthAboutToChange>, '_sequenceLengthChanged': <function BaseAlignment._sequenceLengthChanged>, '_checkAlignmentNumColumns': <function BaseAlignment._checkAlignmentNumColumns>, 'addSeq': <function BaseAlignment.addSeq>, 'addSeqs': <function BaseAlignment.addSeqs>, 'addSeqsByIndices': <function BaseAlignment.addSeqsByIndices>, 'removeSeq': <function BaseAlignment.removeSeq>, 'removeSeqs': <function BaseAlignment.removeSeqs>, '_assertCanRemoveRef': <function BaseAlignment._assertCanRemoveRef>, '_removeSeqByIndex': <function BaseAlignment._removeSeqByIndex>, '_resetCaches': <function BaseAlignment._resetCaches>, 'clear': <function BaseAlignment.clear>, '_seq_positions': <property object>, '_updateSequencePositionCache': <function BaseAlignment._updateSequencePositionCache>, '_getReferenceSeqReordering': <function BaseAlignment._getReferenceSeqReordering>, 'setReferenceSeq': <function BaseAlignment.setReferenceSeq>, '_assertCanSetReferenceSeq': <function BaseAlignment._assertCanSetReferenceSeq>, 'getReferenceSeq': <function BaseAlignment.getReferenceSeq>, 'isReferenceSeq': <function BaseAlignment.isReferenceSeq>, 'getResidueIndices': <function BaseAlignment.getResidueIndices>, '_assertCanRemove': <function BaseAlignment._assertCanRemove>, 'removeElements': <function BaseAlignment.removeElements>, '_getAnchorConservingGapIdxs': <function BaseAlignment._getAnchorConservingGapIdxs>, '_assertCanMutateResidues': <function BaseAlignment._assertCanMutateResidues>, 'mutateResidues': <function BaseAlignment.mutateResidues>, 'replaceResiduesWithGaps': <function BaseAlignment.replaceResiduesWithGaps>, 'addElements': <function BaseAlignment.addElements>, 'modifyingStructure': <function BaseAlignment.modifyingStructure>, 'suspendAnchors': <function BaseAlignment.suspendAnchors>, '_suspendAnchors': <function BaseAlignment._suspendAnchors>, '_unsuspendAnchors': <function BaseAlignment._unsuspendAnchors>, '_assertCanAnchor': <function BaseAlignment._assertCanAnchor>, 'anchorResidues': <function BaseAlignment.anchorResidues>, 'getAnchoredResidues': <function BaseAlignment.getAnchoredResidues>, 'getAnchoredResiduesWithRef': <function BaseAlignment.getAnchoredResiduesWithRef>, 'clearAnchors': <function BaseAlignment.clearAnchors>, '_clearAnchorsFromSeqs': <function BaseAlignment._clearAnchorsFromSeqs>, 'removeAnchors': <function BaseAlignment.removeAnchors>, '_assertCanInsert': <function BaseAlignment._assertCanInsert>, 'getSubalignment': <function BaseAlignment.getSubalignment>, 'getDiscontinuousSubalignment': <function BaseAlignment.getDiscontinuousSubalignment>, '_assertCanRemoveSubalignment': <function BaseAlignment._assertCanRemoveSubalignment>, 'removeSubalignment': <function BaseAlignment.removeSubalignment>, 'is_rectangular': <property object>, '_assertRectangular': <function BaseAlignment._assertRectangular>, 'insertSubalignment': <function BaseAlignment.insertSubalignment>, '_insertSubalignment': <function BaseAlignment._insertSubalignment>, 'replaceSubalignment': <function BaseAlignment.replaceSubalignment>, 'getGaps': <function BaseAlignment.getGaps>, 'getTerminalGaps': <function BaseAlignment.getTerminalGaps>, 'removeAllGaps': <function BaseAlignment.removeAllGaps>, 'removeTerminalGaps': <function BaseAlignment.removeTerminalGaps>, '_validateGapIndices': <function BaseAlignment._validateGapIndices>, 'addGapsByIndices': <function BaseAlignment.addGapsByIndices>, 'addGapsBeforeIndices': <function BaseAlignment.addGapsBeforeIndices>, 'padAlignment': <function BaseAlignment.padAlignment>, 'getGapOnlyColumns': <function BaseAlignment.getGapOnlyColumns>, 'minimizeAlignment': <function BaseAlignment.minimizeAlignment>, 'getColumn': <function BaseAlignment.getColumn>, 'columns': <function BaseAlignment.columns>, '_updateColumnSameResCache': <function BaseAlignment._updateColumnSameResCache>, '_updateResidueSimilarityCache': <function BaseAlignment._updateResidueSimilarityCache>, 'columnHasAllSameResidues': <function BaseAlignment.columnHasAllSameResidues>, 'getResidueSimilarity': <function BaseAlignment.getResidueSimilarity>, 'elementsToContiguousColumns': <function BaseAlignment.elementsToContiguousColumns>, 'getIdentities': <function BaseAlignment.getIdentities>, 'getSimilarityScore': <function BaseAlignment.getSimilarityScore>, 'getEntropy': <function BaseAlignment.getEntropy>, 'getRedundantSequences': <function BaseAlignment.getRedundantSequences>, 'calculateMatrix': <function BaseAlignment.calculateMatrix>, 'clearAllCaching': <function BaseAlignment.clearAllCaching>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattr__
(self, str) → object¶
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.protein.alignment'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
blockSignals
(self, bool) → bool¶
-
childEvent
(self, QChildEvent)¶
-
children
(self) → object¶
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → object¶
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
-
inherits
(self, str) → bool¶
-
installEventFilter
(self, QObject)¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
killTimer
(self, int)¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
parent
(self) → QObject¶
-
property
(self, 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, PYQT_SIGNAL) → int¶
-
removeEventFilter
(self, QObject)¶
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
setObjectName
(self, str)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
signalsBlocked
(self) → bool¶
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶
-
class
schrodinger.protein.alignment.
ProteinAlignment
(sequences=None)¶ Bases:
schrodinger.models.json.JsonableClassMixin
,schrodinger.protein.alignment._ProteinAlignment
-
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. :rtype : cls
-
setHydrophobicityWindowPadding
(window_padding)¶ Sets hydrophobicity window padding value for each sequence in the protein alignment.
Parameters: window_padding (int) – number of values to pad each average with
-
setIsoelectricPointWindowPadding
(window_padding)¶ Sets isoelectric point window padding value for each sequence in the protein alignment.
Parameters: window_padding (int) – number of values to pad each average with
-
addDisulfideBond
(res1, res2)¶ Add a disulfide bond if both residues’ sequences are in the alignment
Parameters: - res1 (residue.Residue) – A residue to link with a disulfide bond
- res2 (residue.Residue) – Another residue to link with a disulfide bond
Raises: ValueError – if either sequence is not in the alignment
-
removeDisulfideBond
(res1, res2)¶ Remove a disulfide bond if both residues’ sequences are in the alignment
Parameters: - res1 (residue.Residue) – A residue to link with a disulfide bond
- res2 (residue.Residue) – Another residue to link with a disulfide bond
Raises: ValueError – if either sequence is not in the alignment
-
static
fromClustalFile
(file_name)¶ Returns alignment read from file in Clustal .aln format preserving order of sequences.
Parameters: file_name (str) – Source file name. Raises: IOError – If output file cannot be read. Return type: ProteinAlignment
Returns: An alignment Note: The alignment can be empty if no sequence was present in the input file.
-
toClustalFile
(file_name, use_unique_names=True)¶ Writes aln to a Clustal alignment file.
Raises: IOError – If output file cannot be written.
Parameters: - file_name (str) – Destination file name.
- use_unique_names (bool) – If True, write unique name for each sequence.
-
classmethod
fromFastaFile
(file_name)¶ Returns alignment read from file in Clustal .aln format preserving order of sequences.
Raises: IOError – If the input file cannot be read. Parameters: file_name (str) – name of input FASTA file Returns: Read alignment. The alignment can be empty if no sequence was present in the input file. Return type: ProteinAlignment
-
classmethod
fromFastaString
(lines)¶ Read sequences from FASTA-formatted text, creates sequences and appends them to alignment. Splits sequence name from the FASTA header.
Parameters: lines (list of str) – list of strings representing FASTA file Returns: The alignment Return type: ProteinAlignment
-
classmethod
fromFastaStringList
(strings)¶ Return an alignment object created from an iterable of sequence strings
Parameters: strings (Iterable of strings) – Sequences as iterable of strings (1D codes) Returns: The alignment Return type: ProteinAlignment
-
toFastaString
(use_unique_names=True, maxl=50)¶ Convert ProteinAlignment object to list of sequence strings
Parameters: aln ( ProteinAlignment
) – Alignment data
-
toFastaStringList
()¶ Convert self to list of fasta sequence strings
Return type: list Returns: list of str
-
toFastaFile
(file_name, use_unique_names=True, maxl=50)¶ Write self to specified FASTA file
Raises: IOError – If output file cannot be written.
-
findPattern
(pattern)¶ Finds a specified PROSITE pattern in all sequences.
Parameters: pattern (str) – PROSITE pattern to search in sequences. See protein.sequence.find_generalized_pattern
for documentation.Returns: List of matching residues Return type: list of protein.residue.Residue
-
__class__
¶ alias of
sip.wrappertype
-
__contains__
(seq)¶ Returns whether the sequence is present in the alignment
-
__deepcopy__
(memo)¶ We should be able to copy an alignment, getting back an alignment with all the essential data in the original alignment and sharing no references with it
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.protein.alignment', 'toJsonImplementation': <function ProteinAlignment.toJsonImplementation>, 'fromJsonImplementation': <classmethod object>, 'setHydrophobicityWindowPadding': <function ProteinAlignment.setHydrophobicityWindowPadding>, 'setIsoelectricPointWindowPadding': <function ProteinAlignment.setIsoelectricPointWindowPadding>, 'addDisulfideBond': <function ProteinAlignment.addDisulfideBond>, 'removeDisulfideBond': <function ProteinAlignment.removeDisulfideBond>, 'fromClustalFile': <staticmethod object>, 'toClustalFile': <function ProteinAlignment.toClustalFile>, 'fromFastaFile': <classmethod object>, 'fromFastaString': <classmethod object>, 'fromFastaStringList': <classmethod object>, 'toFastaString': <function ProteinAlignment.toFastaString>, 'toFastaStringList': <function ProteinAlignment.toFastaStringList>, 'toFastaFile': <function ProteinAlignment.toFastaFile>, 'findPattern': <function ProteinAlignment.findPattern>, '__doc__': None, '_ProteinAlignment_jsonAdapters': []})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattr__
(self, str) → object¶
-
__getattribute__
¶ Return getattr(self, name).
-
__getitem__
(index)¶ Returns the sequence at the index in the alignment
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init__
(sequences=None)¶ Parameters: sequences (list) – An optional iterable of sequences
-
classmethod
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__iter__
()¶ Returns an iterable of the sequences held in the alignment
-
__le__
¶ Return self<=value.
-
__len__
()¶ Returns the number of sequences in the alignment
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.protein.alignment'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
()¶ Return type: str Returns: A str representation of the alignment
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
()¶ Returns a str representation of the alignment
This is fairly detailed since it is very useful for debugging
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
addElements
(seq, res_i, elements)¶ Adds the specified elements (residues and/or gaps) to the alignment.
Parameters: - seq (sequence.Sequence) – A sequence in the alignment
- res_i (int) – Index to insert the elements
- elements (iterable(str or residue.AbstractSequenceElement)) – elements to insert
-
addGapsBeforeIndices
(indices)¶ Add one gap to the alignment before each of the specified residue positions.
Note: the length of the gap_indices list must match the number of sequences in the alignment. Parameters: indices – A list of lists of indices to insert gaps before, one for each sequence in the alignment. Note that these indices are based on residue/gap numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices
.
-
addGapsByIndices
(gap_indices)¶ Adds gaps to the alignment
Note: the length of the gap_indices list must match the number of sequences in the alignment.
Parameters: gap_indices (list[list[int]]) – A list of lists of gap indices, one for each sequence in the alignment. Note that these indices are based on residue/gap numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see
addGapsBeforeIndices
.Raises: - ValueError – if
gap_indices
is the wrong length - AnchoredResidueError – if any gap index is before an anchored col
- ValueError – if
-
addSeq
(seq, index=None)¶ Parameters: - seq (
sequence.Sequence
) – The sequence to add - start (int) – The index at which to insert; if None, seq is appended
- seq (
-
addSeqs
(sequences, start=None)¶ Add multiple sequences to the alignment
Parameters: - sequences (list of
sequence.Sequence
) – Sequences to add - start (int) – The index at which to insert; if None, seqs are appended
- sequences (list of
-
addSeqsByIndices
(seq_index_map)¶ Insert a sequences at the specified indices in the alignment. The sequences will be added from lowest to highest to allow for specification of indexes that may be out of range of the current alignment until lower-indexed sequences have been added. Note that indexes that remain out of range will result in their corresponding sequence simply being appended to the end of the alignment.
Parameters: seq_index_map – Map of insertion indices to sequences to be added.
-
all_annotations
¶ Return a list of all annotations types in this alignment
-
anchorResidues
(residues)¶ Anchor the specified residues. If passed reference residues, all residues aligned to the reference residues will be anchored.
Anchored residues are constrained to stay aligned to the reference residue with the same column index at the time of anchoring. If elements are removed from the alignment, gaps are added before anchors to maintain alignment. If any other modifications are made to the alignment that would break an anchor, an exception is raised. However, calling code can temporarily take responsibility for maintaining the anchors within the
suspendAnchors
context.Parameters: residues (list(residue.Residue)) – Residues to anchor.
-
blockSignals
(self, bool) → bool¶
-
calculateMatrix
()¶ Calculates a substitution matrix based on the current alignment.
-
childEvent
(self, QChildEvent)¶
-
children
(self) → object¶
-
clear
()¶ Clears the entire alignment of sequences
-
clearAllCaching
()¶
-
clearAnchors
()¶
-
columnHasAllSameResidues
(index)¶ Return whether or not the column at a specified index has all the same residues (excluding gaps).
Note that if any unknown residues are present, the column will not be considered to be of all the same residue type.
Parameters: index (int) – Index to check for uniformity` Returns: True if the column is of uniform identity, False otherwise. Return type: bool
-
columns
(omit_gaps=False)¶ A generator over all columns.
Parameters: omit_gaps (bool) – Whether to omit gaps
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
disulfide_bonds
¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → object¶
-
elementsToContiguousColumns
(elements, invert=False)¶ Get elements marking contiguous columns containing any of the passed elements
Parameters: - elements (iterable(AbstractSequenceElement)) – Elements to convert to columns
- invert (bool) – Whether to invert logic (i.e. return columns not containing the passed elements)
Returns: [start, end] elements of contiguous columns. Will be from the ref sequence unless the ref sequence is shorter than
num_columns
Return type: iterable(tuple(AbstractSequenceElement, AbstractSequenceElement))
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, 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. :rtype : cls
-
getAnchoredResidues
()¶ Returns: A frozenset of residues that are currently anchored. :rtype : frozenset(residue.Residue)
-
getAnchoredResiduesWithRef
()¶ Returns: A frozenset of residues that are currently anchored with the corresponding reference sequence residues :rtype : frozenset(residue.Residue)
-
getColumn
(index, omit_gaps=False)¶ Returns single alignment column at index position. Optionally, filters out gaps if omit_gaps is True.
Parameters: - index (int) – The index in the alignment
- omit_gaps (bool) – Whether to omit the gaps
Returns: Single alignment column at index position. Returns None to represent terminal gaps.
Return type: tuple(residue.Residue or residue.Gap or None)
-
getDiscontinuousSubalignment
(indices)¶ Given a list of indices, return a new alignment of sequences made up of the residues at those specified indices within this alignment.
Parameters: indices (list of (int, int)) – List of (seq index, residue index) tuples Returns: A new subalignment Return type: BaseAlignment
-
getEntropy
(frequencies)¶ Returns an alignment length array of residue entropy scores
-
getGapOnlyColumns
()¶ Returns a list of lists of indices columns that contain only gaps
Return type: list Returns: List of list of indices
-
getGaps
()¶ Returns a list of list of gaps.
Returns: list(list(residue.Gap)) Return type: list
-
getGlobalAnnotationData
(index, annotation)¶ Returns column-level annotation data at an index in the alignment
Parameters: - index (int) – The index in the alignment
- annotation (
enum.Enum
) – An enum representing the requested annotation, if any
-
getIdentities
(omit_gaps=True)¶ Returns an alignment-length list of bools indicating which columns have identical residues
Parameters: omit_gaps (bool) – Whether gaps should be excluded from a column.
-
getRedundantSequences
(value)¶ Returns the indices of sequences below a specified identity threshold value.
Returns: The indices of sequences in the alignment below specified identity threshold Return type: list of int
-
getReferenceSeq
()¶ Returns the sequence that has been set as reference sequence or None if there is no reference sequence.
Returns: The reference sequence or None Return type: Sequence
or None
-
getResidueIndices
(residues)¶ Returns the indices (in the alignment) of the specified residues
Parameters: residues (list[residue.AbstractSequenceElement]) – The list of residues and gaps to get indices for. Return type: A sorted list of (sequence index, residue index) tuples Returns: list[tuple(int, int)]
-
getResidueSimilarity
(res)¶ Return the similarity score of a residue to the current reference residue at the residues position in the alignment.
Parameters: res ( residue.Residue
) – Residue to get the similarity score forReturns: Similarity score for this residue Return type: float or None
-
getSimilarityScore
(seq)¶ Returns a sequence length array of similarity scores against the reference sequence
Gaps in the sequences are coded as None values.
-
getSubalignment
(start, end)¶ Return another alignment containing the elements within the specified start and end indices
Parameters: - start (int) – The index at which the subalignment should start
- end (int) – The index at which the subalignment should end (exclusive)
Return type: BaseAligment
Returns: An alignment corresponding to the start and end point specified
-
getTerminalGaps
()¶ Returns the terminal gaps in all the sequences
Return type: list Returns: list(list(residue.Gap))
-
getWorkspaceCounts
()¶ Summarize the visibility status of the alignment’s sequences
Returns: Counts of each type of visibility Return type: collections.Counter
-
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.
-
global_annotations
¶ Returns the alignment-level annotations available for the alignment
-
index
(seq)¶ Returns the index of the specified sequence.
Parameters: seq ( sequence.Sequence
) – The requested sequenceReturn type: int Returns: The index of the requested sequence
-
inherits
(self, str) → bool¶
-
insertSubalignment
(aln, start)¶ Insert an alignment into the current alignment at the specified index
Parameters: - aln (
BaseAlignment
) – The alignment to insert - start (int) – The index at which to insert the alignment
Raises: ValueError – if either alignment is not rectangular
- aln (
-
installEventFilter
(self, QObject)¶
-
isReferenceSeq
(seq)¶ Return whether or not a sequence is the reference sequence.
Parameters: seq ( Sequence
) – Sequence to checkReturns: True if the sequence is the reference sequence, False otherwise. Return type: bool
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
is_rectangular
¶
-
killTimer
(self, int)¶
-
metaObject
(self) → QMetaObject¶
-
minimizeAlignment
()¶ Minimizes the alignment, i.e. removes all gaps from the gap-only columns.
-
modifyingStructure
()¶
-
moveToThread
(self, QThread)¶
-
mutateResidues
(seq_i, start, end, elements)¶ Mutate a sequence.
Parameters: - seq_i (int) – Index of seq to mutate
- start (int) – Start index of seq region to mutate
- end (int) – End index of seq region to mutate
- elements (iterable(str) or iterable(ElementClass)) – Elements to mutate to
Raises: - AnchoredResidueError – if the mutation violates anchoring
- StructuredResidueError – In the event that this method attempts to mutate structured residues
-
num_columns
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
padAlignment
()¶ Insert gaps into an alignment so that it forms a rectangular block
-
parent
(self) → QObject¶
-
property
(self, 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, PYQT_SIGNAL) → int¶
-
removeAllGaps
()¶ Removes all the gaps of the sequences in the alignment.
-
removeAnchors
(residues)¶ Unanchor residues. If passed reference residues, all residues anchored to those reference residues will be unanchored.
Parameters: residues (iterable(residue.Residue)) – The residues to unanchor. Raises: ValueError – When a residue is passed in that isn’t currently anchored.
-
removeElements
(elements)¶ Removes the specified elements from the alignment.
Parameters: elements (iterable(residue.AbstractSequenceElement)) – An iterable of elements.
Raises: - AnchoredResidueError – if the elements cannot be removed
- StructuredResidueError – In the event that this method attempts to mutate structured residues
-
removeEventFilter
(self, QObject)¶
-
removeSeq
(seq)¶ Remove a sequence from the alignment
Parameters: seq ( sequence.Sequence
) – The sequence to remove
-
removeSeqs
(seqs)¶ Remove multiple sequences from the alignment
-
removeSubalignment
(start, end)¶ Remove a block of the subalignment from the start to end points.
Parameters: - start (int) – The start index of the columns to remove
- end (int) – The end index of the columns to remove (exclusive)
-
removeTerminalGaps
()¶ Removes the gaps from the ends of every sequence in the alignment
-
reorderSequences
(seq_indices)¶ Reorder the sequences in the alignment using the specified list of indices.
In the undoable version of this class, the private function is needed to perform the operation in an undoable operation.
Parameters: seq_indices – A list with the new indices for sequences Type: list of int Raises: ValueError – In the event that the list of indices does not match the length of the alignment
-
replaceResiduesWithGaps
(residues)¶ Replaces the specified residues with gaps
Parameters: residues (list) – A list of residues to replace with gaps
-
replaceSubalignment
(aln, start, end)¶ Replace a subsection of the alignment indicated by start and end indices with the specified alignment
Parameters: - aln (
BaseAlignment
) – The alignment to insert - start (int) – The starting index of the subsection to replace.
- end (int) – The ending index of the subsection to replace.
Raises: ValueError – if either alignment is not rectangular
- aln (
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
seq_annotations
¶ Returns the sequence-level annotations available for sequences held in the alignment
-
setObjectName
(self, str)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
setReferenceSeq
(seq)¶ Set the specified sequence as the reference sequence.
Parameters: seq ( sequence
) – Sequence to set as reference sequence
-
signalsBlocked
(self) → bool¶
-
sort
(*, key, reverse=False)¶ Sort the alignment by the specified criteria.
NOTE: Query sequence is not included in the sort.
Parameters: - key (function) – A function that takes a sequence and returns a value to sort by for each sequence. (required keyword-only argument)
- reverse (bool) – Whether to sort in reverse (descending) order.
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
suspendAnchors
()¶ While inside this context, all anchors will be ignored. Upon exit, the anchors will be restored and an exception will be raised if any of the anchors are not aligned to the same reference residues they were aligned to at the start.
-
thread
(self) → QThread¶
-
timerEvent
(self, 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
(self, str, disambiguation: str = None, n: int = -1) → str¶
-
-
class
schrodinger.protein.alignment.
NucleicAcidAlignment
(sequences=None)¶ Bases:
schrodinger.protein.alignment.BaseAlignment
-
__class__
¶ alias of
sip.wrappertype
-
__contains__
(seq)¶ Returns whether the sequence is present in the alignment
-
__deepcopy__
(memo)¶ We should be able to copy an alignment, getting back an alignment with all the essential data in the original alignment and sharing no references with it
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.protein.alignment', '__doc__': None})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattr__
(self, str) → object¶
-
__getattribute__
¶ Return getattr(self, name).
-
__getitem__
(index)¶ Returns the sequence at the index in the alignment
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init__
(sequences=None)¶ Parameters: sequences (list) – An optional iterable of sequences
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__iter__
()¶ Returns an iterable of the sequences held in the alignment
-
__le__
¶ Return self<=value.
-
__len__
()¶ Returns the number of sequences in the alignment
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.protein.alignment'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
()¶ Return type: str Returns: A str representation of the alignment
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
()¶ Returns a str representation of the alignment
This is fairly detailed since it is very useful for debugging
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
addElements
(seq, res_i, elements)¶ Adds the specified elements (residues and/or gaps) to the alignment.
Parameters: - seq (sequence.Sequence) – A sequence in the alignment
- res_i (int) – Index to insert the elements
- elements (iterable(str or residue.AbstractSequenceElement)) – elements to insert
-
addGapsBeforeIndices
(indices)¶ Add one gap to the alignment before each of the specified residue positions.
Note: the length of the gap_indices list must match the number of sequences in the alignment. Parameters: indices – A list of lists of indices to insert gaps before, one for each sequence in the alignment. Note that these indices are based on residue/gap numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices
.
-
addGapsByIndices
(gap_indices)¶ Adds gaps to the alignment
Note: the length of the gap_indices list must match the number of sequences in the alignment.
Parameters: gap_indices (list[list[int]]) – A list of lists of gap indices, one for each sequence in the alignment. Note that these indices are based on residue/gap numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see
addGapsBeforeIndices
.Raises: - ValueError – if
gap_indices
is the wrong length - AnchoredResidueError – if any gap index is before an anchored col
- ValueError – if
-
addSeq
(seq, index=None)¶ Parameters: - seq (
sequence.Sequence
) – The sequence to add - start (int) – The index at which to insert; if None, seq is appended
- seq (
-
addSeqs
(sequences, start=None)¶ Add multiple sequences to the alignment
Parameters: - sequences (list of
sequence.Sequence
) – Sequences to add - start (int) – The index at which to insert; if None, seqs are appended
- sequences (list of
-
addSeqsByIndices
(seq_index_map)¶ Insert a sequences at the specified indices in the alignment. The sequences will be added from lowest to highest to allow for specification of indexes that may be out of range of the current alignment until lower-indexed sequences have been added. Note that indexes that remain out of range will result in their corresponding sequence simply being appended to the end of the alignment.
Parameters: seq_index_map – Map of insertion indices to sequences to be added.
-
all_annotations
¶ Return a list of all annotations types in this alignment
-
anchorResidues
(residues)¶ Anchor the specified residues. If passed reference residues, all residues aligned to the reference residues will be anchored.
Anchored residues are constrained to stay aligned to the reference residue with the same column index at the time of anchoring. If elements are removed from the alignment, gaps are added before anchors to maintain alignment. If any other modifications are made to the alignment that would break an anchor, an exception is raised. However, calling code can temporarily take responsibility for maintaining the anchors within the
suspendAnchors
context.Parameters: residues (list(residue.Residue)) – Residues to anchor.
-
blockSignals
(self, bool) → bool¶
-
calculateMatrix
()¶ Calculates a substitution matrix based on the current alignment.
-
childEvent
(self, QChildEvent)¶
-
children
(self) → object¶
-
clear
()¶ Clears the entire alignment of sequences
-
clearAllCaching
()¶
-
clearAnchors
()¶
-
columnHasAllSameResidues
(index)¶ Return whether or not the column at a specified index has all the same residues (excluding gaps).
Note that if any unknown residues are present, the column will not be considered to be of all the same residue type.
Parameters: index (int) – Index to check for uniformity` Returns: True if the column is of uniform identity, False otherwise. Return type: bool
-
columns
(omit_gaps=False)¶ A generator over all columns.
Parameters: omit_gaps (bool) – Whether to omit gaps
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → object¶
-
elementsToContiguousColumns
(elements, invert=False)¶ Get elements marking contiguous columns containing any of the passed elements
Parameters: - elements (iterable(AbstractSequenceElement)) – Elements to convert to columns
- invert (bool) – Whether to invert logic (i.e. return columns not containing the passed elements)
Returns: [start, end] elements of contiguous columns. Will be from the ref sequence unless the ref sequence is shorter than
num_columns
Return type: iterable(tuple(AbstractSequenceElement, AbstractSequenceElement))
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
-
getAnchoredResidues
()¶ Returns: A frozenset of residues that are currently anchored. :rtype : frozenset(residue.Residue)
-
getAnchoredResiduesWithRef
()¶ Returns: A frozenset of residues that are currently anchored with the corresponding reference sequence residues :rtype : frozenset(residue.Residue)
-
getColumn
(index, omit_gaps=False)¶ Returns single alignment column at index position. Optionally, filters out gaps if omit_gaps is True.
Parameters: - index (int) – The index in the alignment
- omit_gaps (bool) – Whether to omit the gaps
Returns: Single alignment column at index position. Returns None to represent terminal gaps.
Return type: tuple(residue.Residue or residue.Gap or None)
-
getDiscontinuousSubalignment
(indices)¶ Given a list of indices, return a new alignment of sequences made up of the residues at those specified indices within this alignment.
Parameters: indices (list of (int, int)) – List of (seq index, residue index) tuples Returns: A new subalignment Return type: BaseAlignment
-
getEntropy
(frequencies)¶ Returns an alignment length array of residue entropy scores
-
getGapOnlyColumns
()¶ Returns a list of lists of indices columns that contain only gaps
Return type: list Returns: List of list of indices
-
getGaps
()¶ Returns a list of list of gaps.
Returns: list(list(residue.Gap)) Return type: list
-
getGlobalAnnotationData
(index, annotation)¶ Returns column-level annotation data at an index in the alignment
Parameters: - index (int) – The index in the alignment
- annotation (
enum.Enum
) – An enum representing the requested annotation, if any
-
getIdentities
(omit_gaps=True)¶ Returns an alignment-length list of bools indicating which columns have identical residues
Parameters: omit_gaps (bool) – Whether gaps should be excluded from a column.
-
getRedundantSequences
(value)¶ Returns the indices of sequences below a specified identity threshold value.
Returns: The indices of sequences in the alignment below specified identity threshold Return type: list of int
-
getReferenceSeq
()¶ Returns the sequence that has been set as reference sequence or None if there is no reference sequence.
Returns: The reference sequence or None Return type: Sequence
or None
-
getResidueIndices
(residues)¶ Returns the indices (in the alignment) of the specified residues
Parameters: residues (list[residue.AbstractSequenceElement]) – The list of residues and gaps to get indices for. Return type: A sorted list of (sequence index, residue index) tuples Returns: list[tuple(int, int)]
-
getResidueSimilarity
(res)¶ Return the similarity score of a residue to the current reference residue at the residues position in the alignment.
Parameters: res ( residue.Residue
) – Residue to get the similarity score forReturns: Similarity score for this residue Return type: float or None
-
getSimilarityScore
(seq)¶ Returns a sequence length array of similarity scores against the reference sequence
Gaps in the sequences are coded as None values.
-
getSubalignment
(start, end)¶ Return another alignment containing the elements within the specified start and end indices
Parameters: - start (int) – The index at which the subalignment should start
- end (int) – The index at which the subalignment should end (exclusive)
Return type: BaseAligment
Returns: An alignment corresponding to the start and end point specified
-
getTerminalGaps
()¶ Returns the terminal gaps in all the sequences
Return type: list Returns: list(list(residue.Gap))
-
getWorkspaceCounts
()¶ Summarize the visibility status of the alignment’s sequences
Returns: Counts of each type of visibility Return type: collections.Counter
-
global_annotations
¶ Returns the alignment-level annotations available for the alignment
-
index
(seq)¶ Returns the index of the specified sequence.
Parameters: seq ( sequence.Sequence
) – The requested sequenceReturn type: int Returns: The index of the requested sequence
-
inherits
(self, str) → bool¶
-
insertSubalignment
(aln, start)¶ Insert an alignment into the current alignment at the specified index
Parameters: - aln (
BaseAlignment
) – The alignment to insert - start (int) – The index at which to insert the alignment
Raises: ValueError – if either alignment is not rectangular
- aln (
-
installEventFilter
(self, QObject)¶
-
isReferenceSeq
(seq)¶ Return whether or not a sequence is the reference sequence.
Parameters: seq ( Sequence
) – Sequence to checkReturns: True if the sequence is the reference sequence, False otherwise. Return type: bool
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
is_rectangular
¶
-
killTimer
(self, int)¶
-
metaObject
(self) → QMetaObject¶
-
minimizeAlignment
()¶ Minimizes the alignment, i.e. removes all gaps from the gap-only columns.
-
modifyingStructure
()¶
-
moveToThread
(self, QThread)¶
-
mutateResidues
(seq_i, start, end, elements)¶ Mutate a sequence.
Parameters: - seq_i (int) – Index of seq to mutate
- start (int) – Start index of seq region to mutate
- end (int) – End index of seq region to mutate
- elements (iterable(str) or iterable(ElementClass)) – Elements to mutate to
Raises: - AnchoredResidueError – if the mutation violates anchoring
- StructuredResidueError – In the event that this method attempts to mutate structured residues
-
num_columns
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
padAlignment
()¶ Insert gaps into an alignment so that it forms a rectangular block
-
parent
(self) → QObject¶
-
property
(self, 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, PYQT_SIGNAL) → int¶
-
removeAllGaps
()¶ Removes all the gaps of the sequences in the alignment.
-
removeAnchors
(residues)¶ Unanchor residues. If passed reference residues, all residues anchored to those reference residues will be unanchored.
Parameters: residues (iterable(residue.Residue)) – The residues to unanchor. Raises: ValueError – When a residue is passed in that isn’t currently anchored.
-
removeElements
(elements)¶ Removes the specified elements from the alignment.
Parameters: elements (iterable(residue.AbstractSequenceElement)) – An iterable of elements.
Raises: - AnchoredResidueError – if the elements cannot be removed
- StructuredResidueError – In the event that this method attempts to mutate structured residues
-
removeEventFilter
(self, QObject)¶
-
removeSeq
(seq)¶ Remove a sequence from the alignment
Parameters: seq ( sequence.Sequence
) – The sequence to remove
-
removeSeqs
(seqs)¶ Remove multiple sequences from the alignment
-
removeSubalignment
(start, end)¶ Remove a block of the subalignment from the start to end points.
Parameters: - start (int) – The start index of the columns to remove
- end (int) – The end index of the columns to remove (exclusive)
-
removeTerminalGaps
()¶ Removes the gaps from the ends of every sequence in the alignment
-
reorderSequences
(seq_indices)¶ Reorder the sequences in the alignment using the specified list of indices.
In the undoable version of this class, the private function is needed to perform the operation in an undoable operation.
Parameters: seq_indices – A list with the new indices for sequences Type: list of int Raises: ValueError – In the event that the list of indices does not match the length of the alignment
-
replaceResiduesWithGaps
(residues)¶ Replaces the specified residues with gaps
Parameters: residues (list) – A list of residues to replace with gaps
-
replaceSubalignment
(aln, start, end)¶ Replace a subsection of the alignment indicated by start and end indices with the specified alignment
Parameters: - aln (
BaseAlignment
) – The alignment to insert - start (int) – The starting index of the subsection to replace.
- end (int) – The ending index of the subsection to replace.
Raises: ValueError – if either alignment is not rectangular
- aln (
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
seq_annotations
¶ Returns the sequence-level annotations available for sequences held in the alignment
-
setObjectName
(self, str)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
setReferenceSeq
(seq)¶ Set the specified sequence as the reference sequence.
Parameters: seq ( sequence
) – Sequence to set as reference sequence
-
signalsBlocked
(self) → bool¶
-
sort
(*, key, reverse=False)¶ Sort the alignment by the specified criteria.
NOTE: Query sequence is not included in the sort.
Parameters: - key (function) – A function that takes a sequence and returns a value to sort by for each sequence. (required keyword-only argument)
- reverse (bool) – Whether to sort in reverse (descending) order.
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
suspendAnchors
()¶ While inside this context, all anchors will be ignored. Upon exit, the anchors will be restored and an exception will be raised if any of the anchors are not aligned to the same reference residues they were aligned to at the start.
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶
-
-
class
schrodinger.protein.alignment.
CombinedChainProteinAlignment
(sequences=None)¶ Bases:
schrodinger.protein.alignment._ProteinAlignment
An alignment containing combined-chain sequences (
sequence.CombinedChainProteinSequence
objects).-
addSeqs
(seqs, start=None)¶ Add multiple sequences to the alignment. Note that either single-chain sequences or combined-chain sequences may be added (but not both at the same time).
Parameters: - sequences (list[sequence.ProteinSequence] or list[sequence.CombinedChainProteinSequence]) – Sequences to add
- start (int) – The index at which to insert; if None, seqs are appended. Must be None if adding single-chain sequences.
-
__class__
¶ alias of
sip.wrappertype
-
__contains__
(seq)¶ Returns whether the sequence is present in the alignment
-
__deepcopy__
(memo)¶ We should be able to copy an alignment, getting back an alignment with all the essential data in the original alignment and sharing no references with it
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.protein.alignment', '__doc__': '\n An alignment containing combined-chain sequences\n (`sequence.CombinedChainProteinSequence` objects).\n ', '_mapResidues': <function CombinedChainProteinAlignment._mapResidues>, 'addSeqs': <function CombinedChainProteinAlignment.addSeqs>, '_isCombinedChainSeq': <function CombinedChainProteinAlignment._isCombinedChainSeq>, '_addSplitSeqs': <function CombinedChainProteinAlignment._addSplitSeqs>, '_addNewChainsToExistingSeqs': <function CombinedChainProteinAlignment._addNewChainsToExistingSeqs>, '_combineSequences': <function CombinedChainProteinAlignment._combineSequences>, 'removeSeqs': <function CombinedChainProteinAlignment.removeSeqs>, '_removeSplitSeqs': <function CombinedChainProteinAlignment._removeSplitSeqs>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattr__
(self, str) → object¶
-
__getattribute__
¶ Return getattr(self, name).
-
__getitem__
(index)¶ Returns the sequence at the index in the alignment
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init__
(sequences=None)¶ Parameters: sequences (list) – An optional iterable of sequences
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__iter__
()¶ Returns an iterable of the sequences held in the alignment
-
__le__
¶ Return self<=value.
-
__len__
()¶ Returns the number of sequences in the alignment
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.protein.alignment'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
()¶ Return type: str Returns: A str representation of the alignment
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
()¶ Returns a str representation of the alignment
This is fairly detailed since it is very useful for debugging
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
addElements
(seq, res_i, elements)¶ Adds the specified elements (residues and/or gaps) to the alignment.
Parameters: - seq (sequence.Sequence) – A sequence in the alignment
- res_i (int) – Index to insert the elements
- elements (iterable(str or residue.AbstractSequenceElement)) – elements to insert
-
addGapsBeforeIndices
(indices)¶ Add one gap to the alignment before each of the specified residue positions.
Note: the length of the gap_indices list must match the number of sequences in the alignment. Parameters: indices – A list of lists of indices to insert gaps before, one for each sequence in the alignment. Note that these indices are based on residue/gap numbering before the insertion. To insert gaps using indices based on numbering after the insertion, see addGapsByIndices
.
-
addGapsByIndices
(gap_indices)¶ Adds gaps to the alignment
Note: the length of the gap_indices list must match the number of sequences in the alignment.
Parameters: gap_indices (list[list[int]]) – A list of lists of gap indices, one for each sequence in the alignment. Note that these indices are based on residue/gap numbering after the insertion. To insert gaps using indices based on numbering before the insertion, see
addGapsBeforeIndices
.Raises: - ValueError – if
gap_indices
is the wrong length - AnchoredResidueError – if any gap index is before an anchored col
- ValueError – if
-
addSeq
(seq, index=None)¶ Parameters: - seq (
sequence.Sequence
) – The sequence to add - start (int) – The index at which to insert; if None, seq is appended
- seq (
-
addSeqsByIndices
(seq_index_map)¶ Insert a sequences at the specified indices in the alignment. The sequences will be added from lowest to highest to allow for specification of indexes that may be out of range of the current alignment until lower-indexed sequences have been added. Note that indexes that remain out of range will result in their corresponding sequence simply being appended to the end of the alignment.
Parameters: seq_index_map – Map of insertion indices to sequences to be added.
-
all_annotations
¶ Return a list of all annotations types in this alignment
-
anchorResidues
(residues)¶ Anchor the specified residues. If passed reference residues, all residues aligned to the reference residues will be anchored.
Anchored residues are constrained to stay aligned to the reference residue with the same column index at the time of anchoring. If elements are removed from the alignment, gaps are added before anchors to maintain alignment. If any other modifications are made to the alignment that would break an anchor, an exception is raised. However, calling code can temporarily take responsibility for maintaining the anchors within the
suspendAnchors
context.Parameters: residues (list(residue.Residue)) – Residues to anchor.
-
blockSignals
(self, bool) → bool¶
-
calculateMatrix
()¶ Calculates a substitution matrix based on the current alignment.
-
childEvent
(self, QChildEvent)¶
-
children
(self) → object¶
-
clear
()¶ Clears the entire alignment of sequences
-
clearAllCaching
()¶
-
clearAnchors
()¶
-
columnHasAllSameResidues
(index)¶ Return whether or not the column at a specified index has all the same residues (excluding gaps).
Note that if any unknown residues are present, the column will not be considered to be of all the same residue type.
Parameters: index (int) – Index to check for uniformity` Returns: True if the column is of uniform identity, False otherwise. Return type: bool
-
columns
(omit_gaps=False)¶ A generator over all columns.
Parameters: omit_gaps (bool) – Whether to omit gaps
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
disulfide_bonds
¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → object¶
-
elementsToContiguousColumns
(elements, invert=False)¶ Get elements marking contiguous columns containing any of the passed elements
Parameters: - elements (iterable(AbstractSequenceElement)) – Elements to convert to columns
- invert (bool) – Whether to invert logic (i.e. return columns not containing the passed elements)
Returns: [start, end] elements of contiguous columns. Will be from the ref sequence unless the ref sequence is shorter than
num_columns
Return type: iterable(tuple(AbstractSequenceElement, AbstractSequenceElement))
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
-
getAnchoredResidues
()¶ Returns: A frozenset of residues that are currently anchored. :rtype : frozenset(residue.Residue)
-
getAnchoredResiduesWithRef
()¶ Returns: A frozenset of residues that are currently anchored with the corresponding reference sequence residues :rtype : frozenset(residue.Residue)
-
getColumn
(index, omit_gaps=False)¶ Returns single alignment column at index position. Optionally, filters out gaps if omit_gaps is True.
Parameters: - index (int) – The index in the alignment
- omit_gaps (bool) – Whether to omit the gaps
Returns: Single alignment column at index position. Returns None to represent terminal gaps.
Return type: tuple(residue.Residue or residue.Gap or None)
-
getDiscontinuousSubalignment
(indices)¶ Given a list of indices, return a new alignment of sequences made up of the residues at those specified indices within this alignment.
Parameters: indices (list of (int, int)) – List of (seq index, residue index) tuples Returns: A new subalignment Return type: BaseAlignment
-
getEntropy
(frequencies)¶ Returns an alignment length array of residue entropy scores
-
getGapOnlyColumns
()¶ Returns a list of lists of indices columns that contain only gaps
Return type: list Returns: List of list of indices
-
getGaps
()¶ Returns a list of list of gaps.
Returns: list(list(residue.Gap)) Return type: list
-
getGlobalAnnotationData
(index, annotation)¶ Returns column-level annotation data at an index in the alignment
Parameters: - index (int) – The index in the alignment
- annotation (
enum.Enum
) – An enum representing the requested annotation, if any
-
getIdentities
(omit_gaps=True)¶ Returns an alignment-length list of bools indicating which columns have identical residues
Parameters: omit_gaps (bool) – Whether gaps should be excluded from a column.
-
getRedundantSequences
(value)¶ Returns the indices of sequences below a specified identity threshold value.
Returns: The indices of sequences in the alignment below specified identity threshold Return type: list of int
-
getReferenceSeq
()¶ Returns the sequence that has been set as reference sequence or None if there is no reference sequence.
Returns: The reference sequence or None Return type: Sequence
or None
-
getResidueIndices
(residues)¶ Returns the indices (in the alignment) of the specified residues
Parameters: residues (list[residue.AbstractSequenceElement]) – The list of residues and gaps to get indices for. Return type: A sorted list of (sequence index, residue index) tuples Returns: list[tuple(int, int)]
-
getResidueSimilarity
(res)¶ Return the similarity score of a residue to the current reference residue at the residues position in the alignment.
Parameters: res ( residue.Residue
) – Residue to get the similarity score forReturns: Similarity score for this residue Return type: float or None
-
getSimilarityScore
(seq)¶ Returns a sequence length array of similarity scores against the reference sequence
Gaps in the sequences are coded as None values.
-
getSubalignment
(start, end)¶ Return another alignment containing the elements within the specified start and end indices
Parameters: - start (int) – The index at which the subalignment should start
- end (int) – The index at which the subalignment should end (exclusive)
Return type: BaseAligment
Returns: An alignment corresponding to the start and end point specified
-
getTerminalGaps
()¶ Returns the terminal gaps in all the sequences
Return type: list Returns: list(list(residue.Gap))
-
getWorkspaceCounts
()¶ Summarize the visibility status of the alignment’s sequences
Returns: Counts of each type of visibility Return type: collections.Counter
-
global_annotations
¶ Returns the alignment-level annotations available for the alignment
-
index
(seq)¶ Returns the index of the specified sequence.
Parameters: seq ( sequence.Sequence
) – The requested sequenceReturn type: int Returns: The index of the requested sequence
-
inherits
(self, str) → bool¶
-
insertSubalignment
(aln, start)¶ Insert an alignment into the current alignment at the specified index
Parameters: - aln (
BaseAlignment
) – The alignment to insert - start (int) – The index at which to insert the alignment
Raises: ValueError – if either alignment is not rectangular
- aln (
-
installEventFilter
(self, QObject)¶
-
isReferenceSeq
(seq)¶ Return whether or not a sequence is the reference sequence.
Parameters: seq ( Sequence
) – Sequence to checkReturns: True if the sequence is the reference sequence, False otherwise. Return type: bool
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
is_rectangular
¶
-
killTimer
(self, int)¶
-
metaObject
(self) → QMetaObject¶
-
minimizeAlignment
()¶ Minimizes the alignment, i.e. removes all gaps from the gap-only columns.
-
modifyingStructure
()¶
-
moveToThread
(self, QThread)¶
-
mutateResidues
(seq_i, start, end, elements)¶ Mutate a sequence.
Parameters: - seq_i (int) – Index of seq to mutate
- start (int) – Start index of seq region to mutate
- end (int) – End index of seq region to mutate
- elements (iterable(str) or iterable(ElementClass)) – Elements to mutate to
Raises: - AnchoredResidueError – if the mutation violates anchoring
- StructuredResidueError – In the event that this method attempts to mutate structured residues
-
num_columns
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
padAlignment
()¶ Insert gaps into an alignment so that it forms a rectangular block
-
parent
(self) → QObject¶
-
property
(self, 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, PYQT_SIGNAL) → int¶
-
removeAllGaps
()¶ Removes all the gaps of the sequences in the alignment.
-
removeAnchors
(residues)¶ Unanchor residues. If passed reference residues, all residues anchored to those reference residues will be unanchored.
Parameters: residues (iterable(residue.Residue)) – The residues to unanchor. Raises: ValueError – When a residue is passed in that isn’t currently anchored.
-
removeElements
(elements)¶ Removes the specified elements from the alignment.
Parameters: elements (iterable(residue.AbstractSequenceElement)) – An iterable of elements.
Raises: - AnchoredResidueError – if the elements cannot be removed
- StructuredResidueError – In the event that this method attempts to mutate structured residues
-
removeEventFilter
(self, QObject)¶
-
removeSeq
(seq)¶ Remove a sequence from the alignment
Parameters: seq ( sequence.Sequence
) – The sequence to remove
-
removeSubalignment
(start, end)¶ Remove a block of the subalignment from the start to end points.
Parameters: - start (int) – The start index of the columns to remove
- end (int) – The end index of the columns to remove (exclusive)
-
removeTerminalGaps
()¶ Removes the gaps from the ends of every sequence in the alignment
-
reorderSequences
(seq_indices)¶ Reorder the sequences in the alignment using the specified list of indices.
In the undoable version of this class, the private function is needed to perform the operation in an undoable operation.
Parameters: seq_indices – A list with the new indices for sequences Type: list of int Raises: ValueError – In the event that the list of indices does not match the length of the alignment
-
replaceResiduesWithGaps
(residues)¶ Replaces the specified residues with gaps
Parameters: residues (list) – A list of residues to replace with gaps
-
replaceSubalignment
(aln, start, end)¶ Replace a subsection of the alignment indicated by start and end indices with the specified alignment
Parameters: - aln (
BaseAlignment
) – The alignment to insert - start (int) – The starting index of the subsection to replace.
- end (int) – The ending index of the subsection to replace.
Raises: ValueError – if either alignment is not rectangular
- aln (
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
seq_annotations
¶ Returns the sequence-level annotations available for sequences held in the alignment
-
setObjectName
(self, str)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
setReferenceSeq
(seq)¶ Set the specified sequence as the reference sequence.
Parameters: seq ( sequence
) – Sequence to set as reference sequence
-
signalsBlocked
(self) → bool¶
-
sort
(*, key, reverse=False)¶ Sort the alignment by the specified criteria.
NOTE: Query sequence is not included in the sort.
Parameters: - key (function) – A function that takes a sequence and returns a value to sort by for each sequence. (required keyword-only argument)
- reverse (bool) – Whether to sort in reverse (descending) order.
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
suspendAnchors
()¶ While inside this context, all anchors will be ignored. Upon exit, the anchors will be restored and an exception will be raised if any of the anchors are not aligned to the same reference residues they were aligned to at the start.
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶
-
removeSeqs
(seqs)¶ Remove multiple sequences from the alignment. Note that either single- chain sequences or combined-chain sequences may be added (but not both at the same time).
Parameters: sequences (list[sequence.Sequence] or list[sequence.CombinedChainProteinSequence]) – Sequences to remove
-