Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save egonw/107499 to your computer and use it in GitHub Desktop.

Select an option

Save egonw/107499 to your computer and use it in GitHub Desktop.
// connect to the XMPP hive
xmpp.connect();
// we are going to call the generate3Dcoordinates function of the descriptor service
service = xmpp.getService("cdk.ws1.bmc.uu.se");
service.discoverSync(5000);
service.getFunctions();
// we use Bioclipse to create a CML document, starting from a SMILES
smiles = "COC(Br)(F)C";
mol = cdk.fromSMILES(smiles)
js.clear()
js.print("Molecule SMILES: " + smiles + "\n");
// first: add explicit hydrogens
f = service.getFunction("addExplicitHydrogens");
result = f.invokeSync(mol.getCML(), 900000);
mol = cdk.fromCml(xmpp.toString(result));
// second: calculate 3d coordinates
f = service.getFunction("generate3Dcoordinates");
result = f.invokeSync(mol.getCML(), 900000);
cmlReturned = xmpp.toString(result);
// convert the returned CML into CMLXOM and extract the value
mol3d = cdk.fromCml(cmlReturned);
file = "/Virtual/foo.cml";
ui.remove(file)
cdk.saveCML(mol3d, file);
ui.open(file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment