Sunday, December 17, 2006

SMILES, CAS and InChI in blogs: Greasemonkey

As follow up on my Including SMILES, CML and InChI in blogs blog last week, I had a go at Greasemonkey. Some time ago already, Flags and Lollipops and Nodalpoint showed with two cool mashups (one Connotea/Postgenomic and one Pubmed/Postgenomic) that user scripts are rather useful in science too. I can very much recommend the PubMed/Postgenomic mashup, as PubMed has several organic chemistry journals indexed too!

So, how does this relate to my blog of last week? Well, would it not be nice that if your blog uses the markup as suggested in that blog, that you automatically get links to PubChem and Google? That is now possible with a small GPL-ed Greasemonkey script called blogchemistry.user.js.

The Greasemonkey plugin requires Firefox to be installed. If ready, install the script by clicking this link earlier, and the Greasemonkey will ask you if you want to install the script. After, check the output for this RDFa markup content:
  • a CAS registry number: 50-00-0
  • and an InChI: InChI=1/CH4/h1H4

It should look like the output for this blog item:

Note the superscript PubChem and Google links.

Update: there was something wrong with the download, which I just fixed (19th, at 8:45 CET). Please download once more to get it working properly.


  1. Egon - this is very interesting. Can you provide a bit more info about what to do after the installation of the script. I assume I need to add Google as one of the websites but where do you enter the search terms?

  2. After installing the Greasemonkey plugin, and the script I wrote, you do not need to do anything on the client side. What you would need to do for the UsefulChem blog, is to use the <span> markup as indicated in the blog on including InChI/CAS/SMILES in blogs items a week ago.


    If you can translate [6.6]chiralane, C27H28, into notation and get it back as a molecule then your software is working. It is that rare molecule that does not have a flat graph. Its undistorted tetrahedral chiral center bears four identical groups. HyperChem chiralan.hin supplied on request (e-mail atop linked page, above).

    NIST's commercial sterochemistry software module was quietly rewritten.

  4. Script works like a champ. But, why link to google? Might as well just use pubchem where you can look up the properties you'll be searching google for in the first place.


  5. Noticed pubchem links are missing a closing quotation mark for links generated from SMILES code.


  6. Hi Mitch,

    thanx for replying. Googling for InChI's has the advantage that is it not restricted to one source, though the number of hits is not very high yet. You can turn this on and off in the script by editing the script (via the Greasemonkey script manager), and change

    var useGoogle = 1;


    var useGoogle = 0;

    You are right about that quote, though I had fixed that earlier already. Might you delete the script and install it from this page? :

    Does that solve your problem?

  7. The link to the file on this page is not work

    Can you tell where to get this file?

  8. Macademic... oops. That webpage is indeed down.

    However, it has been replaced by the sechemtic user script I menion here in the comments.

    Hope this helps.