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 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.
self.filename
the filename of the last load or save
self.selected
an internal selection argument
self.ProteinList
a list of Protein objects
self.NucleotideChainList
a list of NucleotideChain objects
self.LigandList
a list of Ligand objects
self.WaterList
a list of Water objects
self.HeaderLines
the full list of header lines
self.header
the ‘HEADER’ entry from HeaderLines
These attributes are initially produced and subsequently regenerated from the above.
self.MoleculeList
classes Ligand, Water, Protein, and NucleotideChain
self.SmallMoleculeList
classes Ligand and Water
self.PolymerList
classes Protein and NucleotideChain
self.PolymerDict
self.PolymerList keyed by chain name
self.ProteinDict
self.ProteinList keyed by chain name
self.NucleotideChainDict
self.NucleotideChainList keyed by chain name
self.LigandDict
self.Ligand keyed by res_number concatenated to chain_name
self.WaterDict
self.Water keyed by res_number concatenated to chain_name
self.load_pdb(pdb_filename, silent=0)
Load the file in either verbose or quiet mode (default).
self.save_pdb(pdb_filename)
Saves a text file in PDB format.
self.save_system(sms_filename)
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'.
self.translate_filename_to_DOS_8_3_format(filename)
for compatibility with some older programs.
self.select()
Select this system (does not select subcomponents)
self.deselect()
Deselect this system
self.get_bounds()
min and max values for x, y, z
self.normalize_b_factors()
used at initialization should be obsolete by automated normalization of features attributes
self.renumber_atoms()
renumbers the atoms of all molecules, first by type (protein, dna, ligands, then waters) then by chain name, then by residue number.
self.create_hydrogen()
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