Forums | Mahara Community

Developers /
'Instant' 2D and 3D Chemistry Plugins


Geoff Rowland's profile picture
Posts: 108

17 May 2011, 13:21

Here are another couple of blocktype plugins to allow 'instant' visualisation of 2D and 3D chemical structures in Mahara.

They both rely on the remarkable Chemical Identifier Resolver service developed by the Computer-Aided Drug Design (CADD) Group of the Chemical Biology Laboratory (CBL), National Cancer Institute (NCI), National Institute of Health (NIH) located at NCI-Frederick.

http://cactus.nci.nih.gov/chemical/structure


The first Chem 2D NIH (chemnih) plugin returns a Gif image of the 2D structure of any meaningful chemical search term. Valid search terms include a trivial chemical name, systematic (e.g. IUPAC) chemical name, SMILES, InChI or InChIKey. You can set the height and width of the block. You can also select whether the structure is shown in skeletal format (without explicit carbon atom labels or hydrogen atoms) or a fully displayed structure (with all atoms and atom labels).

So, just type in an appropriate term (e.g. ethanol, morphine, buckyball, Cl/C=C\Cl) and you get an (almost) instant image of the 2D structure.

The second Jmol NIH (jmolnih) plugin returns a Structure Data File (sdf) containing 3D cordinates that are rendered by the awesome Jmol Java applet.

http://jmol.sf.net


To avoid security issues with remote file access by the unsigned Java applet, the file contents are read via PHP into a string variable which is then loaded by Jmol. Ugly, but it works!

As with the Chem 2D NIH plugin, you can set the height and width as it appears in a View.

For more advanced Jmol users, there are a couple of textarea controls that allow you to:
 
1. Specify an optional Jmol startup script to customise initial display of the applet
http://chemapps.stolaf.edu/jmol/docs/

2. Enter optional Jmol.js JavaScript commands to add custom commands below the applet
http://jmol.sourceforge.net/jslibrary/

Default script values are applied for general use

Note that development has focused on the functionality of this, and there may be security implications of running these scripts. Happy to receive advice and guidance from Mahara security gurus about this.


Installation

Both plugins can be downloaded from Github

https://github.com/geoffrowland/mahara-blocktype_chemnih

https://github.com/geoffrowland/mahara-blocktype_jmolnih

On unpackging, the /chemnih and /jmolnih folders (and their contents) are simply copied into the /blocktype folder of your Mahara installation

For the /jmolnih plugin you also need to download and unpack the latest Jmol stable version (currently 12.0.43), rename the unpacked folder (e.g. /jmol-12.0.43) to /jmol and copy this (and its contents) into the /lib folder of your Mahara installation to give /lib/jmol. Not all the contents of the jmol folder are actually required. However, Jmol code is frequently updated so it is convenient to just replace the /jmol folder with the latest version.

Finally, visit your Site Administration > Plugin Administration page to enable the plugins.

Of course, for the /jmolnih plugin, you will need an up-to-date Java installation on the client computer
http://www.java.com

During configuration and initial display of the Jmol applet in a view, you may have to refresh the browser.

The plugins can be used alongside each other in a Mahara View to allow comparison of 2D and 3D chemical structures. I hope this plugin will help both science teachers and students to put together resources and presentations. For example, it should allow the easy construction of 'Molecule of the Month' type resources in Mahara.

http://www.chm.bris.ac.uk/motm/motm.htm


In the near future, we intend to release some variants of the Jmol plugin to display local structure files (pdb, mol, cif, xyz, sdf cml etc) and directly display biological macromolecules from the RSCB Protein Data Base (PDB) service and mineral crystal structures from the Crystallography Open Database (COD)

http://www.pdb.org
http://www.crystallography.net/

I'll also put together some demo pages and add entries to the Mahara Wiki pages over the next few days/weeks.

Enjoy

Geoff

Kristina Hoeppner's profile picture
Posts: 4717

19 May 2011, 0:46

Hello Geoff,

Thank you for posting your plugins and also linking them on the wiki page for plugins.

Cheers

Kristina

anonymous profile picture
Account deleted
Posts: 2

02 July 2011, 16:05

Hi Geoff,

I have installed yoy plugins following your instructions with care, but only Chem2D is working. First, it seem that the database table "artefact_file_mime_types" must be modified to add the requierd mimetypes.

Jmol NIH only present a line with the name of the compound as a link to a text page with structure data

The Jmol plugin in shows an EMPTY square. The applet is not being loaded. (positive test working  when using pdb.org site)

I am working with mahara 1.3.6

¿Any idea of what's broken?

Geoff Rowland's profile picture
Posts: 108

03 July 2011, 9:56

Hi Enrique

Jmol NIH and Chem2D should not need additional mime-types as these feed the remote file contents into Mahara without storage.

The Jmol plugin does need the database table 'artefact_file_mime_types' to be updated. This should happen if you follow the instructions on the wiki

https://wiki.mahara.org/index.php/Plugins/Blocktype/Jmol

However, you may also have to increase (e.g. + 1) the $config->version value in /artefact/file/version.php, then visit the admin page to force the database update (I will add this instruction to the wiki)

OK I have now just got the same symptoms as you (empty square) with the latest Jmol version 12.0.46. On reverting to Jmol 12.0.43, things work as expected. So, try using an older version of Jmol from:

http://sourceforge.net/projects/jmol/files/Jmol/Version%2012.0/

I'll investigate further as to what has changed between Jmol versions.

Also, be aware that the NIH NCI/CADD Chemical Identifier Service (cactus.nci.nih.gov/chemical/structure) is still in development and occasionally goes off-line. It's actually offline at the time of this post

The fall-over behaviour of the plugin could probably be improved for this. I'm also hoping that the Chemical Identifier Resolver service will eventually be mirrored. Alternatively, it may be possiible to build in redundancy in through additional connections to similar services such as PubChem and Chemspider

Hope that helps

Geoff

Geoff Rowland's profile picture
Posts: 108

03 July 2011, 11:23

Update...

From a quick test Jmol-12.0.43 (and earlier) works fine with the Mahara plugins

Later versions (12.0.44, 12.0.45 and 12.0.46) do not work

So, for the time being, use Jmol-12.0.43

http://sourceforge.net/projects/jmol/files/Jmol/Version%2012.0/Version%2012.0.43/

I'll investigate further...

Geoff Rowland's profile picture
Posts: 108

04 July 2011, 2:49

Robert Hanson, the lead Jmol developer, has identified the bug in Jmol.js. The next Jmol version (12.0.47) should have a fix.

http://www.mail-archive.com/[email protected]/msg17394.html

Enrique, Thanks for the 'heads up'.

Geoff

6 results