# Module MMTK.PDB

This module provides classes that represent molecules in PDB file. They permit various manipulations and the creation of MMTK objects. Note that the classes defined in this module are specializations of classed defined in Scientific.IO.PDB; the methods defined in that module are also available.

## Class PDBPeptideChain: Peptide chain in a PDB file

A subclass of Scientific.IO.PDB.PeptideChain. See the description of that class for the constructor and additional methods. In MMTK, PDBPeptideChain objects are usually obtained from a PDBConfiguration object via its attribute peptide_chains (see the documentation of Scientific.IO.PDB.Structure).

Methods:

- createPeptideChain(model=`'all'`, n_terminus=`None`, c_terminus=`None`)

  Returns a PeptideChain object corresponding to the peptide chain in the PDB file. The parameter model has the same meaning as for the PeptideChain constructor.

## Class PDBNucleotideChain: Nucleotide chain in a PDB file

A subclass of Scientific.IO.PDB.NucleotideChain. See the description of that class for the constructor and additional methods. In MMTK, PDBNucleotideChain objects are usually obtained from a PDBConfiguration object via its attribute nucleotide_chains (see the documentation of Scientific.IO.PDB.Structure).

Methods:

- createNucleotideChain(model=`'all'`)

  Returns a NucleotideChain object corresponding to the nucleotide chain in the PDB file. The parameter model has the same meaning as for the NucleotideChain constructor.

## Class PDBMolecule: Molecule in a PDB file

A subclass of Scientific.IO.PDB.Molecule. See the description of that class for the constructor and additional methods. In MMTK, PDBMolecule objects are usually obtained from a PDBConfiguration object via its attribute molecules (see the documentation of Scientific.IO.PDB.Structure). A molecule is by definition any residue in a PDB file that is not an amino acid or nucleotide residue.

Methods:

- createMolecule(name=`None`)

  Returns a Molecule object corresponding to the molecule in the PDB file. The parameter name specifies the molecule name as defined in the chemical database. It can be left out for known molecules (currently only water).

## Class PDBConfiguration: Everything in a PDB file

A PDBConfiguration object represents the full contents of a PDB file. It can be used to create MMTK objects for all or part of the molecules, or to change the configuration of an existing system.

Constructor: PDBConfiguration(filename)

filename

  the name of a PDB file

Methods:

- createPeptideChains(model=`'all'`)

  Returns a list of PeptideChain objects, one for each peptide chain in the PDB file. The parameter model has the same meaning as for the PeptideChain constructor.

- createNucleotideChains(model=`'all'`)

  Returns a list of NucleotideChain objects, one for each nucleotide chain in the PDB file. The parameter model has the same meaning as for the NucleotideChain constructor.

- createMolecules(names=`None`, permit_undefined=`1`)

  Returns a collection of Molecule objects, one for each molecule in the PDB file. Each PDB residue not describing an amino acid or nucleotide residue is considered a molecule.

  The parameter names allows the selective construction of certain molecule types and the construction of unknown molecules. If its value is a list of molecule names (as defined in the chemical database) and/or PDB residue names, only molecules mentioned in this list will be constructed. If its value is a dictionary, it is used to map PDB residue names to molecule names. By default only water molecules are recognizes (under various common PDB residue names); for all other molecules a molecule name must be provided by the user.

  The parameter permit_undefined determines how PDB residues without a corresponding molecule name are handled. A value of 0 causes an exception to be raised. A value of 1 causes an AtomCluster object to be created for each unknown residue.

- createAll(molecule_names=`None`, permit_undefined=`1`)

  Returns a collection containing all objects contained in the PDB file, i.e. the combination of the objects returned by createPeptideChains(), createNucleotideChains(), and createMolecules(). The parameters have the same meaning as for createMolecules().

- applyTo(object)

  Sets the configuration of object from the coordinates in the PDB file. The object must be compatible with the PDB file, i.e. contain the same subobjects and in the same order. This is usually only guaranteed if the object was created by the method createAll() from a PDB file with the same layout.

## Class PDBOutputFile: PDB file for output

Constructor: PDBOutputFile(filename, subformat=`None`)

filename

  the name of the PDB file that is created

subformat

  a variant of the PDB format; these subformats are defined in module Scientific.IO.PDB. The default is the standard PDB format.

Methods:

- write(object, configuration=`None`, tag=`None`)

  Writes object to the file, using coordinates from configuration (defaults to the current configuration). The parameter tag is reserved for internal use.

- close()

  Closes the file. Must be called in order to prevent data loss.