Hi Ashok,
As Angle and Bob mentioned in their notes, you need to do this in JavaScript.
Here’s a simple function that gets the job done:
function compSmiles(key, ans) {
key = key.replace(/\\/g, '\\\\');
ans = ans.replace(/\\/g, '\\\\');
return Jmol.evaluateVar(jmolApplet0, "'" + key + "'.find('SMILES','" +
ans + "') > 0");
}
It returns true or false. The crazy replace code is needed to deal with the
SMILES \ inside a JavaScript variable!
Otis
--
Otis Rothenberger
o...@chemagic.org
http://chemagic.org
> On Jan 10, 2016, at 11:33 AM, T. Ashok Kumar <ashok.bioinformat...@gmail.com>
> wrote:
>
> I designed a trial webpage to display the console window alone and run the
> script. It works fine. But, I am trying to run the script without the console
> window, and display the output inside the webpage ( like var y = result; and
> document.write(y); )
>
> HTML Source Code:
>
> <!DOCTYPE html>
> <html>
> <head>
> <meta charset="utf-8">
> <title>JSmol Console</title>
> <script type="text/javascript" src="JSmol/JSmol.min.js"></script>
> <script type="text/javascript">
> var x = {
> debug: false,
> color: "white",
> addSelectionOptions: false,
> use: "HTML5",
> j2sPath: "JSmol/j2s",
> jarPath: "JSmol/java",
> jarFile: "JmolAppletSigned.jar",
> isSigned: true,
> serverURL: "JSmol/php/jsmol.php",
> readyFunction: null,
> disableJ2SLoadMonitor: true,
> disableInitialConsole: true,
> allowJavaScript: true
> }
>
> $(document).ready(function() {
> $("#app").html(Jmol.getAppletHtml("jmolApplet0", x));
> Jmol.script(jmolApplet0, 'set antialiasDisplay; load
> JSmol/data/caffeine.mol');
> Jmol.script(jmolApplet0, 'console');
> })
> </script>
> </head>
> <body>
> <div id="app" style="display: none;"></div>
> </body>
> </html>
>
> Script:
>
> smiles1 = "C(=C(C(=N1)C)O)(C(=C1)CO)CO";
> smiles2 = "CC1=NC=C(C(=C1O)CO)CO";
> result = smiles2.find("SMILES", smiles1);
> if(result > 0)
> {
> print "Both SMILES are same.\nScore:" + result;
> }
> else
> {
> print "Both SMILES are different.";
> }
>
>
> --
> T. Ashok Kumar
> Head, Department of Bioinformatics
> Noorul Islam College of Arts and Science
> Kumaracoil, Thuckalay - 629 180
> Kanyakumari District, INDIA
> Mobile:- 00 91 9655307178
> E-Mail: ashok.bioinformat...@gmail.com
> <mailto:ashok.bioinformat...@gmail.com>,
> as...@biogem.org <mailto:as...@biogem.org>
> Website: www.biogem.org
> <http://www.biogem.org/>------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140_______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users