[Jmol-users] Let's Not Forget PubChem

2016-05-09 Thread Otis Rothenberger
I’ve hinted at this before, but Pierluigi’s note gives me cause to be specific: 
Let’s not forget PubChem as a source of data other than 3d coordinates!

Over the years, Jmol has become research and teaching powerful - no VERY 
powerful. Resolver was a logical partner for Jmol because it is also powerful. 
But let’s not forget PubChem. This is particularly true if your teaching 
interests are like mine: Basic general and organic chemistry small molecules. 
In this small molecule situation, many, if not most, molecules of interest are 
going to be in PubChem. So what? Well for one thing, important look-up 
information is curated in PubChem. This is really what Marcus was striving for 
with his name look-up index help request, and this is what resulted in the ill 
fated Volhardt project conducted by two hacks with copies of Volhardt in their 
hands.

Getting PubChem data (e.g. curated calculated IUPAC names) is fast and easy:

http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/JSON?callback=corsPubChempcdM&smiles=CCOCCC

Parsing is a bit of a hassle, but PubChem was exceedingly helpful in this 
regard. Using the above URL, I had to use a server proxy in order to use AJAX. 
I know that’s not true for sdf direct, but in this case with AJAX it is true. 
Fortunately, PubChem supports JSONP, and the above URL becomes:

http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/JSONP?callback=corsPubChempcdM&smiles=CCOCCC

No big deal, it’s sill AJAX. Notice that this is all between Jmol and PubChem 
only via Jmol SMILES.

Points:

1) PubChem IUPAC is db stored, but the data is OpenEye Scientific calculated 
IUPAC.
2) While Resolver does not calculate IUPAC, its does use PubChem lookup, BUT, 
BUT, BUT, Resolver is subject to PubChem usage constraints. These constrains 
are not trivial. No way PubChem (OpenEye) was the source of the query data from 
Resolver below (all upper case IUPAC). This is from Markus’ aforementioned 
index - not PubChem:

 https://cactus.nci.nih.gov/chemical/structure/CCC/iupac_name

3) The PubChem proxy route was unacceptable because PubChem black lists. With 
JSONP, each user is querying PubChem independent of your app and server.

Bottom Line: In my opinion, there is no question that PubChem IUPAC (and some 
other identifiers) SMILES —> Data queries could be more useful than Resolver to 
some Jmol users. There, I said it!

The data extraction from the JSONP above is tricky because these PubChem data 
files are not consistent from compound to compound. You must, therefore, 
iterate through the data in a loop to cherry pick what you want. If anyone 
wants this extraction code, I’d be happy to post it. It’s not lengthy code.

Otis


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


--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Let's Not Forget PubChem

2016-05-09 Thread Robert Hanson
On Mon, May 9, 2016 at 4:30 PM, Otis Rothenberger 
wrote:

> I’ve hinted at this before, but Pierluigi’s note gives me cause to be
> specific: Let’s not forget PubChem as a source of data other than 3d
> coordinates!
>
> Over the years, Jmol has become research and teaching powerful - no VERY
> powerful. Resolver was a logical partner for Jmol because it is also
> powerful. But let’s not forget PubChem. This is particularly true if your
> teaching interests are like mine: Basic general and organic chemistry small
> molecules. In this small molecule situation, many, if not most, molecules
> of interest are going to be in PubChem. So what? Well for one thing,
> important look-up information is curated in PubChem. This is really what
> Marcus was striving for with his name look-up index help request, and this
> is what resulted in the ill fated Volhardt project conducted by two hacks
> with copies of Volhardt in their hands.
>
> Getting PubChem data (e.g. curated calculated IUPAC names) is fast and
> easy:
>
>
> http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/JSON?callback=corsPubChempcdM&smiles=CCOCCC
>
> Parsing is a bit of a hassle,



...I don't think so. JSON is a subset of Jmol scripting.



*$ x =
eval(load("http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/JSON?callback=corsPubChempcdM&smiles=CCOCCC
"))$
print x.PC_Compounds[1].props.select("(value) where urn.label='IUPAC
name'")..1.sval*
1-ethoxypropane


*$ print x.PC_Compounds[1].props.select("(value) where
urn.label='InChI'")..1.sval*
InChI=1S/C5H12O/c1-3-5-6-4-2/h3-5H2,1-2H3

*$ print
x.PC_Compounds[1].props.select("(urn,value)").select("label,name,fval,sval,ival")*

 {
"ival"  :  1
   }
  {
"label"  :  "Compound"
"name"  :  "Canonicalized"
   }
  {
"fval"  :  19.9
   }
  {
"label"  :  "Compound Complexity"
   }
  {
"ival"  :  1
   }
  {
"label"  :  "Count"
"name"  :  "Hydrogen Bond Acceptor"
   }
  {
"ival"  :  0
   }
  {
"label"  :  "Count"
"name"  :  "Hydrogen Bond Donor"
   }
  {
"ival"  :  3
   }
  {
"label"  :  "Count"
"name"  :  "Rotatable Bond"
   }
  {
   }
  {
"label"  :  "Fingerprint"
"name"  :  "SubStructure Keys"
   }
  {
"sval"  :  "1-ethoxypropane"
   }
  {
"label"  :  "IUPAC Name"
"name"  :  "Allowed"
   }
  {
"sval"  :  "1-ethoxypropane"
   }
  {
"label"  :  "IUPAC Name"
"name"  :  "CAS-like Style"
   }
  {
"sval"  :  "1-ethoxypropane"
   }
  {
"label"  :  "IUPAC Name"
"name"  :  "Preferred"
   }
  {
"sval"  :  "1-ethoxypropane"
   }
  {
"label"  :  "IUPAC Name"
"name"  :  "Systematic"
   }
  {
"sval"  :  "1-ethoxypropane"
   }
  {
"label"  :  "IUPAC Name"
"name"  :  "Traditional"
   }
  {
"sval"  :  "InChI=1S/C5H12O/c1-3-5-6-4-2/h3-5H2,1-2H3"
   }
  {
"label"  :  "InChI"
"name"  :  "Standard"
   }
  {
"sval"  :  "NVJUHMXYKCUMQA-UHFFFAOYSA-N"
   }
  {
"label"  :  "InChIKey"
"name"  :  "Standard"
   }
  {
"fval"  :  1.3
   }
  {
"label"  :  "Log P"
"name"  :  "XLogP3-AA"
   }
  {
"fval"  :  88.08881
   }
  {
"label"  :  "Mass"
"name"  :  "Exact"
   }
  {
"sval"  :  "C5H12O"
   }
  {
"label"  :  "Molecular Formula"
   }
  {
"fval"  :  88.14818
   }
  {
"label"  :  "Molecular Weight"
   }
  {
"sval"  :  "CCCOCC"
   }
  {
"label"  :  "SMILES"
"name"  :  "Canonical"
   }
  {
"sval"  :  "CCCOCC"
   }
  {
"label"  :  "SMILES"
"name"  :  "Isomeric"
   }
  {
"fval"  :  9.2
   }
  {
"label"  :  "Topological"
"name"  :  "Polar Surface Area"
   }
  {
"fval"  :  88.08881
   }
  {
"label"  :  "Weight"
"name"  :  "MonoIsotopic"
   }


The data extraction from the JSONP above is tricky because these PubChem
> data files *are not consistent from compound to compound*.
>
>
Then you should contact PubChem and get them to fix that.

Bob
--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Let's Not Forget PubChem

2016-05-09 Thread Otis Rothenberger
Bob,

They know it! They are the ones who pointed this out to me after my 
conventional JSON extraction failed on some compounds. They explained the 
necessity of this type of loop to me:

var p = data.PC_Compounds[0].props;
pubCid = data.PC_Compounds[0].id.id.cid;
for (var i = 0; i < p.length; i++) {
if (p[i].urn.label == "SMILES" && p[i].urn.name == "Isomeric") 
{pubSmi = p[i].value.sval;}
if (p[i].urn.label == "InChI" && p[i].urn.name == "Standard") 
{pubInchi = p[i].value.sval;}
if (p[i].urn.label == "InChIKey" && p[i].urn.name == 
"Standard") {pubInchiKey = p[i].value.sval;}
if (p[i].urn.label == "IUPAC Name" && p[i].urn.name == 
"Systematic") {pubName = p[i].value.sval;}
}

I definitely got the impression that the compound to compound variation was by 
design. If not by design, then it must be related to the evolution of their 
system. Either way, they definitely know about it.

Otis

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

> On May 9, 2016, at 7:16 PM, Robert Hanson  wrote:
> 
> Then you should contact PubChem and get them to fix that.

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Let's Not Forget PubChem

2016-05-09 Thread Robert Hanson
ps; adding

info = eval("JSON",x)

much faster JSON parsing than just eval(x);


On Mon, May 9, 2016 at 6:39 PM, Otis Rothenberger 
wrote:

> Bob,
>
> They know it! They are the ones who pointed this out to me after my
> conventional JSON extraction failed on some compounds. They explained the
> necessity of this type of loop to me:
>
> var p = data.PC_Compounds[0].props;
> pubCid = data.PC_Compounds[0].id.id.cid;
> for (var i = 0; i < p.length; i++) {
> if (p[i].urn.label == "SMILES" && p[i].urn.name == "Isomeric") {pubSmi =
> p[i].value.sval;}
> if (p[i].urn.label == "InChI" && p[i].urn.name == "Standard") {pubInchi =
> p[i].value.sval;}
> if (p[i].urn.label == "InChIKey" && p[i].urn.name == "Standard")
> {pubInchiKey = p[i].value.sval;}
> if (p[i].urn.label == "IUPAC Name" && p[i].urn.name == "Systematic")
> {pubName = p[i].value.sval;}
> }
>
> I definitely got the impression that the compound to compound variation
> was by design. If not by design, then it must be related to the evolution
> of their system. Either way, they definitely know about it.
>
> Otis
>
> --
> Otis Rothenberger
> o...@chemagic.org
> http://chemagic.org
>
> On May 9, 2016, at 7:16 PM, Robert Hanson  wrote:
>
> Then you should contact PubChem and get them to fix that.
>
>
>
>
> --
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data
> untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> ___
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> 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


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
--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Let's Not Forget PubChem

2016-05-09 Thread Otis Rothenberger
OK, I promise I’ll drop this subject after this note!

I put together a quick and dirty head to head JSME SMILES to IUPAC competition 
between Resolver and PubChem. I simply added PubChem IUPAC to Peter Ertl’s 
Resolver IUPAC test page:

http://chemagic.org/molecules/jsme9.htm

Don’t go bonkers with fast JSME drawing because you can break it! There are 
back to back AJAX calls, and with JSME’s AfterStructureModified callback, you 
can send out multiple AJAX calls real fast. Recalling that Resolver will go to 
PubChem for an IUPAC within the subset of PubChem that Resolver uses, the demo 
is an interesting study of this process.

If you use the single bond tool to slowly draw a convoluted alkane, I think you 
will find the Resolver usually throws up it’s hands first. For fun, I have 
PubChem reporting other ID’s. The Resolver results are in the JSME info window. 
The PubChem results are on the page under the JSME app.

For a real head to head competition treat, simply draw one cyclobutane ring, or 
one cyclooctane ring, or one cyclopenta-1,3-diene ring, or oct-1-yne, or 
spiro[2.2]pentane...

I’m just "sayin"

Otis

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

> On May 9, 2016, at 8:25 PM, Robert Hanson  wrote:
> 
> ps; adding
> 
> info = eval("JSON",x)
> 


--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Let's Not Forget PubChem

2016-05-09 Thread Otis Rothenberger
Already I break my promise!

Please note that I built a 1 second delay into the PubChem call. PubChem is not 
as slow as my page suggests. I’m just trying to keep enthusiastic fast drawing 
users from exceeding PubChem's 3 request per second red flag. This would not be 
a problem in a click to get the name app that uses this approach.

Otis

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

> On May 10, 2016, at 12:31 AM, Otis Rothenberger  wrote:
> 
> OK, I promise I’ll drop this subject after this note!

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users