Package schrodinger :: Package application :: Package msv :: Package domain :: Module sequence :: Class Sequence
[hide private]
[frames] | no frames]

Class Sequence

       object --+                
                |                
sip.simplewrapper --+            
                    |            
          sip.wrapper --+        
                        |        
     PyQt4.QtCore.QObject --+    
                            |    
            Qt.QtCore.QObject --+
                                |
                               Sequence
Known Subclasses:

Nested Classes [hide private]
  ORIGIN
  SSA_POS_TYPE
Instance Methods [hide private]
 
residuesDeleted(...)
 
residuesChanged(...)
 
lengthAboutToChange(...)
 
lengthChanged(...)
 
nameChanged(...)
 
__init__(self, elements, name='', alphabet=None, origin=None, entry_id='', chain='', unknown_res_type='X', gap_chars=('~'))
Make a sequence object from a list of strings, using a mapping of strings to element types.
 
__str__(self)
str(x)
 
__len__(self)
 
__iter__(self)
 
__repr__(self)
repr(x)
 
__contains__(self, item)
 
__getitem__(self, index)
 
__copy__(self)
 
__deepcopy__(self, memo)
 
__add__(self, other)
TODO: Do this properly
 
_makeSeqElements(self, elements)
Return a list of elements converted to proper sequence items
Sequence
getSubsequence(self, start, end)
Return a sequence containing a subset of the elements in this one
 
setName(self, name)
Set the name on the instance and emit a notification
bool
hasVisibleResidues(self)
Returns True if any residues in the sequence are set to be visible, False otherwise.
 
get(self, index, annotation=None)
Returns the item at the specified index.
 
index(self, res)
Returns the index of the specified residue; raises ValueError if not present
list
getGaps(self)
Returns: The indices of gaps in the sequence, if any
list of (object, int)
getGapsByKeyFunc(self, key_func)
Given a key function to reidentify residues, build a list of tuples with gap information.
list of int
getGapIndicesByKeyFunc(self, gap_info, key_func)
Converts a gap_info list and key func into a list of gap indices
 
_addGaps(self, gaps)
Add gaps to the sequence from a list of gap indices
int
getNumResidues(self)
Return the number of residues in the sequence, that is, the length of the sequence without gaps
 
addGaps(self, gaps)
Add gaps to the sequence at the specified indices
 
setGaps(self, gaps)
Sets gaps on the sequence from a list of gap indices, relative to the ungapped sequence
 
_validateGapRemoval(self, gaps)
 
removeGaps(self, gaps)
Removes the specified gaps from the sequence
 
_removeAllGaps(self)
Remove gaps from the sequence
 
removeAllGaps(self)
Remove gaps from the sequence
 
insert(self, index, elements)
Insert a list of elements or sequence element into this sequence
 
mutate(self, start, end, elements)
Mutate sequence elements starting at the given index to the provided elements
 
remove(self, start, end=None)
Removes elements from the sequence from the index start and returns the removed elements as a new sequence
 
append(self, element)
Appends an element to the sequence
 
extend(self, elements)
Extends the sequence with elements from a list
 
replaceAllElements(self, elements)
Replace _sequence entirely with the supplied elements
 
removeFromSequence(self, filter_func, start=0, end=None)
Remove any residues matching the specified filter_func from the sequence
 
sanitize(self, start=0, end=None)
Remove gaps and unknown sequence elements from sequence
float
_getScore(self, scoring_function, reference, consider_gaps=True)
Return a float scoring between the sequence and a reference sequence, assuming that they're already aligned, calculated using provided scoring_function method of Residue class.
float
getIdentity(self, reference, consider_gaps=True)
Return a float scoring the identity between the sequence and a reference sequence, assuming that they're already aligned
float
getSimilarity(self, reference, consider_gaps=True)
Return a float score of the similarity count between the sequence and a reference sequence, assuming that they're already aligned
float
getHomology(self, reference, consider_gaps=True)
Return a float scoring the homology between the sequence and a reference sequence, assuming that they're already aligned
float
getSimilarityScore(self, reference)
Return the total score of similarity between the sequence and a reference sequence, assuming that they're already aligned.
int or None
getNextResidueIndex(self, index)
Return the index of the next residue in the sequence (ignoring gaps) or None if there is none
schrodinginer.application.msv.domain.residue.Residue
getNextResidue(self, index)
Return the next residue in the sequence (ignoring gaps) or None if there is none
int or None
getPreviousResidueIndex(self, index)
Return the index of the previous residue in the sequence (ignoring gaps) or None if there is none
schrodinginer.application.msv.domain.residue.Residue
getPreviousResidue(self, index)
Return the next residue in the sequence (ignoring gaps) or None if there is none
iter
iterNeighbors(self)
Return an iterable of three element tuples consisting of (prev_res, curr_res, next_res), ignoring gaps.
 
_updateSSAPositions(self, _1, _2)
Updates the stored indices of start and end positions of secondary structure assignment blocks in the sequence.
int or None
getSSAPosType(self, index)
Return whether the residue at the specified index is at the start, middle or end of a secondary structure block.
bool
hasEntryID(self)
Return whether or not this sequence has an associated Entry ID in the Project Table.

Inherited from Qt.QtCore.QObject: connect, emit

Inherited from PyQt4.QtCore.QObject: __getattr__, blockSignals, childEvent, children, connectNotify, customEvent, deleteLater, destroyed, disconnect, disconnectNotify, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChildren, inherits, installEventFilter, isWidgetType, killTimer, metaObject, moveToThread, objectName, parent, property, pyqtConfigure, receivers, removeEventFilter, sender, senderSignalIndex, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent, tr, trUtf8

Inherited from sip.simplewrapper: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]
Tuple of (bool, set)
isValid(cls, elements, alphabet, gap_chars)
Returns: Tuple indicating whether valid and a set of invalid characters, if any
Class Variables [hide private]
  AnnotationClass = None
hash(x)

Inherited from PyQt4.QtCore.QObject: staticMetaObject

Properties [hide private]
  origin
  _origin_setter
  name
str fullname
Enum annotation_types

Inherited from object: __class__

Method Details [hide private]

__init__(self, elements, name='', alphabet=None, origin=None, entry_id='', chain='', unknown_res_type='X', gap_chars=('~'))
(Constructor)

 

Make a sequence object from a list of strings, using a mapping of strings to element types.

If alphabet is None, the strings themselves will be elements in the sequence

Parameters:
  • elements (list) - An iterable of string representations of elements making up the sequence
  • name (basestring) - The name of the sequence
  • alphabet (dict) - A mapping of string representations of elements to element types
Overrides: object.__init__

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)

getSubsequence(self, start, end)

 

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

Parameters:
  • start (int) - The index at which the subsequence should start
  • end (int) - The index at which the subsequence should end
Returns: Sequence
A sequence

setName(self, name)

 

Set the name on the instance and emit a notification

Parameters:
  • name (str) - The new name for the sequence

hasVisibleResidues(self)

 

Returns True if any residues in the sequence are set to be visible, False otherwise.

Returns: bool
True if any residues are visible, False otherwise.

get(self, index, annotation=None)

 

Returns the item at the specified index. This is a residue or an annotation, if an annotation name has been supplied. A None value will be returned in the case of a gap.

getGaps(self)

 
Returns: list
The indices of gaps in the sequence, if any

getGapsByKeyFunc(self, key_func)

 

Given a key function to reidentify residues, build a list of tuples with gap information.

Parameters:
  • key_func (function) - callable that takes a residue and returns a key
Returns: list of (object, int)
A list of tuples with (key, number of gaps preceding it)

getGapIndicesByKeyFunc(self, gap_info, key_func)

 

Converts a gap_info list and key func into a list of gap indices

Parameters:
  • gap_info (list) - list of tuples
  • key_func (function) - callable that takes a residue and returns a key
Returns: list of int
A list of gaps

_addGaps(self, gaps)

 

Add gaps to the sequence from a list of gap indices

Parameters:
  • gaps (list of int) - A list of gap indices

getNumResidues(self)

 

Return the number of residues in the sequence, that is, the length of the sequence without gaps

Returns: int
The number of residues in the sequence

addGaps(self, gaps)

 

Add gaps to the sequence at the specified indices

Parameters:
  • gaps (list of int) - A list of gap indices

setGaps(self, gaps)

 

Sets gaps on the sequence from a list of gap indices, relative to the ungapped sequence

Parameters:
  • gaps (list of int) - A list of gap indices

removeGaps(self, gaps)

 

Removes the specified gaps from the sequence

Parameters:
  • gaps (list of ints) - A list of gap indices

insert(self, index, elements)

 

Insert a list of elements or sequence element into this sequence

Parameters:
  • index (int) - The index at which to insert elements
  • elements - A list of elements to insert

mutate(self, start, end, elements)

 

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

Parameters:
  • start (int) - The index at which to start mutating
  • end (int) - The index of the last mutated element
  • elements (list) - The elements to which to mutate the sequence

remove(self, start, end=None)

 

Removes elements from the sequence from the index start and returns the removed elements as a new sequence

This method is safe to call with invalid indices (as may happen when an alignment is iterating through sequences calling remove at a single index).

Parameters:
  • start (int) - The index at which to begin removing sequence elements
  • end (int) - The index at which to end removing sequence elements

append(self, element)

 

Appends an element to the sequence

Parameters:
  • element - The element to append to this sequence

extend(self, elements)

 

Extends the sequence with elements from a list

Parameters:
  • elements - The list containing elements with which to extend this one
  • seq (list)

replaceAllElements(self, elements)

 

Replace _sequence entirely with the supplied elements

Parameters:
  • elements (list of proper element types) - Elements for the sequence

removeFromSequence(self, filter_func, start=0, end=None)

 

Remove any residues matching the specified filter_func from the sequence

Parameters:
  • filter_func - A callable taking a residue and returning a bool indicating whether to keep it in the sequence
  • start (int) - The index at which to start filtering
  • end (int) - The index at which to end filtering
Raises:
  • ValueError - In the event that invalid indices are specified

_getScore(self, scoring_function, reference, consider_gaps=True)

 

Return a float scoring between the sequence and a reference sequence, assuming that they're already aligned, calculated using provided scoring_function method of Residue class.

Parameters:
Returns: float
sequence identity (between 0.0 and 1.0)

getIdentity(self, reference, consider_gaps=True)

 

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

Parameters:
Returns: float
sequence identity (between 0.0 and 1.0)

getSimilarity(self, reference, consider_gaps=True)

 

Return a float score of the similarity count between the sequence and a reference sequence, assuming that they're already aligned

Parameters:
Returns: float
sequence similarity (between 0.0 and 1.0)

getHomology(self, reference, consider_gaps=True)

 

Return a float scoring the homology between the sequence and a reference sequence, assuming that they're already aligned

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

Parameters:
Returns: float
sequence homology (between 0.0 and 1.0)

getSimilarityScore(self, reference)

 

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

Since the similarity with a gap will always be 0.0, there is no need to consider gaps.

Parameters:
Returns: float
sequence similarity

getNextResidueIndex(self, index)

 

Return the index of the next residue in the sequence (ignoring gaps) or None if there is none

Parameters:
  • index (int) - The index of the residue
Returns: int or None
The index of the next residue in the sequence

getNextResidue(self, index)

 

Return the next residue in the sequence (ignoring gaps) or None if there is none

Parameters:
  • index (int) - The index of the residue
Returns: schrodinginer.application.msv.domain.residue.Residue
The previous residue in the sequence

getPreviousResidueIndex(self, index)

 

Return the index of the previous residue in the sequence (ignoring gaps) or None if there is none

Parameters:
  • index (int) - The index of the residue
Returns: int or None
The index of the previous residue in the sequence

getPreviousResidue(self, index)

 

Return the next residue in the sequence (ignoring gaps) or None if there is none

Parameters:
  • index (int) - The index of the residue
Returns: schrodinginer.application.msv.domain.residue.Residue
The previous residue in the sequence

iterNeighbors(self)

 

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

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

Returns: iter
Iterable of 3-tuples, each element of the each tuple being either a schrodinger.application.msv.domain.residue.Residue or None

_updateSSAPositions(self, _1, _2)

 

Updates the stored indices of start and end positions of secondary structure assignment blocks in the sequence. The parameters are ignored and included only so that the function can be triggered when the sequence is changed.

getSSAPosType(self, index)

 

Return whether the residue at the specified index is at the start, middle or end of a secondary structure block. Note that while it is unrealistic for a residue to be both the start and end of a block, this may happen (e.g. due to deletion of other elements in an SSA block). In these cases, the residue will be identified as the start of a block by this function.

Parameters:
  • index (int) - Index of the residue to check
Returns: int or None
One of self.SSA_POS_TYPE.START, self.SSA_POS_TYPE.MIDDLE or self.SSA_POS_TYPE.END or None if no residue is at the specified index.

hasEntryID(self)

 

Return whether or not this sequence has an associated Entry ID in the Project Table.

Returns: bool
Whether or not this sequence is associated with an entry ID.

isValid(cls, elements, alphabet, gap_chars)
Class Method

 
Parameters:
  • alphabet (a list of basestr) - The alphabet of permissible characters
  • gap_chars (set of basestr) - A set of permissible gap characters, if any
Returns: Tuple of (bool, set)
Tuple indicating whether valid and a set of invalid characters, if any

Property Details [hide private]

origin

Get Method:
unreachable.origin(self)

_origin_setter

Get Method:
unreachable.origin(self)
Set Method:
unreachable._origin_setter(self, value)

name

Get Method:
unreachable.name(self)

fullname

Get Method:
unreachable.fullname(self) - Returns: a formatted name + optional chain name for the sequence
Type:
str

annotation_types

Get Method:
unreachable.annotation_types(self) - Returns: Enum of all annotation types
Type:
Enum