src.utilities (6 November 2007) | index /Users/d3y382/workspaces/apbs/pdb2pqr/branches/pdb2pqr-1.8/src/utilities.py

`Utilities for PDB2PQR Suite
This module provides various utilities for the PDB2PQR suite to be
imported into other Python scripts.
----------------------------
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

``

math | os | sys |

Classes

``

__builtin__.object
  ExtraOptions

class ExtraOptions(__builtin__.object)

``

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Functions

``

add(coords1, coords2)
  `Add one 3-dimensional point to another
  Parameters
  coords1: coordinates of form [x,y,z]
  coords2: coordinates of form [x,y,z]
  Returns
  list: List of coordinates equal to coords2 + coords1 (list)`

analyzeConnectivity(map, key)
  `Analyze the connectivity of a given map using the key value.
  Parameters
  map: The map to analyze (dict)
  key: The key value (variable)
  Returns
  list: A list of connected values to the key (list)`

appendToLogFile(jobName, fileName, logInput)

createPropkaOptions(pH, verbose=False)
  `Create a propka options object for running propka.`

cross(coords1, coords2)
  `Find the cross product of two 3-dimensional points
  Parameters
  coords1: coordinates of form [x,y,z]
  coords2: coordinates of form [x,y,z]
  Returns
  list: Cross product coords2 and coords1 (list)`

distance(coords1, coords2)
  `Calculate the distance between two coordinates, as denoted by
  dist = sqrt((x2- x1)^2 + (y2 - y1)^2 + (z2 - z1)^2))
  Parameters
  coords1: Coordinates of form [x,y,z]
  coords2: Coordinates of form [x,y,z]
  Returns
  dist: Distance between the two coordinates (float)`

dot(coords1, coords2)
  `Find the dot product of two 3-dimensional points
  Parameters
  coords1: coordinates of form [x,y,z]
  coords2: coordinates of form [x,y,z]
  Returns
  value: Dot product coords2 and coords1 (float)`

factorial(n)
  `Returns the factorial of the given number n`

getAngle(coords1, coords2, coords3)
  `Get the angle between three coordinates
  Parameters
  coords1: The first coordinate set (atom)
  coords2: The second (vertex) coordinate set (atom)
  coords3: The third coordinate set (atom)
  Returns
  angle: The angle between the atoms (float)`

getDatFile(name)
  `Grab a data file. If the file cannot be found in the
  given directory, try the current system path.
  Parameters
  name: The name of the file to get (string)
  Returns
  path: The path to the file (string)`

getDihedral(coords1, coords2, coords3, coords4)
  `Calculate the angle using the four atoms
  Parameters
  coords1: First of four coordinates of form [x,y,z]
  coords2: Second of four
  coords3: Third of four
  coords4: Fourth of four
  Returns
  value: Size of the angle (float)`

getEventTrackingString(category, action, label, value=None)

getFFfile(name)
  `Grab the forcefield file. May or may not residue in the dat/
  directory.`

getNamesFile(name)
  `Grab the *.names file that contains the XML mapping.
  Parameters
  name: The name of the forcefield (string)
  Returns
  path: The path to the file (string)`

getPDBFile(path)
  `Obtain a PDB file. First check the path given on the command
  line - if that file is not available, obtain the file from the
  PDB webserver at http://www.rcsb.org/pdb/ .
  Parameters
  path: Name of PDB file to obtain (string)
  Returns
  file: File object containing PDB file (file object)`

getTrackingScriptString(jobid=None)
  `For injecting tracking script into a web page.
  jobid -> current jobid. Adds "jobid" custom variable to events and page views on this page.`

normalize(coords)
  `Normalize a set of coordinates
  Parameters
  coords: coordinates of form [x,y,z]
  Returns
  list: normalized coordinates (list)`

resetLogFile(jobName, fileName)
  `For clearing out old log files if needed.
  Used mainly for removing apbs_end_time if apbs is rerun.`

shortestPath(graph, start, end, path=[])
  `Uses recursion to find the shortest path from one node to
  another in an unweighted graph. Adapted from
  http://www.python.org/doc/essays/graphs.html .
  Parameters:
  graph: A mapping of the graph to analyze, of the form
  {0: [1,2], 1:[3,4], ...} . Each key has a list
  of edges.
  start: The ID of the key to start the analysis from
  end: The ID of the key to end the analysis
  path: Optional argument used during the recursive step
  to keep the current path up to that point
  Returns:
  (variable): Returns a list of the shortest path (list)
  Returns None if start and end are not
  connected`

sortDictByValue(inputdict)
  `Sort a dictionary by its values
  Parameters
  inputdict: The dictionary to sort (inputdict)
  Returns
  items: The dictionary sorted by value (list)`

startLogFile(jobName, fileName, logInput)

subtract(coords1, coords2)
  `Subtract one 3-dimensional point from another
  Parameters
  coords1: coordinates of form [x,y,z]
  coords2: coordinates of form [x,y,z]
  Returns
  list: List of coordinates equal to coords1 - coords2 (list)`

Data
`` |  | DIHEDRAL = 57.2958 INSTALLDIR = '/Users/d3y382/pdb2pqr/' SMALL = 9.9999999999999995e-08 TMPDIR = 'tmp/' __author__ = 'Todd Dolinsky, Yong Huang' __date__ = '6 November 2007'

Author
`` |  | Todd Dolinsky, Yong Huang