Package Scientific :: Package IO :: Module PDB :: Class Chain
[hide private]
[frames] | no frames]

Class Chain



Known Subclasses:
DummyChain, NucleotideChain, PeptideChain

Chain of PDB residues

This is an abstract base class. Instances can be created using one of the subclasses (PeptideChain, NucleotideChain).

Chain objects respond to len() and return their residues by indexing with integers.

Instance Methods [hide private]
AminoAcidResidue or NucleotideResidue __getitem__(self, index)
Returns the residue corresponding to the index
PeptideChain or NucleotideChain __getslice__(self, i1, i2)
Returns the subchain from i1 to i2
  __init__(self, residues=None, chain_id=None, segment_id=None)
int __len__(self)
Returns the number of residues in the chain
  addResidue(self, residue)
Add a residue at the end of the chain
  deleteHydrogens(self)
Remove all hydrogen atoms in the chain
  removeResidues(self, first, last)
Remove residues in a given index range.
list of str sequence(self)
Returns the list of residue names
  writeToFile(self, file)
Write the chain to a file

Method Details [hide private]

__getitem__(self, index)
(Indexing operator)

 
Parameters:
  • index (int) - an index into the chain
Returns: AminoAcidResidue or NucleotideResidue
the residue corresponding to the index
Raises:
  • IndexError - if index exceeds the chain length

__getslice__(self, i1, i2)
(Slicling operator)

 
Parameters:
  • i1 (int) - in index into the chain
  • i2 - in index into the chain @type i12 int
Returns: PeptideChain or NucleotideChain
the subchain from i1 to i2

__init__(self, residues=None, chain_id=None, segment_id=None)
(Constructor)

 
Parameters:
  • residues (list or NoneType) - a list of residue objects, or None meaning that the chain is initially empty
  • chain_id (str or NoneType) - a one-letter chain identifier or None
  • segment_id (str or NoneType) - a multi-character segment identifier or None

__len__(self)
(Length operator)

 
Returns: int
the number of residues in the chain

addResidue(self, residue)

 

Add a residue at the end of the chain
Parameters:

deleteHydrogens(self)

 

Remove all hydrogen atoms in the chain

removeResidues(self, first, last)

 

Remove residues in a given index range.
Parameters:
  • first (int) - the index of the first residue to be removed
  • last (int or NoneType) - the index of the first residue to be kept, or None meaning remove everything to the end of the chain.

sequence(self)

 
Returns: list of str
the list of residue names

writeToFile(self, file)

 

Write the chain to a file
Parameters:
  • file (PDBFile or str) - a PDBFile object or a file name