The MolecularSystem object is designed to provide a lightweight, dependency-free data structure for accessing and manipulating molecular structure and associated data. The toplevel System class acts as a container for the set of MolecularComponents classes. These include two base classes Atom and Molecule; classes Polymer, Ligand, Water, Nucleotide, and AminoAcid inherit the traits of class Molecule. Protein and NucleotideChain objects inherit the traits of class Polymer; they contain AminoAcid or Nucleotide objects.
The MolecularComponents classes are designed to hierarchically organize the data contained within the System class. Look in the MolecularComponents directory for these files. Briefly, classMolecule contains a list of classAtom objects, which are parented by classPoint objects. The classPolymer, classAminoAcid, classNucleotide, and classWater objects all inherit the properties and functions of classMolecule. The classProtein and classNucelotideChain objects contain classAminoAcid and classNucleotideChain objects.
The Data Hierarchy
The load_pdb function creates and stores the above Molecule objects in the lists ProteinList, NucleotideChainList, LigandList, and WaterList. System's supplementary_initialization function is then called, which duplicates the pointers to the same Molecule objects within several other lists and dictionaries, created purely for the sake of convenience. When the MolecularSystem object is stored, these supplementary data structures are deleted, and only the remaining data is pickled. This approach minimizes the space required for storage. To reload the data, the load_system function is called with the filename of the pickled file. The supplementary_initialization function is then applied to this object to recreate the more convenient data structures. Another way of saving the data is to use the save_pdb function, which saves a file in standard PDB format.
Unique Attributes of class System
- the filename of the last load or save
- an internal selection argument
- a list of Protein objects
- a list of NucleotideChain objects
- a list of Ligand objects
- a list of Water objects
- the full list of header lines
- the ‘HEADER’ entry from HeaderLines
Convenience Attributes of class System
These attributes are initially produced and subsequently regenerated from the above.
- classes Ligand, Water, Protein, and NucleotideChain
- classes Ligand and Water
- classes Protein and NucleotideChain
- self.PolymerList keyed by chain name
- self.ProteinList keyed by chain name
- self.NucleotideChainList keyed by chain name
- self.Ligand keyed by res_number concatenated to chain_name
- self.Water keyed by res_number concatenated to chain_name
Loading and Saving Data
- self.load_pdb(pdb_filename, silent=0)
- Load the file in either verbose or quiet mode (default).
- Saves a text file in PDB format.
- Save a SPADE Molecular System (.sms) file. This automatically retains the current graphical rendering.
- self.get_filename_by_extension(extention, chain_name=None)
- returns a filename for the provided chain name, with the given file extention ext. e.g. project_system.gfbe('.sms', 'A') returns 'path_to_spade/SPADE/Systems/project/project_A.sms'.
- for compatibility with some older programs.
- Select this system (does not select subcomponents)
- Deselect this system
- min and max values for x, y, z
- used at initialization should be obsolete by automated normalization of features attributes
- renumbers the atoms of all molecules, first by type (protein, dna, ligands, then waters) then by chain name, then by residue number.
- add a hydrogen, base code for adding other atoms. Index is specified in the arguements.
Class FutamuraHash is useful for quickly accessing atoms within a given distance from other atoms. The hash table divides a molecule’s space into grid blocks, such that only local grid blocks are traversed when looking for atoms within given distances of each other. The molecule itself (any implementation of class Molecule) is the first argument. The second argument creates grid space that surpasses the molecule's actual min and max x, y, and z coordinates by the given amount. This is useful if distances are to include points outside of the molecule, like its surface representation. The third argument is the maximum distance another atom is allowed to be and still be within range.
This is a generalized state save technique that follows the traditional Visitor design pattern, to allow generalized undo/redo functionality. SystemMemory quickly traverses a MolecularSystem object and records System data into a tree that is the same shape as the MolecularSystem object itself. restore_system() can then be used to traverse and restore the data. System memory objects inherit from base class SystemMemory, which handles traversal. To specify the data to collect, implement the _get_data() and _set_data() functions, as demonstrated in several class objects in the MolecularSystem.py file. Particularly noteworthy are the .__init__(system) function, which records the memory, and the .restore_system() function, which restores a MolecularSystem to the initialized state.
Copyright © 2001-2009 Deacon Sweeney. All rights reserved.