Posts tegged as 'Groovy'

Code class: Creating a simple user interface from a script

Apr 12, 2013Tim Dudgeon

In an earlier post we created a script that called out to a RESTful web service that performs a structure search against the ChEMBL database and pulls back results into IJC. It concentrated on how to call a web service, and other parts of the script were left pretty basic, and we said we would come back and improve them later.

The part that we cover here is how to create a simple user interface. In the original script we hard coded the query structure and the similarity score in the script, meaning we would have to edit the script if we ever wanted to use different values. Not very friendly!

Read the more »

Code class: Calling a RESTful web service from Instant JChem

Jan 14, 2013Tim Dudgeon

Data is increasingly becoming available through web services nowadays, and REST is becoming dominant mostly due to its extreme simplicity. This post shows how you can call an external RESTful web service from IJC.

The example uses the ChEMBL REST web services. This is a nice example to use as it deals with chemistry, and is a public service, not needing authentication so we can keep the example simple. See here for more about the ChEMBL web services:

The example script runs a similarity search for a structure you specify against the web service and inserts the resulting structures into an IJC database. They key part that we concentrate on here is how to call the web service and process the response.

Calling a web service in Groovy is really simple, thanks to the HttpBuilder library. But this is not part of IJC so we need to make if available from our script. We do this using Groovy’s Grape function which allows us to ‘Grab’ external libraries from a Maven or Ivy repository. All we need is one line of code to do this and then we can import the RESTClient class:

@Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.5.2')
Read the more »

Code class: Utilizing event hooks in Instant JChem for drill-down and data pivots

Nov 30, 2012Erin Bolstad

One of the most common needs for analyzing biological data in relation to chemical structures is to be able to “drill down” through a summarized or minimal table, in order to get all of the underlying biological data. Our example is based around the Wombat data set included with Instant JChem (when making a local database with demo data). Under the ‘Wombat (compound view)’ data tree, you will see a form labelled ‘Wombat (compound view)’. This form contains selected activity data for each compound – The type of assay, the target, value, and species/tissue. However, the child table WOMBAT.ACT.LIST has extensive data on each assay: min and max values, SwissProt ID, receptor family, the radioligand of binding, nonspecific binding, and so on. While this is too much data to present in the simplified form, this data would be good to have on hand, and easily accessible. This is where the drill-down script comes in. Of course if you were using this you might use a completely different approach for obtaining the drill down data, such as retrieving it from an external database or web service.

Drill-down pop-up in the Wombat (Compounds View) form

Read the more »