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:

No comments:

Post a Comment