Package csb :: Package bio :: Package structure :: Class Chain
[frames] | no frames]

Class Chain

source code

            object --+        
                     |        
core.AbstractContainer --+    
                         |    
  core.AbstractNIContainer --+
                             |
                object --+   |
                         |   |
            AbstractEntity --+
                             |
                            Chain

Represents a polymeric chain. Provides list-like and rank-based access to the residues in the chain:

>>> chain[0]
<ProteinResidue [1]: SER None>
>>> chain.residues[1]
<ProteinResidue [1]: SER None>

You can also access residues by their PDB sequence number:

>>> chain.find(sequence_number=5, insertion_code='A')
<ProteinResidue [1]: SER 5A>
Nested Classes

Inherited from core.AbstractContainer: __metaclass__

Instance Methods
 
__init__(self, chain_id, type=Protein, name='', residues=None, accession=None, molecule_id=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__len__(self) source code
 
__repr__(self)
repr(x)
source code
SuperimposeInfo
align(self, other, what=['CA'], how=Global)
Align other's alpha carbons over self in space and return SuperimposeInfo.
source code
Chain
clone(self)
Make a deep copy of the chain.
source code
 
compute_torsion(self)
Iterate over all residues in the chain, compute and set their torsion property.
source code
Residue
find(self, sequence_number, insertion_code=None)
Get a residue by its original Residue Sequence Number and Insertion Code.
source code
float
rmsd(self, other, what=['CA'])
Compute the C-alpha RMSD against another chain (assuming equal length).
source code
Chain
subregion(self, start, end, clone=False)
Extract a subchain defined by [start, end].
source code
SuperimposeInfo
superimpose(self, other, what=['CA'], how=Global)
Find the optimal fit between self and other.
source code
float
tm_score(self, other, what=['CA'])
Compute the C-alpha TM-Score against another chain (assuming equal chain length and optimal configuration - no fitting is done).
source code
SuperimposeInfo
tm_superimpose(self, other, what=['CA'], how=Global)
Find the optimal fit between self and other.
source code

Inherited from core.AbstractNIContainer: __getitem__

Inherited from core.AbstractContainer: __bool__, __iter__, __nonzero__

Inherited from AbstractEntity: components, get_coordinates, transform

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

Static Methods
Chain
from_sequence(sequence, id='_')
Create a new chain from an existing sequence.
source code
Class Variables
  __abstractmethods__ = frozenset([])
Properties
str accession
Accession number
csb.core.enum alphabet
Sequence alphabet corresponding to the current chain type
str entry_id
Accession number + chain ID
bool has_torsion
True if Chain.compute_torsion had been invoked
str header
FASTA header in PDB format
str id
Chain's ID
iterator of AbstractEntity items
Iterator over all immediate children of the entity
int length
Number of residues
int molecule_id
PDB MOL ID of this chain
str name
Chain name
ChainResiduesCollection residues
Rank-based access to Chain's Residues
SecondaryStructure secondary_structure
Secondary structure (if available)
str sequence
Chain sequence
TorsionAnglesCollection torsion
Torsion angles
enum item type
Chain type - any member of SequenceTypes

Inherited from object: __class__

Method Details

__init__(self, chain_id, type=Protein, name='', residues=None, accession=None, molecule_id=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • chain_id (str) - ID of the new chain
  • type (csb.core.EnumItem) - sequence type (a member of the SequenceTypes enum)
  • name (str) - name of the chain
  • residues (list) - initialization list of Residue-s
  • accession (str) - accession number of the chain
  • molecule_id - MOL ID of the chain, if part of a polymer
Overrides: object.__init__
(inherited documentation)

__len__(self)
(Length operator)

source code 
Overrides: core.AbstractContainer.__len__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

align(self, other, what=['CA'], how=Global)

source code 

Align other's alpha carbons over self in space and return SuperimposeInfo. Coordinates of other are overwritten in place using the rotation matrix and translation vector in SuperimposeInfo. Alias for:

   R, t = self.superimpose(other, what=['CA'])
   other.transform(R, t)
Parameters:
  • other (Chain) - the subject (movable) chain
  • what (list) - a list of atom kinds, e.g. ['CA']
  • how (csb.core.EnumItem) - fitting method (global or local) - a member of the AlignmentTypes enum
Returns: SuperimposeInfo
superimposition info object, containing rotation matrix, translation vector and computed RMSD

clone(self)

source code 

Make a deep copy of the chain. If this chain is part of a structure, detach from it.

Returns: Chain
a deep copy of self

compute_torsion(self)

source code 

Iterate over all residues in the chain, compute and set their torsion property.

Raises:

find(self, sequence_number, insertion_code=None)

source code 

Get a residue by its original Residue Sequence Number and Insertion Code.

Parameters:
  • sequence_number (str) - PDB sequence number of the residue
  • insertion_code (str) - PDB insertion code of the residue (if any)
Returns: Residue
the residue object with such an ID
Raises:

from_sequence(sequence, id='_')
Static Method

source code 

Create a new chain from an existing sequence.

Parameters:
Returns: Chain

rmsd(self, other, what=['CA'])

source code 

Compute the C-alpha RMSD against another chain (assuming equal length). Chains are superimposed with Least Squares Fit / Singular Value Decomposition.

Parameters:
  • other (Chain) - the subject (movable) chain
  • what (list) - a list of atom kinds, e.g. ['CA']
Returns: float
computed RMSD over the specified atom kinds

subregion(self, start, end, clone=False)

source code 

Extract a subchain defined by [start, end]. If clone is True, this is a deep copy of the chain. Otherwise same as:

>>> chain.residues[start : end + 1]

but coordinates are checked and a Chain instance is returned.

Parameters:
  • start (int) - start position of the sub-region
  • end (int) - end position
  • clone (bool) - if True, a deep copy of the sub-region is returned, otherwise - a shallow one
Returns: Chain
a new chain, made from the residues of the extracted region
Raises:
  • IndexError - if start/end positions are out of range

superimpose(self, other, what=['CA'], how=Global)

source code 

Find the optimal fit between self and other. Return SuperimposeInfo (RotationMatrix, translation Vector and RMSD), such that:

>>> other.transform(rotation_matrix, translation_vector)

will result in other's coordinates superimposed over self.

Parameters:
  • other (Chain) - the subject (movable) chain
  • what (list) - a list of atom kinds, e.g. ['CA']
  • how (csb.core.EnumItem) - fitting method (global or local) - a member of the AlignmentTypes enum
Returns: SuperimposeInfo
superimposition info object, containing rotation matrix, translation vector and computed RMSD
Raises:

tm_score(self, other, what=['CA'])

source code 

Compute the C-alpha TM-Score against another chain (assuming equal chain length and optimal configuration - no fitting is done).

Parameters:
  • other (Chain) - the subject (movable) chain
  • what (list) - a list of atom kinds, e.g. ['CA']
Returns: float
computed TM-Score over the specified atom kinds

tm_superimpose(self, other, what=['CA'], how=Global)

source code 

Find the optimal fit between self and other. Return SuperimposeInfo (RotationMatrix, translation Vector and TM-score), such that:

>>> other.transform(rotation_matrix, translation_vector)

will result in other's coordinates superimposed over self.

Parameters:
  • other (Chain) - the subject (movable) chain
  • what (list) - a list of atom kinds, e.g. ['CA']
  • how (csb.core.EnumItem) - fitting method (global or local) - a member of the AlignmentTypes enum
Returns: SuperimposeInfo
superimposition info object, containing rotation matrix, translation vector and computed TM-score
Raises:

Property Details

accession

Accession number

Get Method:
unreachable.accession(self) - Accession number
Set Method:
unreachable.accession(self, accession)
Type:
str

alphabet

Sequence alphabet corresponding to the current chain type

Get Method:
unreachable.alphabet(self) - Sequence alphabet corresponding to the current chain type
Type:
csb.core.enum

entry_id

Accession number + chain ID

Get Method:
unreachable.entry_id(self) - Accession number + chain ID
Type:
str

has_torsion

True if Chain.compute_torsion had been invoked

Get Method:
unreachable.has_torsion(self) - True if Chain.compute_torsion had been invoked
Type:
bool

header

FASTA header in PDB format

Get Method:
unreachable.header(self) - FASTA header in PDB format
Type:
str

id

Chain's ID

Get Method:
unreachable.id(self) - Chain's ID
Set Method:
unreachable.id(self, id)
Type:
str

items

Iterator over all immediate children of the entity

Get Method:
unreachable.items(self)
Type:
iterator of AbstractEntity

length

Number of residues

Get Method:
unreachable.length(self) - Number of residues
Type:
int

molecule_id

PDB MOL ID of this chain

Get Method:
unreachable.molecule_id(self) - PDB MOL ID of this chain
Set Method:
unreachable.molecule_id(self, value)
Type:
int

name

Chain name

Get Method:
unreachable.name(self) - Chain name
Set Method:
unreachable.name(self, value)
Type:
str

residues

Rank-based access to Chain's Residues

Get Method:
unreachable.residues(self) - Rank-based access to Chain's Residues
Type:
ChainResiduesCollection

secondary_structure

Secondary structure (if available)

Get Method:
unreachable.secondary_structure(self) - Secondary structure (if available)
Set Method:
unreachable.secondary_structure(self, ss)
Type:
SecondaryStructure

sequence

Chain sequence

Get Method:
unreachable.sequence(self) - Chain sequence
Type:
str

torsion

Torsion angles

Get Method:
unreachable.torsion(self) - Torsion angles
Type:
TorsionAnglesCollection

type

Chain type - any member of SequenceTypes

Get Method:
unreachable.type(self) - Chain type - any member of SequenceTypes
Set Method:
unreachable.type(self, type)
Type:
enum item