## Tuesday, December 19, 2006

### Chemistry in HTML: Greasemonkey again

Here's a quick update on my blog about SMILES, CAS and InChI in blogs: Greasemonkey last sunday. The original download was messed up :( You can download a new version at userscripts.org.

This new version also supports "chem:compound", for any chemical. For example:
• isopropyl alcohol

Remember that it only works for properly marked up content, as described in Including SMILES, CML and InChI in blogs. The HTML source code of the above example looks like (in RDFa):
<ul><li><span xmlns:chem="http://www.blueobelisk.org/chemistryblogs/"      class="chem:compound">isopropyl alcohol</span></li></ul>

The current script only adds search links to PubChem and Google, but the possibilities are endless, and potentially very powerfull. Here are some future ideas.

A link to predict NMR spectra using NMRShiftDB.org:

Making a link to the NMRShiftDB.org website to predict
13C or 1H NMR from a SMILES, and InChI likely too, is easy, if the website provides a URL to do this. (I will discuss this with Stefan.)

A popup window with the 3D structure in Jmol:

This would involve some more work, but this most certainly possible too, given that we actually have a website around which allows downloading 3D coordinates given a SMILES or InChI. While a simple approach would be to make a popup with Jmol that takes the URL to that 3D coordinate website, it could be extended using Ajax to query the 3D structure first, and depending on success, show Jmol or a message "Could not find 3D coordinates".

Summarize molecular details hidden in CML:

This is likely the most exiting possibility. I blogged about CMLRSS many times now (check the AVI, the article, etc), and combining these two technologies will take the semantic, chemistry internet to the next level. CMLRSS describes how CML can be embedded in blog items (e.g. Blogging chemistry on blogspot.com), but really works for any XHTML.

Consider this mockup: add CML content to your blog item, containing molecular properties, such as it's NMR peaks, elemental analysis, etc. This will not show up in your blog item, so that the user is not bothered with implementation details. Now, a userscript will now about the CML content, as it has access to the whole content of the page. The visible text will mention the molecule for which CML contains experimental or other details. Using the <span class="chem:compound"/> technology shown above, it is possible to link that compound to this CML bit (details to follow in this blog in January 2007). The userscript will then on the fly create a popup for the compound name in the visible text to show those experimental details.

Server side scripts:

Greasemonkey allows users to decide which scripts to run on a website, and which not. If you, as blogger or XHTML editor, want to force a script like the above to be run, that should be possible too. Greasemonkey scripts are written in JavaScript, so including them on the server side should be possible too. I might explore this option soon too.

1. I think the server side only ability is a great idea! I've been playing with this idea of using the onclick attribute in the -span- tag to call a function that will whisk you to the pubchem database. But, now I'll just wait until you finish yours. :)

Mitch

2. Tipping my hat into the ring: http://www.chemicalforums.com/index.php?topic=12120.0

Mitch

3. Mitch, the script is available as server side too now. Read my blog item about it at:

http://chem-bla-ics.blogspot.com/2007/01/chemistry-in-html-javascript-from.html

4. Okay, I'll play with it and then bug you with some more questions about it. ;)

Mitch

5. Mitch, yes please do! Us chemoinformaticians need lab-chemists to use the tools, so we need to talk on how that can best be done.

6. Hi, with a lil bit of hacking and a handy behaviour script, I've managed to make your script work with Kuskus (Konqueror UserScript)

Here it is: