David submitted a bug report saying:
-------
How to loadInline Mol files?
Hi,
I am hoping to use JMOL in a chemi/bioinformatics
application that I am putting together with HTML DB
(from Oracle) and Oracle 10g database. With JMOL I can
display chemical structures alongside assay data and
other chemical Data in rows in reports resulting from
sql queries. I also plan to integrate pdb files of
targets and x-ray structures as well as models of
compounds bound into them with the assay data.
In particular I am interested in using 'loadInline' to
automatically load Molfiles. I seem to be having
troubles with this.
In particular, if I have a textarea with
name="form.textarea" and put the molfile in there I am
able to read it into Jmol applet with :
<INPUT TYPE="button" VALUE="Get mol in Jmol"
onClick="document.jmol.loadInline
(document.form.textarea.value)">
However, this doesn't work within the applet tags:
<applet name="jmol" code="JmolApplet"
archive="JmolApplet.jar" width="350" height="350"
align="left">
<param name="progressbar" value="true">
<PARAM NAME="loadInline"
VALUE="document.form.molfile.value">
</applet>
Any suggestions would be greatly appreciated.
Thank you very much!
David Hecht
Idun Pharmaceuticals
[EMAIL PROTECTED]
----------
David,
I assume that you are using the Jmol v10 beta prerelease ...
You said that you are using:
<PARAM NAME="loadInline"
VALUE="document.form.molfile.value">
the 'value' parameters to an applet do not get evaluated. Rather, the
exact string that you are passing is getting sent to the applet. And the
JmolApplet is trying to interpret "document.form.molfile.value" as the
molecular model file.
Now, the bad news is that the mechanism for loadInline is rather ugly. The
HTML spec specify that newline characters get stripped before they get
passed to an applet. Therefore, the browser removes the newline characters
before they get sent to the applet.
To make up for this, you need to put vertical bar characters at the
beginning of each line ... like this
<applet code="JmolApplet" archive="JmolApplet.jar"
width="400" height="400">
<param name="progressbar" value="true">
<param name="loadInline" value="
|acetic_acid.mol
|
|C4 http://c4.cabrillo.cc.ca.us
| 8 7 0 0 0
| 0.1853 0.0096 0.4587 C 0 0 0 0 0
| 0.6324 1.0432 0.8951 O 0 0 0 0 0
| -1.0665 -0.1512 -0.3758 C 0 0 0 0 0
| 0.7893 -1.1734 0.6766 O 0 0 0 0 0
| -1.7704 -0.8676 0.1055 H 0 0 0 0 0
| -0.8068 -0.5215 -1.3935 H 0 0 0 0 0
| -1.5889 0.8259 -0.4854 H 0 0 0 0 0
| 1.5818 -0.9700 1.2014 H 0 0 0 0 0
| 1 2 2 0 0 0
| 1 3 1 6 0 0
| 1 4 1 0 0 0
| 3 5 1 0 0 0
| 3 6 1 6 0 0
| 3 7 1 0 0 0
| 4 8 1 1 0 0
"
>
</applet>
Note that this .mol file has a vertical bar (pipe) character at the
beginning of each line. I know that it is ugly, but there is nothing we
can do about it.
Since you are reading you stuff from a database, you should be able to do
a character substitution to replace newline characters with vertical bar
characters. You do not need to have both newlines and vertical bars,
because the browser is going to remove the newline characters.
I do not believe that the initial vertical bar character is needed. That
is to say, it should be optional. If you find that it *is* necessary, then
please file a bug report so that I can fix it.
If you are having troubles writing the JavaScript to generate this, then
post a message to [EMAIL PROTECTED] (after joining the list).
I am in the process of writing a JavaScript library which will make all of
this much easier. But for now you need to do it yourself.
Please feel free to post additional questions if/when you run into
difficulties.
Miguel
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Jmol-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-users