schrodinger.protein.align module

exception schrodinger.protein.align.CantAlignException

Bases: Exception

Exception raised when an aligner cannot start e.g. due to not enough seqs

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': '\n Exception raised when an aligner cannot start e.g. due to not enough seqs\n ', '__weakref__': <attribute '__weakref__' of 'CantAlignException' objects>})
__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.align'
__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.align.AbstractAligner

Bases: object

Base class of objects that can perform an alignment

run(aln)

Aligns the sequences in an alignment using the parameters supplied on init

Subclasses need to override this default implementation.

Parameters:aln (schrodinger.protein.alignment.BaseAlignment) – The alignment to align
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__abstractmethods__ = frozenset({'run'})
__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': '\n Base class of objects that can perform an alignment\n ', '_extractGapLocations': <function AbstractAligner._extractGapLocations>, 'run': <function AbstractAligner.run>, '__call__': <function AbstractAligner.__call__>, '__dict__': <attribute '__dict__' of 'AbstractAligner' objects>, '__weakref__': <attribute '__weakref__' of 'AbstractAligner' objects>, '__abstractmethods__': frozenset({'run'}), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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.align'
__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)

class schrodinger.protein.align.RescodeAligner

Bases: schrodinger.protein.align.AbstractAligner

Aligns sequences by rescode

run(aln)

Aligns the sequences in an alignment using the parameters supplied on init

Subclasses need to override this default implementation.

Parameters:aln (schrodinger.protein.alignment.BaseAlignment) – The alignment to align
__abstractmethods__ = frozenset()
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': '\n Aligns sequences by rescode\n ', '_fitSequenceToAllRescodes': <function RescodeAligner._fitSequenceToAllRescodes>, 'run': <function RescodeAligner.run>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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.align'
__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)

class schrodinger.protein.align.AbstractPairwiseAligner(gap_open_penalty=1, gap_extend_penalty=0, sub_matrix=None, direct_scores=False, merge_all=False, ss_constraints=False)

Bases: schrodinger.protein.align.AbstractAligner

Variables:
  • CONSTRAINT_SCORE – Reward amount of keeping constrained residues aligned
  • RES_MATCH_BONUS – Reward amount for aligning matching residues. Used by default if a substitution matrix is not specified.
  • RES_MISMATCH_PENALTY – Penalty for aligning differing residues. Used by default if a subtitution matrix is not specified
Ctype CONSTRAINT_SCORE:
 

float

Ctype RES_MATCH_BONUS:
 

float

Ctype RES_MISMATCH_PENALTY:
 

float

CONSTRAINT_SCORE = 10000
RES_MATCH_BONUS = 1.0
RES_MISMATCH_PENALTY = 1.0
__init__(gap_open_penalty=1, gap_extend_penalty=0, sub_matrix=None, direct_scores=False, merge_all=False, ss_constraints=False)
Parameters:
  • gap_open_penalty (float) – Penalty for opening a gap. Should be >=0.
  • gap_extend_penalty (float) – Penalty for extending a gap. Should be >=0.
  • sub_matrix (2D float array or dict mapping (char, char) to float) – Scoring matrix to be used for the alignment. If no matrix is specified, this method uses residue identity measure.
  • direct_scores (bool) – Use scoring matrix directly as (NxM) where N, M are lengths of both sequences rather than default 20x20 substitution matrix.
  • merge_all (bool) – Whether to merge the sequence with the whole alignment or only up to itself.
  • ss_constraints (bool) – Whether to constrain the alignment so no gaps appear in middle of a secondary structure.
run(aln, seqs_to_align=None, constraints=None)
Parameters:
  • aln (alignment.Alignment) – The alignment containing sequences to align.
  • seqs_to_align (list(sequence.Sequence)) – The sequences in aln to align against the reference sequence of aln. If None, defaults to the first non-reference sequence in aln (ie aln[1])
  • constraints (list of (residue.Residue, residue.Residue)) – Optional list of (ref_res, res) pairwise residue constraints. Note that these constraints will be heavily favored but are not guaranteed. Some constraints are impossible to respect simulultaneously [eg residues at indexes (1,1) and (0,2)]. The first residue should belong to `aln`s reference sequence.
Raises:

CantAlignException – If seqs_to_align contains a sequence not found in aln.

__abstractmethods__ = frozenset()
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': '\n\n :cvar CONSTRAINT_SCORE: Reward amount of keeping constrained residues aligned\n :ctype CONSTRAINT_SCORE: float\n\n :cvar RES_MATCH_BONUS: Reward amount for aligning matching residues. Used\n by default if a substitution matrix is not specified.\n :ctype RES_MATCH_BONUS: float\n\n :cvar RES_MISMATCH_PENALTY: Penalty for aligning differing residues. Used by\n default if a subtitution matrix is not specified\n :ctype RES_MISMATCH_PENALTY: float\n\n ', 'CONSTRAINT_SCORE': 10000, 'RES_MATCH_BONUS': 1.0, 'RES_MISMATCH_PENALTY': 1.0, '__init__': <function AbstractPairwiseAligner.__init__>, 'run': <function AbstractPairwiseAligner.run>, '_initializeAnchorPairs': <function AbstractPairwiseAligner._initializeAnchorPairs>, '_setUpSequences': <function AbstractPairwiseAligner._setUpSequences>, '_getMatrixValue': <function AbstractPairwiseAligner._getMatrixValue>, '_getMappedGaps': <function AbstractPairwiseAligner._getMappedGaps>, '_mergeGaps': <function AbstractPairwiseAligner._mergeGaps>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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_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.align'
__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)

class schrodinger.protein.align.SchrodingerPairwiseAligner(**kwargs)

Bases: schrodinger.protein.align.AbstractPairwiseAligner

Implementation of the Needleman-Wunsch global alignment algorithm for pairwise sequence alignment with affine gap penalties.

  1. ability to merge new sequence with existing alignment,
  2. ability to penalize gaps in secondary structure elements,
  3. ability to use custom substitution matrix generated from a family of proteins or provided by the user.
NOTE::
Any residues with variant residue types will have their short codes uppercased. This means they will be treated identically to their standard variant. If a nonstandard residue type has a lowercase short code that doesn’t match its standard variant, or if we need special treatment for variant residues, _getMatrixValue will have to be changed.
__init__(**kwargs)
Parameters:
  • gap_open_penalty (float) – Penalty for opening a gap. Should be >=0.
  • gap_extend_penalty (float) – Penalty for extending a gap. Should be >=0.
  • sub_matrix (2D float array or dict mapping (char, char) to float) – Scoring matrix to be used for the alignment. If no matrix is specified, this method uses residue identity measure.
  • direct_scores (bool) – Use scoring matrix directly as (NxM) where N, M are lengths of both sequences rather than default 20x20 substitution matrix.
  • merge_all (bool) – Whether to merge the sequence with the whole alignment or only up to itself.
  • ss_constraints (bool) – Whether to constrain the alignment so no gaps appear in middle of a secondary structure.
getAlignmentScore()

Get the score of the alignment. Found by taking the highest value in the scoring matrix.

Returns:Score of the pairwise alignment.
Return type:float
CONSTRAINT_SCORE = 10000
RES_MATCH_BONUS = 1.0
RES_MISMATCH_PENALTY = 1.0
__abstractmethods__ = frozenset()
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': "\n Implementation of the Needleman-Wunsch global alignment algorithm for\n pairwise sequence alignment with affine gap penalties.\n\n 1) ability to merge new sequence with existing alignment,\n 2) ability to penalize gaps in secondary structure elements,\n 3) ability to use custom substitution matrix generated from a family of\n proteins or provided by the user.\n\n NOTE::\n Any residues with variant residue types will have their short codes\n uppercased. This means they will be treated identically to their\n standard variant. If a nonstandard residue type has a lowercase short\n code that doesn't match its standard variant, or if we need special\n treatment for variant residues, _getMatrixValue will have to be\n changed.\n ", '__init__': <function SchrodingerPairwiseAligner.__init__>, '_setUpSequences': <function SchrodingerPairwiseAligner._setUpSequences>, 'getAlignmentScore': <function SchrodingerPairwiseAligner.getAlignmentScore>, '_align': <function SchrodingerPairwiseAligner._align>, '_buildSimilarityMatrix': <function SchrodingerPairwiseAligner._buildSimilarityMatrix>, '_buildScoringMatrix': <function SchrodingerPairwiseAligner._buildScoringMatrix>, '_ssConstraintBonus': <function SchrodingerPairwiseAligner._ssConstraintBonus>, '_traceBack': <function SchrodingerPairwiseAligner._traceBack>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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_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.align'
__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)

run(aln, seqs_to_align=None, constraints=None)
Parameters:
  • aln (alignment.Alignment) – The alignment containing sequences to align.
  • seqs_to_align (list(sequence.Sequence)) – The sequences in aln to align against the reference sequence of aln. If None, defaults to the first non-reference sequence in aln (ie aln[1])
  • constraints (list of (residue.Residue, residue.Residue)) – Optional list of (ref_res, res) pairwise residue constraints. Note that these constraints will be heavily favored but are not guaranteed. Some constraints are impossible to respect simulultaneously [eg residues at indexes (1,1) and (0,2)]. The first residue should belong to `aln`s reference sequence.
Raises:

CantAlignException – If seqs_to_align contains a sequence not found in aln.

class schrodinger.protein.align.BiopythonPairwiseAligner(*args, **kwargs)

Bases: schrodinger.protein.align.AbstractPairwiseAligner

Pairwise alignment using Biopython.

NOTE::
Any residues with variant residue types will have their short codes uppercased. This means they will be treated identically to their standard variant. If a nonstandard residue type has a lowercase short code that doesn’t match its standard variant, or if we need special treatment for variant residues, _getMatrixValue will have to be changed.
__init__(*args, **kwargs)
Parameters:
  • gap_open_penalty (float) – Penalty for opening a gap. Should be >=0.
  • gap_extend_penalty (float) – Penalty for extending a gap. Should be >=0.
  • sub_matrix (2D float array or dict mapping (char, char) to float) – Scoring matrix to be used for the alignment. If no matrix is specified, this method uses residue identity measure.
  • direct_scores (bool) – Use scoring matrix directly as (NxM) where N, M are lengths of both sequences rather than default 20x20 substitution matrix.
  • merge_all (bool) – Whether to merge the sequence with the whole alignment or only up to itself.
  • ss_constraints (bool) – Whether to constrain the alignment so no gaps appear in middle of a secondary structure.
getAlignmentScore()

Get the score of the alignment. Found by taking the highest value in the scoring matrix.

Returns:Score of the pairwise alignment.
Return type:float
CONSTRAINT_SCORE = 10000
RES_MATCH_BONUS = 1.0
RES_MISMATCH_PENALTY = 1.0
__abstractmethods__ = frozenset()
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': "\n Pairwise alignment using Biopython.\n\n NOTE::\n Any residues with variant residue types will have their short codes\n uppercased. This means they will be treated identically to their\n standard variant. If a nonstandard residue type has a lowercase short\n code that doesn't match its standard variant, or if we need special\n treatment for variant residues, _getMatrixValue will have to be\n changed.\n ", '__init__': <function BiopythonPairwiseAligner.__init__>, 'getAlignmentScore': <function BiopythonPairwiseAligner.getAlignmentScore>, '_getMatrixValue': <function BiopythonPairwiseAligner._getMatrixValue>, '_transformSequenceForBiopython': <function BiopythonPairwiseAligner._transformSequenceForBiopython>, '_align': <function BiopythonPairwiseAligner._align>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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_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.align'
__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)

run(aln, seqs_to_align=None, constraints=None)
Parameters:
  • aln (alignment.Alignment) – The alignment containing sequences to align.
  • seqs_to_align (list(sequence.Sequence)) – The sequences in aln to align against the reference sequence of aln. If None, defaults to the first non-reference sequence in aln (ie aln[1])
  • constraints (list of (residue.Residue, residue.Residue)) – Optional list of (ref_res, res) pairwise residue constraints. Note that these constraints will be heavily favored but are not guaranteed. Some constraints are impossible to respect simulultaneously [eg residues at indexes (1,1) and (0,2)]. The first residue should belong to `aln`s reference sequence.
Raises:

CantAlignException – If seqs_to_align contains a sequence not found in aln.

class schrodinger.protein.align.ClustalAligner

Bases: schrodinger.protein.align.AbstractAligner

Aligns sequences using the Clustal alignment algorithm.

run(aln)

Aligns the sequences in an alignment

Parameters:aln (schrodinger.protein.alignment.BaseAlignment) – The alignment to align
__abstractmethods__ = frozenset()
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': '\n Aligns sequences using the Clustal alignment algorithm.\n ', 'run': <function ClustalAligner.run>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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.align'
__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)

class schrodinger.protein.align.SuperpositionAligner(gap_open_penalty=None, gap_extend_penalty=None)

Bases: schrodinger.protein.align.BiopythonPairwiseAligner

Align structured sequences based on their superposition.

__init__(gap_open_penalty=None, gap_extend_penalty=None)
Parameters:
  • gap_open_penalty (float) – Penalty for opening a gap. Should be >=0.
  • gap_extend_penalty (float) – Penalty for extending a gap. Should be >=0.
  • sub_matrix (2D float array or dict mapping (char, char) to float) – Scoring matrix to be used for the alignment. If no matrix is specified, this method uses residue identity measure.
  • direct_scores (bool) – Use scoring matrix directly as (NxM) where N, M are lengths of both sequences rather than default 20x20 substitution matrix.
  • merge_all (bool) – Whether to merge the sequence with the whole alignment or only up to itself.
  • ss_constraints (bool) – Whether to constrain the alignment so no gaps appear in middle of a secondary structure.
run(aln, seqs_to_align=None)

Align sequences based on structure superposition to the reference.

Parameters:
  • aln (alignment.Alignment) – The alignment containing sequences to align.
  • seqs_to_align (list of sequence.Sequence or NoneType) – The sequences in aln to align against the reference sequence of aln. If None, defaults to the first non-reference sequence in aln (ie aln[1])
Raises:
  • CantAlignException – If seqs_to_align contains a sequence not found in aln.
  • CantAlignException – If the reference sequence or any of seqs_to_align don’t have an associated structure.
CONSTRAINT_SCORE = 10000
RES_MATCH_BONUS = 1.0
RES_MISMATCH_PENALTY = 1.0
__abstractmethods__ = frozenset()
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': '\n Align structured sequences based on their superposition.\n ', '__init__': <function SuperpositionAligner.__init__>, '_getMatrixValue': <function SuperpositionAligner._getMatrixValue>, '_transformSequenceForBiopython': <function SuperpositionAligner._transformSequenceForBiopython>, 'run': <function SuperpositionAligner.run>, '_getMatrixFromSuperposition': <function SuperpositionAligner._getMatrixFromSuperposition>, '_getCAPositions': <staticmethod object>, '_insertStructurelessResidueGaps': <staticmethod object>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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_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.align'
__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)

getAlignmentScore()

Get the score of the alignment. Found by taking the highest value in the scoring matrix.

Returns:Score of the pairwise alignment.
Return type:float
class schrodinger.protein.align.StructureAligner

Bases: schrodinger.protein.align.AbstractAligner

Run structure alignment and align sequences based on structural alignment

class entry(sequence, structure)

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.align'
__mul__

Return self*value.n

__ne__

Return self!=value.

static __new__(_cls, sequence, structure)

Create new instance of entry(sequence, structure)

__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.

sequence

Alias for field number 0

structure

Alias for field number 1

run(aln)
Parameters:aln (alignment.Alignment) – Alignment to align
__abstractmethods__ = frozenset()
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': '\n Run structure alignment and align sequences based on structural alignment\n ', 'entry': <class 'schrodinger.protein.align.entry'>, 'run': <function StructureAligner.run>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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.align'
__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)

class schrodinger.protein.align.MaxIdentityAligner

Bases: schrodinger.protein.align.BiopythonPairwiseAligner

Pairwise aligner that maximizes the number of matching residues between two sequences. There are no penalties for mismatches or gaps.

__init__()
Parameters:
  • gap_open_penalty (float) – Penalty for opening a gap. Should be >=0.
  • gap_extend_penalty (float) – Penalty for extending a gap. Should be >=0.
  • sub_matrix (2D float array or dict mapping (char, char) to float) – Scoring matrix to be used for the alignment. If no matrix is specified, this method uses residue identity measure.
  • direct_scores (bool) – Use scoring matrix directly as (NxM) where N, M are lengths of both sequences rather than default 20x20 substitution matrix.
  • merge_all (bool) – Whether to merge the sequence with the whole alignment or only up to itself.
  • ss_constraints (bool) – Whether to constrain the alignment so no gaps appear in middle of a secondary structure.
run(aln)
Parameters:
  • aln (alignment.Alignment) – The alignment containing sequences to align.
  • seqs_to_align (list(sequence.Sequence)) – The sequences in aln to align against the reference sequence of aln. If None, defaults to the first non-reference sequence in aln (ie aln[1])
  • constraints (list of (residue.Residue, residue.Residue)) – Optional list of (ref_res, res) pairwise residue constraints. Note that these constraints will be heavily favored but are not guaranteed. Some constraints are impossible to respect simulultaneously [eg residues at indexes (1,1) and (0,2)]. The first residue should belong to `aln`s reference sequence.
Raises:

CantAlignException – If seqs_to_align contains a sequence not found in aln.

CONSTRAINT_SCORE = 10000
RES_MATCH_BONUS = 1.0
RES_MISMATCH_PENALTY = 1.0
__abstractmethods__ = frozenset()
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': '\n Pairwise aligner that maximizes the number of matching residues between\n two sequences. There are no penalties for mismatches or gaps.\n ', '_IdentityDict': <class 'schrodinger.protein.align.MaxIdentityAligner._IdentityDict'>, '__init__': <function MaxIdentityAligner.__init__>, 'run': <function MaxIdentityAligner.run>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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_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.align'
__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)

getAlignmentScore()

Get the score of the alignment. Found by taking the highest value in the scoring matrix.

Returns:Score of the pairwise alignment.
Return type:float
class schrodinger.protein.align.StructurelessGapAligner

Bases: schrodinger.protein.align.AbstractAligner

Align all structureless residues with gaps

For example, given the following alignment (where circled letters are structureless residues):

Resnum: 0 1 2 3 4 5 Seq1: Ⓐ Ⓡ Ⓒ A D E Seq2: Ⓒ Ⓐ Ⓝ A D A

The result will be:

Resnum: 0 1 2 3 4 5 6 7 8 Seq1: ~ ~ ~ Ⓐ Ⓡ Ⓒ A D E Seq2: Ⓒ Ⓐ Ⓝ ~ ~ ~ A D A

run(aln)

Aligns the sequences in an alignment using the parameters supplied on init

Subclasses need to override this default implementation.

Parameters:aln (schrodinger.protein.alignment.BaseAlignment) – The alignment to align
__abstractmethods__ = frozenset()
__call__(aln, *args, **kwargs)

Convenience method to make the class instance itself a callable

__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.align', '__doc__': '\n Align all structureless residues with gaps\n\n For example, given the following alignment (where circled letters are\n structureless residues):\n\n Resnum: 0 1 2 3 4 5\n Seq1: Ⓐ Ⓡ Ⓒ A D E\n Seq2: Ⓒ Ⓐ Ⓝ A D A\n\n\n The result will be:\n\n Resnum: 0 1 2 3 4 5 6 7 8\n Seq1: ~ ~ ~ Ⓐ Ⓡ Ⓒ A D E\n Seq2: Ⓒ Ⓐ Ⓝ ~ ~ ~ A D A\n ', 'run': <function StructurelessGapAligner.run>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__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.align'
__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)