Jmol Users and CONFCHEM participants:
SUCCESS!!!
A demo of how one might in the near future (today, if you like) use AJAX
in relation to Jmol.
I have adapted Jmol.js
(http://www.stolaf.edu/people/hansonr/jmol/test/proto/Jmol-new.js)
to have one more command option:
jmolLoadRCSB(fileFormat,PDBid,optionalScript,targetSuffix)
All parameters are optional:
fileFormat "CIF" or "PDB"
PDBid a 4-digit PDB id
optionalScript an optional script to run after the file is loaded
targetSuffix the applet suffix (defaults to "0")
You can check this out at:
http://www.stolaf.edu/people/hansonr/jmol/test/proto/altloc.htm
or
http://www.stolaf.edu/people/hansonr/jmol/test/proto/new.htm
or any related page, because they all use
http://www.stolaf.edu/people/hansonr/jmol/test/proto/property.js
to create the page, and I added the link there.
In all cases, that new link just under the applet loads any CIF file at
RCSB into the applet using the command
jmolLoadRCSB("CIF")
[If you don't see the link or it doesn't work, reload the following
links a couple of times and try again:
http://www.stolaf.edu/people/hansonr/jmol/test/proto/Jmol-new.js
http://www.stolaf.edu/people/hansonr/jmol/test/proto/property.js
Sometimes browsers cache JS files a bit more intensively than HTML.]
How DOES it work?
When you click that link and enter a 4-digit PDB id, the new function in
Jmol-new.js sets up a "dynamic DOM script node" that automatically goes
to a computer here at St. Olaf College, fusion.stolaf.edu, and requests
JavaScript just like the request had been entered in a <script
src=http://fusion.stolaf.edu....> tag. When the script returns, it has
the CIF data tucked into a JavaScript array by the name of
_jmol.modelarray along with a call to the processor function,
_jmolLoadModel(), which looks like this:
function _jmolLoadModel(targetSuffix){
_jmolLoadInlineScript(_jmol.modelarray.join("\n"),_jmol.optionalscript,targetSuffix)
}
That's all there is to it. The array is turned into a string ,and the
string is sent to the applet via jmolLoadInlineScript() along with the
optional script you have indicated.
No forms. No cgi-bin. No pop-up windows. Just straight into the applet.
I have no doubt some Mac users will report that this does not work. We
shall see. :)
UNDERSTAND that Jmol-new.js and JmolAppletProto.jar are the only two
files necessary for this to work. The following HTML file will do it. In
fact, just for kicks, this shows how you don't even need Jmol-new.js.
All you need is a copy of
http://www.stolaf.edu/people/hansonr/jmol/test/proto/JmolAppletProto.jar
in the directory containing the file containing this code:
<html>
<head>
<script language="javascript"
src="http://fusion.stolaf.edu/chemistry/jmol/Jmol-new.js"></script>
</head>
<body>
<script language="javascript">
jmolInitialize(".","JmolAppletProto.jar")
jmolApplet(500)
_jmol.RCSBserver = "http://pdb202.sdsc.edu" //temporarily only 4/17/06
</script>
<p>
<a href=javascript:void(jmolLoadRCSB())>Load a model from RCSB</a>
<p>
</body>
</html>
So you could implement this yourself. Today. In fact, if set any page
you already have to use Jmol-new.js and JmolAppletProto.jar, then all
you do is add a link to void(jmolLoadRCSB()), and you, too, can have any
PDB file at your fingertips.
There's nothing special about www.stolaf.edu that makes it the only
machine that can call fusion.stolaf.edu. I just ran this from my hard
drive. I still can't quite believe it works. AJAX is incredible.
Course, my IT people might be looking for the guy who's running up the
CPU on that ColdFusion server.....
How COULD it work?
Realize that we only need fusion.stolaf.edu because RCSB doesn't have an
AJAX-JS interface. If they did, then we could just call them directly
and save routing this though St. Olaf College. This, then, is what I am
hoping to convince molecular structure database managers to do: offer a
JavaScript AJAX-JS interface. It's very easy to set up. Just a little
different packaging of the raw data on the other end, a few choice
functions on the client end.
I'm done for the day. Fine tuning will have to come later.
Bob Hanson
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users