Monday, 9 May 2011

(Almost) Translate the InChI code into JavaScript

If you follow Rich Apodaca's Signals blog (for example), you will be aware that more and more chemistry applications are being implemented in JavaScript. Wouldn't it be nice to be able to take an existing Java or C++ cheminformatics library and convert it to JavaScript?

Well, guess what - in Oct of last year, a project appeared called emscripten that will do just that for C/C++. So without further ado, let's convert the InChI code.

Actually, maybe it'd make more sense to begin with "Hello World":
#include <stdio.h>

int main()
{
   printf("Hello World!\n");
   return 0;
}
To start with, compile llvm, clang, spidermonkey and v8 as described in the install instructions.

Then convert to javascript as follows:
#!/bin/sh
LLVM_BINDIR=~/Tools/llvm-2.9/cbuild/Release/bin
EMSCRIPTEN=~/Tools/emscripten-git
V8=~/Tools/v8-repo

$LLVM_BINDIR/clang hello.c -o hello
$LLVM_BINDIR/clang hello.c -S -emit-llvm

$LLVM_BINDIR/llvm-as hello.s
$LLVM_BINDIR/llvm-dis hello.s.bc -show-annotations

# Run emscripten
$EMSCRIPTEN/emscripten.py hello.s.ll $V8/d8 > hello.js

# Run the Javascript using v8
$V8/d8 hello.js
After some trivial edits to the code, we can run hello.js in the browser.

Part II shows my attempt to repeat this procedure with the InChI code.

Sunday, 8 May 2011

MIOSS - Open Source in Chemistry workshop

I'm just back from the EBI where I participated in a Wellcome Trust workshop "Molecular Informatics Open Source Software", organised by Mark Forster of Syngenta. I gave a talk on Cinfony (slides to follow), while fellow Open Babel developers Tim Vandermeersch and Chris Morley spoke about Open Babel.

What a great meeting.

It was 50% Open Source Software developers, and 50% pharma industry. Or so I thought at the start. It quickly became apparent that the scientists from pharma were also developing or supporting open source software through a variety of methods. Rajarshi's excellent overview gives a list of some of the talks from industry in this space. I will be following up some of these over the next while.

Of the projects from academia, some which were new to me were Bio-Linux (bio-focused Linux distro available on request as bootable USB sticks from NERC [one of the UK research agencies] - especially useful for teaching), ChemT (GUI for chemical library generation), MOLA (use USB sticks to turn a typical computer lab into a cluster for running AutoDock jobs), and OpenStructure (somewhat similar to PyMol).

The workflow softwares Taverna and KNIME are both doing well. Taverna is widely adopted in the bioinformatics community, while KNIME has considerable mindshare in pharma. An interesting aspect of Taverna is that workflows can be stored at http://myexperiment.org, and users can combine other workflows with full attribution. KNIME now has nodes for RDKit and Indigo (as well as most commercial vendors), toolkits which should be familiar to regular readers here.

Silicos now has several open source offerings for library design and general computer-aided drug design: Sieve (filtering on properties), Pharao (pharmacophore alignment), Piramid (shape-based alignment), Stripper (extract molecular scaffolds according to a variety of schemes), Spectrophores (3D fingerprint for QSAR). An interesting development is the ProfiLib web application which returns a PDF that characterises an uploaded molecular library (in SDF form).

There may be some outcomes from this meeting over the next while, so stay tuned...

Sunday, 1 May 2011

Questions for On-line Cheminformatics Tutorial

Some time ago I set up an on-line cheminformatics tutorial based on the "Try Python" software of Michael Foord (see my blog post for details).

When a reader mentioned in passing that he found this tutorial useful for introducing people to cheminformatics concepts, it made me realise that it might actually be useful for something. And so, when I had to put together a practical on the subject of Cheminformatics a few weeks ago, I decided to use this tutorial as the basis. I had the students go through the tutorial and answer a series of questions based around each of the three main chapters (Introduction to Cinfony, Descriptors, and Fingerprints).

Does anyone have any suggestions for other cheminformatics practicals?

Notes: This is Windows and Mac only. "Try Python" should (but does not) run on Linux under Moonlight. The problem was reported to the Moonlight devs back in 2009.

Monday, 18 April 2011

Last chance to apply to attend Open Babel users' workshop

Apply before Apr 22nd to attend the 2nd Open Babble, a hands-on Open Babel workshop presented by Open Babel developers Chris Morley, Tim Vandermeersch and Noel O'Boyle. This will take place on July 5-6 2011 at the Unilever Centre in the Dept of Chemistry, University of Cambridge, UK.

This is the first ever users' workshop for Open Babel, one of the most widely used cheminformatics toolkits. Open Babble presents a unique opportunity to learn how to make the most of Open Babel, whether you are interested in using for converting file formats, writing scripts to analyse molecular structures, or developing your own chemistry software.

The workshop will start on the afternoon of the 5th July, and finish on the evening of the 6th. The exact topics covered will depend on the attendees’ interests but will include some or all of the following:
  • Exploiting the Open Babel command line for fast searching and filtering of molecular databases
  • How to get the most from the Open Babel GUI
  • Getting started with Python scripting for chemistry
  • Compiling C++ programs that use Open Babel
  • Writing a new plugin for Open Babel
  • How to create a user-defined molecular fingerprint
  • Combining Open Babel with other Open Source cheminformatics toolkits

To apply, see the workshop website.

Thursday, 14 April 2011

Review of Data Analysis with Open Source Tools

A little while ago, I reviewed Gnuplot in Action by Philipp Janert. One of the aspects of that book that I liked the most was the inclusion of more general discussions about data analysis and appropriate methods.

Now Philipp has published a book where those discussions are the focus, and the software is mentioned in passing. Data Analysis with Open Source Tools was published in January 2011 by O'Reilly.

I got my hands on a review copy and gave it a write-up in Journal of Cheminformatics:
...This is a real practitioner's book. Janert, a former physicist and software engineer, is a consultant in data analysis and mathematical modelling. He has taken his hard-won knowledge and tried to get it all down on paper for the reader's benefit. For example, in a chapter with the provocative title of "What you really need to know about classical statistics" he explains why introductory statistics textbooks seem to cover methods and topics at odds with the problems data analysts deal with day-to-day; essentially classical methods were developed at a time of small and expensive datasets and no computational power, and hypothesis testing focused on determining whether an effect existed. Today we have ample computing power and may be dealing with very large datasets; also, we are usually more interested in the size of an effect (practical significance) rather than just whether it exists (statistical significance)...

To read the full review, head on over to J. Cheminf. 2011, 3:10.

Tuesday, 12 April 2011

Playing GAMESS with Avogadro and wxMacMolPlt

I've put together a tutorial to show how to setup, run and analyse basic QM calculations using Avogadro, GAMESS and wxMacMolPlt (respectively). It is aimed at complete beginners to QM calculations (although with a basic knowledge of the theory).

You can check it out here.

The topics covered are:
  • Install required software
  • Looking at GAMESS output
  • Molecular orbitals of water
  • Vibrational frequencies of water
  • Effect of basis set
  • Conformations of a cyclohexane
Contributions to additional tutorials or suggestions for improvement are most welcome.

Monday, 4 April 2011

PyRx - AutoDocking made simple

I recently presented an AutoDock tutorial at the EBI based around PyRx 0.8, an impressive GUI for AutoDock and Vina by Sargis Dallakyan. It worked out very well, and a big thanks to James Watson from the EBI who helped install all the software. While PyRx still has a few rough edges, it is an order of magnitude easier to use than the existing AutoDock GUI AutoDockTools (although the latter allows more fine-grained control).

We followed the 2010 PyRx tutorial (PyRx2010_rvsnALP_7122010.pdf) available from http://pyrx.scripps.edu/SI/2010/. You will also need the 3D.sdf from that location. You may also want to download sample.tar.gz.

The following notes describe how to get everything set up on Windows:
(1) Download AutoDock 4.2. When installing, install to "C:\Program Files (x86)\AutoDock" not C:\Windows\system32 as suggested.
(2) Download and install PyRx 0.8. This installs to "C:\Program Files (x86)\PyRx".
(3) Replace the appropriate file in "C:\Program Files (x86)\PyRx\Lib\site-packages\PyRx" with importWizard.py, dbPlot.py and autodockNavigator.py.
(4) Have everyone start PyRx (there should be a shortcut on the desktop, else run PyRx.bat) and under Edit/Preferences set the location of AutoDock to "C:\Program Files (x86)\AutoDock\autodock.exe" (they can just browse to the folder and file), and similarly for AutoGrid. If they did this properly, the "Local" radiobutton in the bottom of the AutoDock Wizard tab should be available. They should choose this during the docking.

It should then be possible to work through the tutorial without problems. The tutorial involves docking a single molecule with AutoDock, then running a virtual screen with Vina (I recommend only choosing 5 molecules unless you have lots of time on your hands).

Note that pdbqt files, configuration files and such are saved into C:\Users\MyName\.mgltools\PyRx, if you want to have a look. You can delete this folder to reset PyRx. And all of this software should work equally well on Mac and Linux, although I haven't tested this.