Bob,

Very nice, thanks!

I still have a problem on first load, and I assume this has to do with the 
async load of inchi.js. The page is trying to do stuff before inchi.js is fully 
loaded, so it breaks until reload. For what I have in mind, I don’t think this 
is going to be a problem. I simply want to try to implement inchi.js as an 
alternate inchi resolver. For the most part, the model kit does not use 
Resolver for sdf’s. The whole point is that the users make/study models from 
fairly common starting models.  PubChem is an excellent source for these, and 
PubChem is the default model load in the model kit.

I don’t want to put the weight of inchi.js on/in the model kit, so my plan is 
to load a separate tab via a “Load Inchi Resolver” button. I’ll then have the 
model kit “talk” to this tab/window via a local storage call back system - i.e. 
addEventListener. With this approach, inchi.js should have plenty of time to 
finish its load before it’s called into use, at least I hope so.

For reasons that I won’t go into here, non-stereo inchi’s are important to me - 
more so than stereo inchi's. With this inchi.js addition, I potentially have 
this all on board in the browser:

Jmol model 3d sdf ----> JME 2d sdf ----> inchi.js page inchi ----> Google, 
NIST, and other (via Google) web searches.

If it works, very nice, indeed, Bob.

Otis

--
Otis Rothenberger
o...@chemagic.org
http://chemagic.org

> On Mar 10, 2016, at 12:13 AM, Robert Hanson <hans...@stolaf.edu> wrote:
> 
> It turned out to be just a really bad taxol file. inchi.js is working 
> perfectly -- provided it is given a decent file! Test is updated at 
> http://chemapps.stolaf.edu/jmol/jsmol/inchi.htm 
> <http://chemapps.stolaf.edu/jmol/jsmol/inchi.htm>
> 
> On Tue, Mar 8, 2016 at 6:55 PM, Otis Rothenberger <osrot...@icloud.com 
> <mailto:osrot...@icloud.com>> wrote:
> Hi Phil,
> 
> I had convinced myself that the problem was timing related to all the async 
> stuff going on, but I think Bob is correct. There's a problem is the 
> inchi.js. Whatever problem the 2D taxol is creating, the main issue to me is 
> catching this type of problem and exiting gracefully.
> 
> Bob, I see Noel O'Boyle had a big hand in this also. He's mister Twirlymol, 
> and another great cheminformstic blogger - AKA Noel O'Blog! I'll try them 
> both.
> 
> By the way, inchi.js is running locally for me. For some reason that 
> surprised me. I really like the idea of Jmol speaking SMILES and InChI, so I 
> hope this all works out.
> 
> Otis
> 
> Sent from my iPad
> 
> On Mar 8, 2016, at 7:11 PM, J. Bays <pb...@saintmarys.edu 
> <mailto:pb...@saintmarys.edu>> wrote:
> 
>> Just a question. Taxol is pretty a complex structure. Are you able to 
>> calculate and load others of equal complexity without crashing? Perhaps the 
>> error occurs in the calc part. 
>> 
>> J. Philip Bays
>> Emeritus Professor of Chemistry
>> Saint Mary's College
>> Norte Dame, IN
>> 
>> Sent from my iPad
>> 
>> On Mar 8, 2016, at 6:22 PM, Otis Rothenberger <osrot...@icloud.com 
>> <mailto:osrot...@icloud.com>> wrote:
>> 
>>> Bob,
>>> 
>>> I'm using the approach on github. The molfile and the calculated inchi are 
>>> in globals per their suggestions. For testing, I set the globals to "" 
>>> before each model load. This led to erroneous matches at the taxol break - 
>>> i.e. "" == "". 
>>> 
>>> I'm seeing all kinds of irratic behavior all related to taxol. Here's 
>>> what's pretty constant:
>>> 
>>> 1) Things work pretty well if you don't load taxol!
>>> 2) Loading taxol results in:
>>> 
>>> a) Taxol works.
>>> b) The next model load works (usually).
>>> c) Any model (usually) breaks it on a third load. Why 3rd load after the 
>>> taxol bomb?
>>> 
>>> 3) The ChemWriter demo at github does not like Taxol either - loaded via 
>>> paste Jmol taxol molfile.
>>> 
>>> 4) When the Jmol page breaks with Taxol (3rd load, go figure), I'm not 
>>> seeing any of the error messages listed in the .mem file. It just breaks.
>>> 
>>> 5) If I wrap the following inchi code (I'm using github suggested code):
>>> 
>>> calc = InChI.fromMolfile(molfile).trim();
>>> 
>>> in a try/catch, I get an error when the taxol related 3rd load break 
>>> happens:
>>> 
>>> type error: undefined is not an object (evaluating "a.stack")
>>> 
>>> I guess I can understand why that taxol molfile breaks the app. It's a 
>>> mess. I'd just like to catch this situation before the 3rd load break 
>>> starts.
>>> 
>>> Oh yeah, the first page load after a cache clear almost always throws an 
>>> error. This does not break the page however. It just means that you don't 
>>> get a page load inchi calculation.
>>> 
>>> Otis
>>> 
>>> Sent from my iPad
>>> 
>>> On Mar 8, 2016, at 3:50 PM, Robert Hanson <hans...@stolaf.edu 
>>> <mailto:hans...@stolaf.edu>> wrote:
>>> 
>>>> huh?
>>>> 
>>>> On Mon, Mar 7, 2016 at 7:17 PM, Otis Rothenberger <osrot...@icloud.com 
>>>> <mailto:osrot...@icloud.com>> wrote:
>>>> Bob,
>>>> 
>>>> Rats! It’s reporting no difference, but there is a difference. This seems 
>>>> to be OK:
>>>> 
>>>> $("#log").html(nci==calc ? "no difference" : "check differences?”);
>>>> 
>>>> Calc seems to be OK. The problem is what’s printed on the screen for calc.
>>>> 
>>>> Otis
>>>> 
>>>> --
>>>> Otis Rothenberger
>>>> o...@chemagic.org <mailto:o...@chemagic.org>
>>>> http://chemagic.org <http://chemagic.org/>
>>>> 
>>>> > On Mar 7, 2016, at 6:33 PM, Otis Rothenberger <osrot...@icloud.com 
>>>> > <mailto:osrot...@icloud.com>> wrote:
>>>> >
>>>> > Bob,
>>>> >
>>>> > I think it may be a timing issue with the function below. When I comment 
>>>> > out the initial JQuery working… html replacements, the page no longer 
>>>> > “locks.” I don’t think it was really locking. I think those html 
>>>> > replacements somehow ran after the subsequent code. Which…
>>>> >
>>>> > makes absolutely no sense to me! Nevertheless, it seems to fix the 
>>>> > problem.
>>>> >
>>>> > function getInChI(app,url) {
>>>> >       //$("#inchi2div").html("working...");
>>>> >       //$("#inchi1div").html("working...");
>>>> >       //$("#log").html("working...");
>>>> >       if (!url) { return; }
>>>> >       nci = Jmol.evaluateVar(jmolApplet0,"show('chemical 
>>>> > stdinchi')").trim();
>>>> >       $("#inchi2div").html(nci + "&nbsp;&nbsp;&nbsp;&nbsp;(from 
>>>> > NCI/CADD)");
>>>> >       calc = 
>>>> > InChI.fromMolfile(Jmol.evaluateVar(jmolApplet0,"write('MOL')")).trim();
>>>> >       $("#inchi1div").html(calc + "&nbsp;&nbsp;&nbsp;&nbsp;(calculated 
>>>> > in JavaScript)");
>>>> >       $("#log").html(nci==calc ? "no difference" : "check differences?");
>>>> > }
>>>> >
>>>> > Otis
>>>> >
>>>> > --
>>>> > Otis Rothenberger
>>>> > o...@chemagic.org <mailto:o...@chemagic.org>
>>>> > http://chemagic.org <http://chemagic.org/>
>>>> >
>>>> >> On Mar 7, 2016, at 4:37 PM, Robert Hanson <hans...@stolaf.edu 
>>>> >> <mailto:hans...@stolaf.edu>> wrote:
>>>> >>
>>>> >> Otis, note that there is a bug there. If you ask for the models in this 
>>>> >> order:
>>>> >>
>>>> >> $taxol
>>>> >> $morphine
>>>> >>
>>>> >> inchi.js seems to hang and just never respond. Something to do with the 
>>>> >> fact that $taxol is pathologically 2D and not 3D. But
>>>> >>
>>>> >> $taxol
>>>> >> $methanol
>>>> >>
>>>> >> works, until you ask for $morphine. Then it hangs.
>>>> >>
>>>> >> Go figure!
>>>> >>
>>>> >>
>>>> >> Bob
>>>> >>
>>>> >>
>>>> >>
>>>> >>
>>>> >
>>>> 
>>>> 
>>>> ------------------------------------------------------------------------------
>>>> Transform Data into Opportunity.
>>>> Accelerate data analysis in your applications with
>>>> Intel Data Analytics Acceleration Library.
>>>> Click to learn more.
>>>> http://makebettercode.com/inteldaal-eval 
>>>> <http://makebettercode.com/inteldaal-eval>
>>>> _______________________________________________
>>>> Jmol-users mailing list
>>>> Jmol-users@lists.sourceforge.net <mailto:Jmol-users@lists.sourceforge.net>
>>>> https://lists.sourceforge.net/lists/listinfo/jmol-users 
>>>> <https://lists.sourceforge.net/lists/listinfo/jmol-users>
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Robert M. Hanson
>>>> Larson-Anderson Professor of Chemistry
>>>> Chair, Department of Chemistry
>>>> St. Olaf College
>>>> Northfield, MN
>>>> http://www.stolaf.edu/people/hansonr <http://www.stolaf.edu/people/hansonr>
>>>> 
>>>> 
>>>> If nature does not answer first what we want,
>>>> it is better to take what answer we get. 
>>>> 
>>>> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>>>> 
>>>> ------------------------------------------------------------------------------
>>>> Transform Data into Opportunity.
>>>> Accelerate data analysis in your applications with
>>>> Intel Data Analytics Acceleration Library.
>>>> Click to learn more.
>>>> http://makebettercode.com/inteldaal-eval 
>>>> <http://makebettercode.com/inteldaal-eval>_______________________________________________
>>>> Jmol-users mailing list
>>>> Jmol-users@lists.sourceforge.net <mailto:Jmol-users@lists.sourceforge.net>
>>>> https://lists.sourceforge.net/lists/listinfo/jmol-users 
>>>> <https://lists.sourceforge.net/lists/listinfo/jmol-users>
>>> ------------------------------------------------------------------------------
>>> Transform Data into Opportunity.
>>> Accelerate data analysis in your applications with
>>> Intel Data Analytics Acceleration Library.
>>> Click to learn more.
>>> http://makebettercode.com/inteldaal-eval 
>>> <http://makebettercode.com/inteldaal-eval>_______________________________________________
>>> Jmol-users mailing list
>>> Jmol-users@lists.sourceforge.net <mailto:Jmol-users@lists.sourceforge.net>
>>> https://lists.sourceforge.net/lists/listinfo/jmol-users 
>>> <https://lists.sourceforge.net/lists/listinfo/jmol-users>
>> ------------------------------------------------------------------------------
>> Transform Data into Opportunity.
>> Accelerate data analysis in your applications with
>> Intel Data Analytics Acceleration Library.
>> Click to learn more.
>> http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140 
>> <http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140>_______________________________________________
>> Jmol-users mailing list
>> Jmol-users@lists.sourceforge.net <mailto:Jmol-users@lists.sourceforge.net>
>> https://lists.sourceforge.net/lists/listinfo/jmol-users 
>> <https://lists.sourceforge.net/lists/listinfo/jmol-users>
> 
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140 
> <http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140>
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net <mailto:Jmol-users@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/jmol-users 
> <https://lists.sourceforge.net/lists/listinfo/jmol-users>
> 
> 
> 
> 
> -- 
> Robert M. Hanson
> Larson-Anderson Professor of Chemistry
> Chair, Department of Chemistry
> St. Olaf College
> Northfield, MN
> http://www.stolaf.edu/people/hansonr <http://www.stolaf.edu/people/hansonr>
> 
> 
> If nature does not answer first what we want,
> it is better to take what answer we get. 
> 
> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
> 
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140_______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to