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.
|
__init__(self,
sequences=None)
x.__init__(...) initializes x; see help(type(x)) for signature |
|
|
|
__len__(self)
Returns the number of sequences in the alignment |
|
|
|
__iter__(self)
Returns an iterable of the sequences held in the alignment |
|
|
|
__contains__(self,
seq)
Returns whether the sequence is present in the alignment |
|
|
|
__getitem__(self,
index)
Returns the sequence at the index in the alignment |
|
|
|
|
|
|
|
__str__(self)
Returns a str representation of the alignment |
|
|
str
|
__repr__(self)
Returns:
A str representation of the alignment |
|
|
|
__add__(self,
other)
Adds another alignment to this one |
|
|
|
__deepcopy__(self,
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 |
|
|
|
getResidueData(self,
seqnum,
index,
annotation=None)
Returns residue-level data for the specified sequence at the
specified index in the alignment, or None if no data is available. |
|
|
|
iterResidues(self)
Yields a sequence of
schrodinger.application.msv.domain.residue.Residue objects in the
alignment, omitting gaps. |
|
|
|
|
|
notifyResidueSelection(self,
residues)
Notify any listeners of a residue selection by emitting a
ResidueSelection. |
|
|
list of int
|
|
list of int
|
getHiddenSeqIndices(self)
Return a list of the indices of all sequences in the alignment that
have an associated PT entry ID but are not currently visible in the
Workspace. |
|
|
|
notifyResDisplayChanged(self,
displayed,
undisplayed)
Notify any listeners of a residue display change by emitting a
signal. |
|
|
|
|
int
|
getSeqIndex(self,
seq)
Returns:
The index of the requested sequence |
|
|
|
reorderSequences(self,
seq_indices)
Reorder the sequences in the alignment using the specified list of
indices |
|
|
int or NoneType
|
_recalculateLength(self,
omit,
extra_length=None)
Determine what the length of the alignment would be if we removed one
sequence. |
|
|
|
_monitorSequence(self,
seq)
Monitor changes in the specified sequence, which has been stored at
the specified index in self._sequences . |
|
|
|
|
|
_sequenceLengthAboutToChange(self,
seq,
old_seq_length,
new_seq_length)
Respond to a sequence lengthAboutToChange signal by
emitting signals.alignmentLengthAboutToChange if
necessary. |
|
|
|
_sequenceLengthChanged(self,
seq,
old_seq_length,
new_seq_length)
Respond to a sequence lengthChanged signal by emitting
signals.alignmentLengthChanged and
signals.sequenceResiduesChanged as necessary. |
|
|
int or NoneType
|
_checkAlignmentLength(self,
seq,
old_seq_length,
new_seq_length)
Determine what the length of the alignment will be if we changed the
length of the specified sequence |
|
|
|
|
|
addSeqs(self,
sequences,
start=None)
Add multiple sequences to the alignment |
|
|
|
addSeqsByIndices(self,
seq_index_map)
Insert a sequences at the specified indices in the alignment. |
|
|
|
removeSeq(self,
seq)
Remove a sequence from the alignment |
|
|
|
removeSeqs(self,
seqs)
Remove multiple sequences from the alignment |
|
|
|
|
|
replaceSeq(self,
seq,
index)
Replace the sequence at the specified index with the elements in the
specified sequence |
|
|
tuple of dict and list
|
_getAddOrReplaceSeqs(self,
seqs,
identifier_func)
Inspect an iterable of seqs and use an identifier_func to return a
two member tuple consisting of (to_replace, to_add). |
|
|
|
addOrReplaceSeqs(self,
seqs,
identifier_func)
Given seqs and an identifier_func, replaces seqs in the alignment
matching the identifier_func and appends any additional seqs to the
alignment |
|
|
|
removeAllSeqs(self)
Clears the entire alignment of sequences |
|
|
|
setQuerySeq(self,
seq)
Set the specified sequence as the query sequence. |
|
|
Sequence or None
|
getQuerySeq(self)
Returns the sequence that has been set as query sequence or None if
there is no query sequence. |
|
|
bool
|
isQuerySeq(self,
seq)
Return whether or not a sequence is set as a query sequence. |
|
|
list of (sequence index, residue index) tuples
|
getResidueIndices(self,
residues)
Returns the indices (in the alignment) of the specified residues |
|
|
ResidueSelection
|
makeResidueSelection(self,
residues)
Returns a residue selection object matching the specified residues |
|
|
|
_removeResidues(self,
selection)
Given a selection, removes the residues in the alignment matching it |
|
|
|
removeResidues(self,
residues)
Removes the specified residues from the alignment and emits the
signals.residuesRemoved signal with the selection |
|
|
|
mutateResidues(self,
mutations)
Mutate the residues at the specified locations in the alignment |
|
|
|
|
|
addResidues(self,
selection)
Adds the specified residues to the alignment |
|
|
BaseAligment
|
getSubalignment(self,
start,
end)
Return another alignment containing the elements within the specified
start and end indices |
|
|
|
removeSubalignment(self,
start,
end)
Remove a block of the subalignment from the start to end points,
including column locks in that region |
|
|
|
insertSubalignment(self,
aln,
start)
Insert an alignment into the current alignment at the specified index |
|
|
|
|
|
replaceSubalignment(self,
aln,
start,
end)
Replace a subsection of the alignment indicated by start and end
indices with the specified alignment |
|
|
list
|
getGaps(self)
Returns a list of gap indices lists |
|
|
list
|
getGapsByKeyFunc(self,
key_func)
Given a key function to uniquely identify residues, build a list of
lists with gap information for each sequence in the alignment |
|
|
list of lists of int
|
getGapIndicesByKeyFunc(self,
gap_info,
key_func)
Converts a gap_info list and key func into a list of gap indices |
|
|
list
|
getTerminalGaps(self)
Returns the indices of terminal gaps in all the sequences |
|
|
|
|
|
removeAllGaps(self)
Removes all the gaps of the sequences in the alignment. |
|
|
|
removeTerminalGaps(self)
Removes the gaps from the ends of every sequence in the alignment |
|
|
|
|
|
_adjustGapsInSubalignments(self,
method_name,
gap_indices)
Utility method that iterates through alternating locked and unlocked
stretches of an alignment in reverse order and calling the specified
method on the sub regions, padding all but the last region. |
|
|
|
addGaps(self,
gap_indices)
Adds gaps to the alignment |
|
|
|
setGaps(self,
gap_indices)
Sets gaps on the alignment |
|
|
list
|
_getGapOnlyColumns(self)
Returns a list of lists of indices for unlocked columns that contain
only gaps |
|
|
|
|
list
|
getColumn(self,
index,
omit_gaps=False)
Returns single alignment column at index position. |
|
|
|
columns(self,
omit_gaps=False)
Returns a range of alignment columns or all columns if indices are
not specified. |
|
|
|
_updateColumnSameResCache(self)
Update the cache of whether each column has all the same residue or
not |
|
|
bool
|
columnHasAllSameResidues(self,
index)
Return whether or not the column at a specified index has all the
same residues (excluding gaps). |
|
|
|
|
bool
|
resMatchesQueryRes(self,
row_index,
col_index)
Return True if the residue of a sequence at a column in the alignment
matches the query residue. |
|
|
set
|
lockedColumns(self)
Returns a set with indices of locked columns. |
|
|
|
setLockedColumns(self,
columns,
lock=True,
reset=False)
Sets the columns to the specified lock state |
|
|
bool
|
|
|
setAllLocks(self,
lock=True)
Convenience method to set all the locks to the specified lock state
at once |
|
|
list
|
_getRegions(self)
Returns a list of _Region objects containing information of locked
and unlocked stretches of the alignment |
|
|
|
getIdentities(self,
omit_gaps=True)
Returns an alignment-length list of bools indicating which columns
have identical residues |
|
|
|
getSimilarityScore(self,
seq)
Returns a sequence length array of similarity scores against the
query sequence |
|
|
|
getAlignedBlocks(self)
Returns the indices of aligned blocks (regions without gaps). |
|
|
|
getFrequencies(self,
exclude=None,
consider_gaps=False)
Returns a dict mapping residues types to the frequency in the
alignment |
|
|
|
getEntropy(self,
frequencies)
Returns an alignment length array of residue entropy scores |
|
|
list
|
findPattern(self,
pattern)
Finds a specified PROSITE pattern in all sequences. |
|
|
list of int
|
getRedundantSequences(self,
value)
Returns the indices of sequences below a specified identity threshold
value. |
|
|
|
calculateMatrix(self)
Calculates a substitution matrix based on the current alignment. |
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__sizeof__ ,
__subclasshook__
|