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

Class Group



Known Subclasses:
Residue, Molecule

Atom group (residue or molecule) in a PDB file

This is an abstract base class. Instances can be created using one of the subclasses (Molecule, AminoAcidResidue, NucleotideResidue).

Group objects permit iteration over atoms with for-loops, as well as extraction of atoms by indexing with the atom name.

Instance Methods [hide private]
  __getitem__(self, item)
  __init__(self, name, atoms=None, number=None)
  __len__(self)
  __repr__(self)
  __str__(self)
  addAtom(self, atom)
Add an atom to the group
  changeName(self, name)
Set the PDB residue name
  deleteAtom(self, atom)
Remove an atom from the group
  deleteHydrogens(self)
Remove all hydrogen atoms of the group
  isCompatible(self, residue_data)
  writeToFile(self, file)
Write the group to a file

Method Details [hide private]

__getitem__(self, item)
(Indexing operator)

 
Parameters:
  • item (int or str) - an integer index or an atom name

__init__(self, name, atoms=None, number=None)
(Constructor)

 
Parameters:
  • name (str) - the name of the group
  • atoms (list or NoneType) - a list of atoms (or None for no atoms)
  • number (int or NoneType) - the PDB residue number (or None)

__len__(self)
(Length operator)

 

__repr__(self)
(Representation operator)

 

__str__(self)
(Informal representation operator)

 

addAtom(self, atom)

 

Add an atom to the group
Parameters:
  • atom (Atom) - the atom

changeName(self, name)

 

Set the PDB residue name
Parameters:
  • name (str) - the new name

deleteAtom(self, atom)

 

Remove an atom from the group
Parameters:
  • atom (atom) - the atom to be removed
Raises:
  • KeyError - if the atom is not part of the group

deleteHydrogens(self)

 

Remove all hydrogen atoms of the group

isCompatible(self, residue_data)

 

writeToFile(self, file)

 

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