Wednesday, April 15, 2009

Bioclipse2 Scripting #3: XLogP calculatation using a XMPP CDK cloud service

In preparation of the CDK workshop next week, here is a small Bioclipse2 script to calculate the XLogP value for a given SMILES, using the a CDK-based XMPP service:
// connect to the XMPP hive
xmpp.connect();
// we are going to call the XLogP function of the descriptor service
service = xmpp.getService("descriptor.ws1.bmc.uu.se");
service.discoverSync(5000);
service.getFunctions();
f = service.getFunction("XLogP");
// we use Bioclipse to create a CML document, starting from a SMILES
smiles = "COC";
propane = cdk.fromSMILES(smiles);
js.clear();
js.print("Molecule SMILES: " + smiles + "\n");
result = f.invokeSync(propane.getCML(), 900000);
cmlReturned = xmpp.toString(result);
// convert the returned CML into CMLXOM and extract the value
propertyList = cml.fromString(cmlReturned);
xlogp = propertyList.getPropertyElements().get(0).
getScalarElements().get(0).getValue()
js.print("XLogP: " + xlogp + "\n")


Earlier in this series:

Multiple inheritence for content types?

Bioclipse is an environment for handling and processing life sciences data. This data is present in files with a wide variety of formats, each of which can contain a particular data type. For example, a we can have a single molecule in MDL molfile and in CML.

The latter is particularly interesting, as I do not know how to work that out... Firstly, I want the CML (Single Molecule) content type extend the CML content type, so that a validating CML editor can open it with the proper schema, but at the same time I would like to extend it a content type representation a Single Molecule. Hence, the multiple inheritance.

This is what the plugin.xml currently looks like:
<extension
point="org.eclipse.core.runtime.contentTypes">

<content-type
base-type="net.bioclipse.contenttypes.cml"
id="net.bioclipse.contenttypes.cml.singleMolecule2d"
name="CML (Single 2D Molecule)"
priority="high">
<describer class="net.bioclipse.cml.contenttypes.CmlFileDescriber">
<parameter
name="dimension"
value="2D"/>
<parameter
name="cardinality"
value="single"/>
</describer>
</content-type>

</extension>
Very clearly, a single base-type. Is there any option of multiple inheritance?

Tuesday, April 14, 2009

Bioclipse: a powerful Jmol application

While Bioclipse is much more, it could be an interesting alternative to the Jmol application. It offers:
  • a scripting console
  • a file browser (the Eclipse way)
  • an outline of the file content which allows selections
  • a script editor
The underlying RCP toolkit has many other interesting features for a Jmol application, but the above is up and running: