Python: module src.definitions

src.definitions (15 May 2008) | index /Users/d3y382/workspaces/apbs-pdb2pqr/pdb2pqr/src/definitions.py

`Definitions for PDB2PQR
This file contains classes associated with Amino Acid and Rotamer
definitions as used by PDB2PQR.
----------------------------
PDB2PQR -- An automated pipeline for the setup, execution, and analysis of
Poisson-Boltzmann electrostatics calculations
Copyright (c) 2002-2011, Jens Erik Nielsen, University College Dublin;
Nathan A. Baker, Battelle Memorial Institute, Developed at the Pacific
Northwest National Laboratory, operated by Battelle Memorial Institute,
Pacific Northwest Division for the U.S. Department Energy.;
Paul Czodrowski & Gerhard Klebe, University of Marburg.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of University College Dublin, Battelle Memorial Institute,
Pacific Northwest National Laboratory, US Department of Energy, or University
of Marburg nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.`

Modules
`` |  |
copy getopt | math os | re xml.sax | string sys

Classes
`` |  | Definition Patch src.structures.Atom(src.pdb.ATOM) DefinitionAtom src.structures.Residue DefinitionResidue xml.sax.handler.ContentHandler DefinitionHandler
class Definition
`` | `Definition class The Definition class contains the structured definitions found in the files and several mappings for easy access to the information.`
| Methods defined here: __init__(self) `Create a new Definition Object` addPatch(self, patch, refname, newname) `Add a patch to a definition residue. Parameters patch: The patch object to add (Patch) refname: The name of the object to add the patch to (string) newname: The name of the new (patched) object (string)`
class DefinitionAtom(src.structures.Atom)
`` | `A trimmed down version of the Atom class`
| Method resolution order: DefinitionAtom src.structures.Atom src.pdb.ATOM src.pdb.BaseRecord __builtin__.object Methods defined here: __init__(self, name=None, x=None, y=None, z=None) `Initialize the class` __str__(self) `A basic string representation for debugging` isBackbone(self) `Return true if atom name is in backbone, otherwise false Returns state: 1 if true, 0 if false` Methods inherited from src.structures.Atom: addBond(self, bondedatom) `Add a bond to the list of bonds Parameters: bondedatom: The atom to bond to (Atom)` get(self, name) `Get a member of the Atom class Parameters name: The name of the member (string) Possible Values type: The type of Atom (either ATOM or HETATM) serial: Atom serial number name: Atom name altLoc: Alternate location resName: Residue name chainID: Chain identifier resSeq: Residue sequence number iCode: Code for insertion of residues x: Orthogonal coordinates for X in Angstroms. y: Orthogonal coordinates for Y in Angstroms. z: Orthogonal coordinates for Z in Angstroms. occupancy: Occupancy tempFactor: Temperature Factor segID: Segment identifier element: Element symbol charge: Charge on the atom bonds: The bonds associated with the atom interbonds: The intrabonds associated with the atom extrabonds: The extrabonds assocaited with the atom residue: The parent residue of the atom radius: The radius of the atom ffcharge: The forcefield charge on the atom hdonor: Whether the atom is a hydrogen donor hacceptor: Whether the atom is a hydrogen acceptor Returns item: The value of the member` getCommonStringRep(self, chainflag=False) `Returns a string of the common column of the new atom type. Uses the ATOM string output but changes the first field to either by ATOM or HETATM as necessary. This is used to create the output for pqr and pdb files! No touchy! Returns outstr: String with ATOM/HETATM field set appropriately` getCoords(self) `Return the x,y,z coordinates of the atom in list form Returns List of the coordinates (list)` getPDBString(self) `Returns a string of the new atom type. Uses the ATOM string output but changes the first field to either by ATOM or HETATM as necessary. This is for the pdb representation of the atom. The propka30 module depends on this being correct. No touchy! Returns str: String with ATOM/HETATM field set appropriately` getPQRString(self, chainflag=False) `Returns a string of the new atom type. Uses the ATOM string output but changes the first field to either by ATOM or HETATM as necessary. This is used to create the output for pqr files! No touchy! Returns str: String with ATOM/HETATM field set appropriately` hasReference(self) `Determine if the atom object has a reference object or not. All known atoms should have reference objects. Returns True if atom has a reference object, False otherwise.` isHydrogen(self) `Is this atom a Hydrogen atom? Returns value: 1 if Atom is a Hydrogen, 0 otherwise` set(self, name, value) `Set a member of the Atom class Parameters name: The name of the member (string) value: The value to set the member to Possible Values type: The type of Atom (either ATOM or HETATM) serial: Atom serial number name: Atom name altLoc: Alternate location resName: Residue name chainID: Chain identifier resSeq: Residue sequence number iCode: Code for insertion of residues x: Orthogonal coordinates for X in Angstroms. y: Orthogonal coordinates for Y in Angstroms. z: Orthogonal coordinates for Z in Angstroms. occupancy: Occupancy tempFactor: Temperature Factor segID: Segment identifier element: Element symbol charge: Charge on the atom residue: The parent residue of the atom radius: The radius of the atom ffcharge: The forcefield charge on the atom hdonor: Whether the atom is a hydrogen donor hacceptor: Whether the atom is a hydrogen acceptor` Data descriptors inherited from src.pdb.BaseRecord: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class DefinitionHandler(xml.sax.handler.ContentHandler)
`` |  | Methods defined here: __init__(self) characters(self, text) endElement(self, name) startElement(self, name, attributes) Methods inherited from xml.sax.handler.ContentHandler: endDocument(self) `Receive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.` endElementNS(self, name, qname) `Signals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.` endPrefixMapping(self, prefix) `End the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.` ignorableWhitespace(self, whitespace) `Receive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.` processingInstruction(self, target, data) `Receive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.` setDocumentLocator(self, locator) `Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.` skippedEntity(self, name) `Receive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.` startDocument(self) `Receive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).` startElementNS(self, name, qname, attrs) `Signals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.` startPrefixMapping(self, prefix, uri) `Begin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.`
class DefinitionResidue(src.structures.Residue)
`` | `DefinitionResidue class The DefinitionResidue class extends the Residue class to allow for a trimmed down initializing function.`
| Methods defined here: __init__(self) `Initialize the class using a few parameters Parameters: name: The abbreviated amino acid name of the DefinitionResidue` __str__(self) `A basic string representation for debugging` addDihedral(self, atom) `Add the atom to the list of dihedral bonds Parameters: atom: The atom to be added` getNearestBonds(self, atomname) `Parameters number: The number of bonds to get Returns bonds: A list of atomnames that are within three bonds of the atom and present in residue (list)` Methods inherited from src.structures.Residue: addAtom(self, atom) `Add the atom object to the residue. Parameters atom: The object to be added (ATOM)` addMissing(self, value) `Add the value to the list of missing atoms Parameters value: The name of the missing atom (string)` createAtom(self, name, newcoords, type) `Add a new atom object to the residue. Uses an atom currently in the residue to seed the new atom object, then replaces the coordinates and name accordingly. Parameters name: The name of the new atom (string) newcoords: The x,y,z coordinates of the new atom (list) type: The type of atom, ATOM or HETATM` get(self, name) `Get a member of the Residue class Parameters name: The name of the member (string) Possible Values atoms: The atoms in the residue name: The name of the residue chainID: The chainID associated with the residue resSeq: The sequence number of the residue icode: The iCode of the residue SSbonded: 1 if the residue has a SS bond, 0 otherwise SSbondpartner: The residue of the bond partner type: The type associated with this residue isNterm: # of hydrogens if the residue is the N-Terminus, 0 otherwise isCterm: 1 if the residue is the C-Terminus, 0 otherwise missing: List of missing atoms of the residue Returns item: The value of the member` getAtom(self, name) `Retrieve an atom from the mapping Parameters resname: The name of the residue to retrieve (string)` getAtoms(self) getCharge(self) `Get the total charge of the residue. In order to get rid of floating point rounding error, do the string transformation. Returns: charge: The charge of the residue (float)` hasAtom(self, name) letterCode(self) numAtoms(self) `Get the number of atoms for the residue Returns Number of atoms in the residue (int)` removeAtom(self, atomname) `Remove an atom from the residue object. Parameters atomname: The name of the atom to be removed (string)` renameAtom(self, oldname, newname) `Rename an atom to a new name Parameters oldname: The old atom name (string) newname: The new atom name (string)` renameResidue(self, name) `Rename a given residue Parameters name: The new name of the residue` reorder(self) `Reorder the atoms to start with N, CA, C, O if they exist` rotateTetrahedral(self, atom1, atom2, angle) `Rotate about the atom1-atom2 bond by a given angle All atoms connected to atom2 will rotate. Parameters: atom1: The first atom of the bond to rotate about (atom) atom2: The second atom of the bond to rotate about (atom) angle: The number of degrees to rotate (float)` set(self, name, value) `Set a member of the Residue class to a specific value Parameters name: The name of the object to set (string) value: The object to append Possible Values atoms: The atoms in the residue name: The name of the residue chain: The chainID associated with the residue resSeq: The sequence number of the residue icode: The iCode of the residue SSbonded: 1 if the residue has a SS bond, 0 otherwise SSbondpartner: The residue of the bond partner type: The type associated with this residue isNterm: # of hydrogens if the residue is the N-Terminus, 0 otherwise isCterm: 1 if the residue is the C-Terminus, 0 otherwise isDirty: 1 if the residue is not missing atoms, 0 otherwise Notes resSeq points to the residue.setResSeq function Returns item: The value of the member` setChainID(self, value) `Set the chainID field to a certain value` setDonorsAndAcceptors(self) `Set the donors and acceptors within the residue` setResSeq(self, value) `Set the atom field resSeq to a certain value and change the residue's information. The icode field is no longer useful. Parameters value: The new value of resSeq (int)` update_terminus_status(self) `Update the isNterms and isCterm flags`
class Patch
`` | `Patch the definitionResidue class`
| Methods defined here: __init__(self) `Initialize the Patch object.` __str__(self) `A basic string representation for debugging`

Data
`` |  | AAPATH = 'dat/AA.xml' AAS = ['ALA', 'ARG', 'ASH', 'ASN', 'ASP', 'CYS', 'CYM', 'GLN', 'GLU', 'GLH', 'GLY', 'HIS', 'HID', 'HIE', 'HIP', 'HSD', 'HSE', 'HSP', 'ILE', 'LEU', ...] BACKBONE = ['N', 'CA', 'C', 'O', 'O2', 'HA', 'HN', 'H', 'tN'] BONDED_SS_LIMIT = 2.5 BUMP_DIST = 2.0 BUMP_HDIST = 1.5 BUMP_HEAVY_SIZE = 1.0 BUMP_HYDROGEN_SIZE = 0.5 CELL_SIZE = 2 DIHEDRAL = 57.2958 INSTALLDIR = '/Users/d3y382/pdb2pqr/' NAPATH = 'dat/NA.xml' NAS = ['A', 'A5', 'A3', 'C', 'C5', 'C3', 'G', 'G5', 'G3', 'T', 'T5', 'T3', 'U', 'U5', 'U3', 'RA', 'RG', 'RC', 'RU', 'DA', ...] PATCHPATH = 'dat/PATCHES.xml' PEPTIDE_DIST = 1.7 REPAIR_LIMIT = 10 SMALL = 1e-07 TMPDIR = 'tmp/' __author__ = 'Jens Erik Nielsen, Todd Dolinsky, Yong Huang' __date__ = '15 May 2008' lineParsers = {'ANISOU': <class 'src.pdb.ANISOU'>, 'ATOM': <class 'src.pdb.ATOM'>, 'AUTHOR': <class 'src.pdb.AUTHOR'>, 'CAVEAT': <class 'src.pdb.CAVEAT'>, 'CISPEP': <class 'src.pdb.CISPEP'>, 'COMPND': <class 'src.pdb.COMPND'>, 'CONECT': <class 'src.pdb.CONECT'>, 'CRYST1': <class 'src.pdb.CRYST1'>, 'DBREF': <class 'src.pdb.DBREF'>, 'END': <class 'src.pdb.END'>, ...}

Author
`` |  | Jens Erik Nielsen, Todd Dolinsky, Yong Huang