Package MolKit :: Package pdb2pqr :: Package src :: Module server
[hide private]
[frames] | no frames]

Module server

source code

CGI Server for PDB2PQR

This module contains the various functions necessary to run PDB2PQR from a web server.

----------------------------

PDB2PQR -- An automated pipeline for the setup, execution, and analysis of Poisson-Boltzmann electrostatics calculations

Nathan A. Baker (baker@biochem.wustl.edu) Todd Dolinsky (todd@ccb.wustl.edu) Dept. of Biochemistry and Molecular Biophysics Center for Computational Biology Washington University in St. Louis

Jens Nielsen (Jens.Nielsen@ucd.ie) University College Dublin

Additional contributing authors listed in documentation and supporting package licenses.

Copyright (c) 2003-2007. Washington University in St. Louis. All Rights Reserved.

This file is part of PDB2PQR.

PDB2PQR is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

PDB2PQR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with PDB2PQR; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

----------------------------

Functions [hide private]
  setID(time)
Given a floating point time.time(), generate an ID.
  logRun(options, nettime, size, ff, ip)
Log the CGI run for data analysis.
  cleanTmpdir()
Clean up the temp directory for CGI.
  getQuote(path)
Get a quote to display for the refresh page.
  printProgress(name, refreshname, reftime, starttime)
...
  printAcceptance(name)
Print the first message to stdout (web browser) - set the refresh to the <id>-tmp.html file.
  getLoads()
Get the system load information for output and logging Returns loads: A three entry list containing the 1, 5, and 15 minute loads.
  createResults(header, input, name, time, missedligands=[])
Create the results web page for CGI-based runs Parameters header: The header of the PQR file (string) input: A flag whether an input file has been created (int) tmpdir: The resulting file directory (string) name: The result file root name, based on local time (string) time: The time taken to run the script (float) missedligands: A list of ligand names whose parameters could not be assigned.
  createError(name, details)
...
  startServer(name)
Start the PDB2PQR server.

Variables [hide private]
  __date__ = '17 March 2007'
  __author__ = 'Todd Dolinsky'
  LOCALPATH = '/export/home/www/html/pdb2pqr/'
The relative path to results directory from script directory.
  TMPDIR = 'tmp/'
The maximum size of temp directory (in MB) before it is cleaned
  LIMIT = 500.0
The path to the web site *directory*
  WEBSITE = 'http://agave.wustl.edu/pdb2pqr/'
The name of the main server page
  WEBNAME = 'server.html'
The stylesheet to use
  STYLESHEET = 'http://agave.wustl.edu/css/baker.css'
The refresh time (in seconds) for the progress page
  REFRESHTIME = 20
The absolute path to the loadavg file - set to "" or None if not to be included
  LOADPATH = '/proc/loadavg'
The path to the pdb2pqr log - set to "" or None if not to be included.
  LOGPATH = '/export/home/www/html/pdb2pqr//tmp//usage.txt'

Function Details [hide private]

setID(time)

source code 

Given a floating point time.time(), generate an ID.
Use the tenths of a second to differentiate.

Parameters
    time:  The current time.time() (float)
Returns
    id  :  The file id (string)

logRun(options, nettime, size, ff, ip)

source code 

Log the CGI run for data analysis.  Log file format is as follows:

DATE  FF  SIZE  OPTIONS   TIME

Parameters
    options: The options used for this run (dict)
    nettime: The total time taken for the run (float)
    size:    The final number of non-HETATM atoms in the PDB file (int)
    ff:      The name of the ff used
    ip:      The ip address of the user

cleanTmpdir()

source code 
Clean up the temp directory for CGI. If the size of the directory is greater than LIMIT, delete the older half of the files. Since the files are stored by system time of creation, this is an easier task.

getQuote(path)

source code 

Get a quote to display for the refresh page.
Uses fortune to generate a quote.

Parameters:
    path:   The path to the fortune script (str)
Returns:
    quote:   The quote to display (str)

printProgress(name, refreshname, reftime, starttime)

source code 

Print the progress of the server

Parameters
    name:        The ID of the HTML page to write to (string)
    refreshname: The name of the HTML page to refresh to (string)
    reftime:     The length of time to set the refresh wait to (int)
    starttime:   The time as returned by time.time() that the run started (float)

printAcceptance(name)

source code 

Print the first message to stdout (web browser) - set the
refresh to the <id>-tmp.html file.

Parameters
    name:    The ID of the HTML page to redirect to (string)

getLoads()

source code 

Get the system load information for output and logging

Returns
    loads:  A three entry list containing the 1, 5, and
            15 minute loads. If the load file is not found,
            return None.

createResults(header, input, name, time, missedligands=[])

source code 

Create the results web page for CGI-based runs

Parameters
    header: The header of the PQR file (string)
    input:   A flag whether an input file has been created (int)
    tmpdir:  The resulting file directory (string)
    name:    The result file root name, based on local time (string)
    time:    The time taken to run the script (float)
    missedligands: A list of ligand names whose parameters could
             not be assigned. Optional. (list)

createError(name, details)

source code 

Create an error results page for CGI-based runs

Parameters
    name:    The result file root name, based on local time (string)
    details: The details of the error (string)

startServer(name)

source code 

Start the PDB2PQR server.  This function is necessary so
that useful information can be displayed to the user - otherwise
nothing would be returned until the complete run finishes.

Parameters
    name:    The ID name of the final file to create (string)
Returns
    pqrpath: The complete path to the pqr file (string)


Variables Details [hide private]

__date__

None
Value:
'17 March 2007'                                                        
      

__author__

None
Value:
'Todd Dolinsky'                                                        
      

LOCALPATH

The relative path to results directory from script directory. The web server (i.e. Apache) MUST be able to write to this directory.
Value:
'/export/home/www/html/pdb2pqr/'                                       
      

TMPDIR

The maximum size of temp directory (in MB) before it is cleaned
Value:
'tmp/'                                                                 
      

LIMIT

The path to the web site *directory*
Value:
500.0                                                                 
      

WEBSITE

The name of the main server page
Value:
'http://agave.wustl.edu/pdb2pqr/'                                      
      

WEBNAME

The stylesheet to use
Value:
'server.html'                                                          
      

STYLESHEET

The refresh time (in seconds) for the progress page
Value:
'http://agave.wustl.edu/css/baker.css'                                 
      

REFRESHTIME

The absolute path to the loadavg file - set to "" or None if not to be included
Value:
20                                                                    
      

LOADPATH

The path to the pdb2pqr log - set to "" or None if not to be included. The web server (i.e. Apache) MUST be able to write to this directory.
Value:
'/proc/loadavg'                                                        
      

LOGPATH

None
Value:
'/export/home/www/html/pdb2pqr//tmp//usage.txt'