visualize.py :  » Business-Application » PDB2PQR » pdb2pqr-1.6 » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Business Application » PDB2PQR 
PDB2PQR » pdb2pqr 1.6 » visualize.py
#!@WHICHPYTHON@
"""
    Displays the Jmol input page
"""
print 'Content-type: text/html\n\n'

__date__ = "18 June 2008"
__author__ = "Samir Unni"
__version__ = "0.0.1"

from src.aconf import *
import cgi, cgitb, pickle, urllib, os, glob

cgitb.enable()
form = cgi.FieldStorage()

def initVars():
    #global serviceURL

    if not form.has_key("jobid"):
        pass # add code to redirect to PDB2PQR input page here
    else:
        jobid = form['jobid'].value

        #aspFile = open('./tmp/%s/%s-asp' % (logTime, logTime))
        #appServicePort = pickle.load(aspFile)
        #aspFile.close()

        #jobInfoFile = open('./tmp/%s/%s-jobinfo' % (logTime, logTime))
        #jobID = jobInfoFile.read()
        #jobInfoFile.close()

        aoFile = open('%s%s%s/%s-ao' % (INSTALLDIR, TMPDIR, jobid, jobid))
        apbsOptions = pickle.load(aoFile)
        aoFile.close()

        if APBS_OPAL_URL!="":
            from AppService_client import AppServiceLocator,getOutputsRequest
            apbsOpalJobIDFile = open('%s%s%s/apbs_opal_job_id' % (INSTALLDIR, TMPDIR, jobid))
            apbsOpalJobID = apbsOpalJobIDFile.read()
            apbsOpalJobIDFile.close()
            
            appLocator = AppServiceLocator()
            resp = appLocator.getAppServicePort(APBS_OPAL_URL).getOutputs(getOutputsRequest(apbsOpalJobID))
            if not os.access('%s%s%s' % (INSTALLDIR, TMPDIR, jobid), os.F_OK):
                os.mkdir('%s%s%s' % (INSTALLDIR, TMPDIR, jobid))
            for file in resp._outputFile:
                fileName = file._name
                if fileName!="Standard Output" and fileName!="Standard Error":
                    urllib.urlretrieve(file._url, '%s%s%s/%s' % (INSTALLDIR, TMPDIR, jobid, fileName))

        return apbsOptions


def main(apbsOptions):
    cgiFile = "jmol.cgi"
    cgiName = "thisform"
    defaultVisType = "jmol"
    checkJmolType = True
    cssFile = 'pdb2pqr.css'
    jobid = form['jobid'].value

    print '<html>'
    print '\t<head>'
    print '\t\t<title>Visualization Configuration</title>'
    print '\t\t<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">' % cssFile
    print '\t</head>'
    print '\t<body>'
    print '\t\t<h3>Visualization Configuration</h3>'
    print '\t\t<form action=\"%s\" method=\"post\" enctype=\"multipart/form-data\" name=\"%s\" id=\"%s\">\n' % (cgiFile, cgiName, cgiName)
    print '\t\tSelect the type of visual representation:'
    print '\t\t<ul>'
    print '\t\t\t<input type=\"radio\" name=\"vistype\" value=\"jmol\"',

    if defaultVisType == "jmol":
        print ' checked=\"checked\"',
    print '/> <a href=\"http://jmol.sourceforge.net/\" target=\"_blank\">Jmol</a> <a href=\"http://jmol.sourceforge.net/docs/\" target=\"_blank\"><font title=\"Jmol documentation\">(<span class=\"tooltip\">?</span>)</font></a>'
    print '\t\t<br />'
    print '\t\t<ul>'
    print '\t\t\t<li>Select the type of display:'
    print '\t\t\t\t<ul>'
    if apbsOptions['writePot']:
        print '\t\t\t\t\t<input type=\"radio\" name=\"jmoltype\" value=\"pot\"',
        if checkJmolType:
            print ' checked=\"checked\"',
            checkJmolType = False
        print '/>Electrostatic Potential'
        print '\t\t\t\t\t<br />'

    if apbsOptions['writeLap']:
        print '\t\t\t\t\t<input type=\"radio\" name=\"jmoltype\" value=\"lap\"',
        if checkJmolType:
            print ' checked=\"checked\"',
            checkJmolType = False
        print '/>Laplacian of the potential'
        print '<br />'
    if apbsOptions['writeEdens']:
        print '\t\t\t\t\t<input type=\"radio\" name=\"jmoltype\" value=\"edens\"',
        if checkJmolType:
            print ' checked=\"checked\"',
            checkJmolType = False
        print '/>Energy density'
        print '<br />'
    if apbsOptions['writeNdens']:
        print '\t\t\t\t\t<input type=\"radio\" name=\"jmoltype\" value=\"ndens\"',
        if checkJmolType:
            print ' checked=\"checked\"',
            checkJmolType = False
        print '/>Mobile ion number density'
        print '<br />'
    if apbsOptions['writeQdens']:
        print '\t\t\t\t\t<input type=\"radio\" name=\"jmoltype\" value=\"qdens\"'
        if checkJmolType:
            print ' checked=\"checked\"',
            checkJmolType = False
        print '/>Mobile charge density'
    print '\t\t\t\t</ul>'
    print '\t\t\t</li>'
    print '\t\t\t<li>'
    print '\t\t\t\tMinimum color range: <input type=\"text\" name=\"jmolcolormin\" size=4 maxlength=6 value="-5.0"/> kT/e'
    print '\t\t\t</li>'
    print '\t\t\t<li>'
    print '\t\t\t\tMaximum color range: <input type=\"text\" name=\"jmolcolormax\" size=4 maxlength=6 value="5.0"/> kT/e'
    print '\t\t\t</li>'
    print '\t\t</ul>'
    #print '\t\t<input type=\"radio\" name=\"vistype\" value=\"vmd\" disabled/> VMD (currently unavailable)'
    print '\t\t<input type=\"hidden\" name=\"jobid\" value=\"%s\"/>' % jobid
    print '\t\t<input type=\"hidden\" name=\"pqrfilename\" value=\"%s\"/>\n' % apbsOptions['pqrFileName']
    print '\t\t\t\t</ul>'
    print '\t\t\t<input type=\"submit\" value=\"Submit\"/>'
    print '\t\t</form>'

    print '\t<script type="text/javascript">'
    print '\tvar gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");'
    print '\tdocument.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));'
    print '\t</script>'
    print '\t<script type="text/javascript">'
    print '\ttry {'
    print '\tvar pageTracker = _gat._getTracker("UA-11026338-3");'
    print '\tpageTracker._trackPageview();'
    print '\t} catch(err) {}</script>'
    print '\t</body>'
    print '</html>'


main(initVars())
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.