Freitag, 24. Juni 2011

Jmol 003: Arranging Protein on NW Surface

The below picture was obtained with the following Jmol script.

load 1PDB.pdb
load APPEND nwSurface.xyz
model all
axes on
select protein
boundbox {1.1} on

The protein is surrounded by its boundbox. What I now want is to mark the three of the sides of the bound box, as I indicated with arrows added with paint. Maybe the boundbox and the arrows could also be separate "objects" (?), generated on the fly from the structure.
The point is, now the user could click a radio button indicating that the protein is oriented with its (red/green) face towards the wire. If he is not happy with that, he could click the rotate button, returning the box/protein/ensemble ensemble to be oriented with the (red/blue) face towards the wire (for now rotations by 90° is fine). If it is this orientation he expects (depending maybe on binding sites in the protein) he then would click the red/blue radio button and submit the form. Depending on the selected radio button, the appropriate distance of the center of the box to the wire can be obtained.

After a little trying, the following turned out.
The command used for the red vector is



draw xVec vector {-58.19/2.0, -47.57/2.0, -54.71/2.0} {58.19, 0.0, 0.0} width 5.0 color red

What I now require is to have the vectors rotate together with the protein, so maybe the easiest is to have the vectors be part of the protein structure.

Mittwoch, 22. Juni 2011

Jmol 002: Control over Two Structures

I loaded two structures into a jmolApplet by the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>UI Controls example</title>
<script src="./jmolDir/Jmol.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
jmolInitialize("./jmolDir");
jmolApplet(400, "load 1AVD.pdb;\
load APPEND nwSurface.xyz;\
axes on;\
boundbox on;");
</script><br />
</body>
</html>
This results in the figure below.
A protein structure is placed above an array of carbon atoms which are supposed to illustrate the surface of a nanowire. What I would like to do now is to be able to rotate the protein with respect to the surface (i.e. keeping the surface in the same orientation regarding the indicated coordinate system).
Unfortunately, I dont know how to include Jmol on Blogspot, otherwise I naturally would have included it directly here as well.
The input from Bob Hanson at the Jmol Mailing list is actually pointing me into exactly the correct direction. This script was tested in a local version of Jmol but it should just as well be working in a browser.

load 1PDB.pdb
load APPEND nwSurface.xyz
select protein
set allowRotateSelected True
set dragSelected True

Now using <ALT>+<Left_Mouse> the user can rotate the protein structure without changing the surface and <ALT>+<SHIFT>+<Left_Mouse> to drag the structure over the surface.

Dienstag, 21. Juni 2011

Jmol 001: Loading a Structure File from Disk Through CGI

The function below allow the user to load a structure into a Jmol applet.
#!/usr/bin/python

print "Content-type: text/html\n\n"

import cgi
import cgitb
cgitb.enable()

def getJmolPage(target):
newpage = ''
newpage += '<html>\n'
newpage += ' <head>\n'
newpage += ' <title>Load PDB Form</title>\n'
newpage += ' <script src="./jmolDir/Jmol.js" type="text/javascript"></scri
pt>\n'
newpage += ' </head> \n'
newpage += ' <body> \n'
newpage += ' <script type="text/javascript">\n'
newpage += ' jmolInitialize("./jmolDir");\n'
newpage += ' jmolApplet(400, "load ../x_output/%s.pdb");\n'
newpage += ' </script><br />\n'
newpage += ' </body>\n'
newpage += '</html>\n'

return newpage % (target)

if __name__ == '__main__':
form = cgi.FieldStorage()
target = form['PDBID'].value
print getJmolPage(target)
Note, all HTML code had to be escaped in order to be posted on the blog.

Donnerstag, 16. Juni 2011

Reading

System/Web Programming
File Permissions: Good short summary of dangers in web programming
HTML/JavaScript: Displaying text when clicking on checkbox.
Showing hiding a text field here.
Users on Mac OS X: Difference between wheel and staff.
JavaScript and Numbers.

Science
Ising Model: Derivative of Magnetization, Source, Phase transition
Lipases: Chemical Industry Review.


Dienstag, 14. Juni 2011

PyMOL 004: Illustrating a periodic system

I have enclosed the structure inside a rectangular box. Now I would like to translate it in order to generate the image of a periodic plane.


Using the supercell.py script on the PyMOL wiki, the following figure was generated. The command was
supercell 40,4,1, withmates=1
at the PyMOL prompt.


How can I have little boxes around all proteins?

After aligning all proteins on the surface, the output is the following.