Scientific.IO.PDB.Group

Package Scientific :: Package IO :: Module PDB :: Class Group |
[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
__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

### __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`)

### 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

### writeToFile(self, file) |
Write the group to a file Parameters: `file` (PDBFile or `str`) - a PDBFile object or a file name