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

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
class schrodinger.protein.align.BasicAligner

Bases: schrodinger.protein.align.AbstractAligner

Aligns sequences by simply adding gaps to the ends of sequences to make them the same length

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
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
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
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.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.
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.BiopythonPairwiseAligner(*args, **kwargs)

Bases: schrodinger.protein.align.AbstractPairwiseAligner

Pairwise alignment using Biopython.

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

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

sequence

Alias for field number 0

structure

Alias for field number 1

run(aln)
Parameters:aln (alignment.Alignment) – Alignment to align
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