Hi Jennifer & Otis,

I'm a relatively inexperienced programmer so please treat the following
with caution.  However, FWIW, I use the approach that Otis is recommending
(if I understand him correctly).  Users make selections, ajax is used once
to retrieve all the data relevant to a problem of the appropriate type from
a database (as a JSON object that is easy to work with in Javascript).  The
structures drawn by the user in JSME are then checked by comparison of the
user SMILES from JSME against the correct SMILES, retrieved from the
database with the other problem data, using Jmol (which is in a hidden div
on the page.  As Otis says, Jmol matches different SMILES strings from
different sources as long as the structures are the same.  My site is not
in the wild yet (it is a major upgrade of http://www.ucd.ie/chem/chemint/),
but I would be happy to send the code to you if that would be helpful.

Mike


Dr Mike Casey
School of Chemistry
UCD
Dublin
01 716 2420

On 20 July 2016 at 01:58, Otis Rothenberger <osrot...@icloud.com> wrote:

> Jennifer,
>
> The student SMILES and the answer SMILES need to be compared on the client
> (browser) side via JavaScript. The student answer SMILES is already on the
> client side. All we would need is the answer SMILES there also.
>
> Having said this, I know that Bob H once mentioned running the Java app on
> the server to do server side tasks, but running the Java app on the server
> is way beyond my programming skills.
>
> With the power of modern JavaScript and HTML5, I’m not sure I see why the
> computer jocks are more comfortable with a second hit on the server. The
> fact is that the server cannot do the SMILES comparison as elegantly as
> Bob’s JSmol SMILES comparison, that is unless the Jmol Java App is run on
> the server. With the client side JavaScript/HTML5 power, it seems to me
> going back to the server is just going back to the server in order to go
> back to the server!
>
> All of this, of course, is dependent on getting the answer SMILES into the
> working webpage.
>
> Whichever route you go, that still leaves you with a database with some
> SMILES issues. Here’s a suggestion: How soon is Bob B’s cheminformatics
> course going into action again? Reconstructing your database entirely from
> Resolver (maybe PubChem) by an automated process would be a great real
> world project for one of the student teams. ( cc to Bob B)
>
> Otis
>
> --
> Otis Rothenberger
> o...@chemagic.org
> http://chemagic.org
>
> On Jul 19, 2016, at 8:22 PM, Jennifer L. Muzyka <
> jennifer.muz...@centre.edu> wrote:
>
> Otis,
> What you are describing is essentially how I handle the code for the page
> where students draw the product structure.  It's certainly doable for the
> starting material structure as well.  I would just need to work out the
> different query and JavaScript.  My computer science colleagues would
> probably consider that the brute force method, unlike the more elegant Ajax
> method that goes back and queries the database a second time.  Is there
> some advantage to keeping all of the code within the page rather than going
> back to the database?  Those use PHP and MySQL.
> Jennifer
>
> Sent from my iPad
>
> On Jul 19, 2016, at 6:00 PM, Otis Rothenberger <osrot...@icloud.com>
> wrote:
>
> Jennifer,
>
> On your page, students make several choices to set up a problem. It
> appears that each choice does a GET and reloads the page from sever with
> appropriate page modification. How hard would it be to return the correct
> SMILES on each of these GETS?
>
> Otis
>
> --
> Otis Rothenberger
> o...@chemagic.org
> http://chemagic.org
>
> On Jul 19, 2016, at 4:35 PM, Jennifer L. Muzyka <
> jennifer.muz...@centre.edu> wrote:
>
> Otis,
> Other information in the database includes:  CAS RN, InChI, InChiKey, and
> ChemSpider ID.  I’m aware that the different sources for SMILES is a
> potential issue, having already dealt with that.  I’m also aware that
> compounds can have more than one CAS number and more than one ChemSpider ID
> even though I learned that CAS numbers were unique back when I was in
> college.  An unfortunate reality is that I don’t have all of the keys for
> every compound.  Another potential problem with the database is that I
> might not have removed all of the situations where a single compound
> appeared more than once.  There are other things in the database (gifs,
> pdbs, jcamp spectra) for some compounds.
> Jennifer
>
>
>
>
>
> On Jul 19, 2016, at 4:22 PM, Otis Rothenberger <osrot...@icloud.com>
> wrote:
>
> Jennifer,
>
> The default is that JSME keeps explicit hydrogens to carbon, and these
> will show up in brackets. An option can be used to turn this off.
>
> It sounds like you have a mix of SMILES that may have been created by
> options variations in the JSME implementations being used. That's a problem.
>
> One more question, and then I'll do some more thinking. What other items
> or keys are in the database?
>
> Otis
>
> --
> Otis Rothenberger
> o...@chemagic.org
> http://chemagic.org
>
> On Jul 19, 2016, at 4:01 PM, Jennifer L. Muzyka <
> jennifer.muz...@centre.edu> wrote:
>
> Otis,
> 1200 of the compounds have SMILES that agree with the JSME version.  Those
> were generated by a buddy of mine.  Then when I found some disagreed, I
> went through them one by one to fix the ones that disagree.
>
> The next 3800 came from some other source than JSME when one of my
> students imported the compounds into the database.  Most of those are not
> involved in reactions so those compounds might not be relevant.  I
> anticipate that I would change them one by one if needed so that they agree
> with JSME.  None of those have SMILES that look like the stuff with
> brackets and H’s that JSME produces.  They tend to use the slashes to
> indicate double bond stereochemistry and @ to indicate chirality at
> stereocenters.  (People who are more proficient programmers than I am could
> probably complete the task more rapidly by automating it.)
>
> Now I’m adding new reactions to accompany the question type where students
> draw the starting material rather than the product, I’m adding new
> compounds one by one.  I’m getting the SMILES for each of those compounds
> from the JSME database.
> Jennifer
>
>
>
> On Jul 19, 2016, at 3:51 PM, Otis Rothenberger <osrot...@icloud.com>
> wrote:
>
> Jennifer,
>
> On the student side, Jmol and JSME would be working together. This is no
> big deal - very easy. The problem is server side.
>
> Let me think about this. Some important points: Do your existing database
> SMILES have stereo chemistry - i.e. / \ and @ notation where appropriate?
> Are they all JSME SMILES? Is there a possibility that the database creators
> may have drawn explicit hydrogens on carbon in non-stereo contect?
>
> Otis
>
> --
> Otis Rothenberger
> o...@chemagic.org
> http://chemagic.org
>
> On Jul 19, 2016, at 3:37 PM, Jennifer L. Muzyka <
> jennifer.muz...@centre.edu> wrote:
>
> Otis,
> The SMILES database has about 5000 compounds in it.  I’m  confused about
> how JSmol works here.  Would there be a JSmol drawing interface rather than
> JSME?  I guess I need to go read the Jmol documentation about how to get
> the SMILES stuff working.  Is there some automated process to get the Jmol
> versions of the SMILES to update the database?
> Jennifer
>
>
>
>
> On Jul 19, 2016, at 2:00 PM, Otis Rothenberger <osrot...@icloud.com>
> wrote:
>
> Jennifer,
>
> For the most part,  there is no cross application canonical SMILES.
> Daylight never released the technical details to their reduction to
> canonical algorithm. Consequently, uniqueness exists only within a given
> “copycat” application. I believe PubChem uses Open Eye SMILES. If you were
> comparing Open Eye unique SMILES to Open Eye unique SMILE, you could do a
> simple string comparison.
>
> JSME is top notch in my opinion. I would not use any other online drawing
> software, but with JSME, you cannot have canonical (unique) SMILES AND
> stereochemistry. If you want simple string comparison, both SMILES (sever
> and student drawn) will have to be JSME without E/Z and stereo chemistry.
> I’m almost certain that this has not changed since the "old doc" in the
> previous email. I think this means that you are going to have to use these
> explicit options in server and client JSME SMILE creation: noquery (this is
> default), noautoez, canonize (this is default), nostereo. I’d list all
> explicitly.
>
> This probably not what you actually want, and that’s the absolute beauty
> of what Bob created in JSmol! With Bob’s approach, the cross application
> unique SMILES barriers do not matter. Bob took the expression “unique
> SMILES” and made it obsolete!
>
> To do this (include stereochemistry via Bob’s approach) you will also have
> to make some options selections in JSME, but you will also be able to use
> E/Z and stereochemistry.
>
> How large is your SMILES database?
>
> --
> Otis Rothenberger
> o...@chemagic.org
> http://chemagic.org
>
> On Jul 19, 2016, at 1:23 PM, Jennifer L. Muzyka <
> jennifer.muz...@centre.edu> wrote:
>
> Otis,
> The SMILES goes back to the MySQL database for comparison rather than just
> running JavaScript within the browser.  The stuff in the database was all
> generated with JSME.  (So I’m confused about how adding Jmol to the mix
> will help.)  The “canonical” SMILES generated by JSME sure doesn’t look
> like the canonical SMILES provided in PubChem.  But maybe I’m actually
> getting SMARTS?  I will go read the documentation you have pointed out.
> Jennifer
>
>
>
>
>
>
> On Jul 18, 2016, at 10:56 PM, Otis Rothenberger <osrot...@icloud.com>
> wrote:
>
> Jennifer,
>
> I knew this statement was out there. It took me a while to find the Web
> doc:
>
> "public String JME.smiles()
>
> returns a SMILES string of the current molecule(s) or reaction. For single
> molecule without stereochemistry the SMILES is unique, unification is not
> yet implemented for molecules with stereochemistry and for reactions.”
> http://www.molinspiration.com/jme/doc/jme_functions.html
>
> It’s an old doc, but I’m sure it still applies.
>
> Since canonize is the default in JSME, you’re going to have to select
> nocanonize!
>
> Also, your current option setting sets the “query” option. That sets up
> SMARTS mode. I don’t think that is what you want?
>
> Although it’s commented out in your current HTML, it looks like you are
> set of for a simple string comparison. That’s not going to work. This is
> where Bob’s JSmol .find approach comes into play - my previous email.
>
> I’ve been using a Jmol/JSME SMILES comparison for quite a while, so don’t
> hesitate to ask if you need more specific information.
>
> Otis
>
> --
> Otis Rothenberger
> o...@chemagic.org
> http://chemagic.org
>
> On Jul 18, 2016, at 4:22 PM, Otis Rothenberger <osrot...@icloud.com>
> wrote:
>
> Jennifer,
>
> You have to set SMILES settings in the JSME options part of your JSME
> set-up to invoke stereochemistry and E/Z. This page explains all of the
> options and the set up procedure:
>
> http://peter-ertl.com/jsme/JSME_2015-06-14/doc.html
>
> BUT, BUT,  it looks like you are doing SMILES comparisons, and with
> stereochemistry and E/Z invoked, I’m pretty sure JSME SMILES are not
> unique. The best way to compare SMILES is with JSmol. In the case of your
> page, you could hide JSmol on the page. Comparison can be done in
> JavaScript:
>
> function compSmiles(key, ans) {
> key = key.replace(/\\/g, '\\\\');
> ans = ans.replace(/\\/g, '\\\\');
> return Jmol.evaluateVar(jmolApplet0. "'" + key + "'.find('SMILES','" + ans
> + "') > 0");
> }
>
> My quotes above are hard to read, so here’s the function with spaces to
> emphasis the quotes:
>
> function compSmiles(key, ans) {
> key = key.replace(/\\/g, ' \\\\ ');
> ans = ans.replace(/\\/g, ' \\\\ ');
> return Jmol.evaluateVar(jmolApplet0. " ' " + key + " '.find('SMILES',' " +
> ans + " ') > 0");
> }
>
> The replace statements above are needed to place the SMILES \ notation
> into a JavaScript string - i.e. correct the fact that \ in a character
> escape in JavaScript.
>
> Otis
> --
> Otis Rothenberger
> o...@chemagic.org
> http://chemagic.org
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning
> reports.
> http://sdm.link/zohodev2dev_______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning
> reports.http://sdm.link/zohodev2dev
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to