Hi,
I am very new to cdk and also new to java. I want to use cdk to calculate
molecular descriptors like LopgP, TPSA , Ring Count , Rotatable bonds etc
and am evaluating its pluggability into some existing java code .
To learn the API I wrote a quick script to print the Descriptor names and
the calcuated values. It is very kludgy since I still think in "Python" and
"Scripting" ways. The script pasted below can get the calculation of the
descriptors to work for a molecule like aspirin just fine, but when I give
it something more complex like gleevec, the code run from inside netbeans
keeps running without any output or error.
Any suggestions on what I am doing thats causing this behavior.
Thanks in advance
Hari
(Code adapted from Rajarshi Guhas snippets and a post on cdk mailing list by
Tobias)
My quick example is pasted here ( also at http://dpaste.com/386138/)
import java.util.Iterator;
import java.util.Map;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.exception.InvalidSmilesException;
import org.openscience.cdk.*;
import org.openscience.cdk.smiles.*;
import org.openscience.cdk.qsar.*;
import org.openscience.cdk.qsar.DescriptorSpecification;
public class MyDescriptorCalcExample {
public static void main(String[] args){
SmilesParser smilesParser = new
SmilesParser(DefaultChemObjectBuilder.getInstance());
String smiles =
"CC1=C(C=C(C=C1)NC(=O)C2=CC=C(C=C2)CN3CCN(CC3)C)NC4=NC=CC(=N4)C5=CN=CC=C5.CS(=O)(=O)O";
String aspirin = "CC(=O)OC1=CC=CC=C1C(=O)O"
DescriptorEngine engine = new
DescriptorEngine(DescriptorEngine.MOLECULAR);
org.openscience.cdk.interfaces.IMolecule molecule = null ;
try {
molecule = smilesParser.parseSmiles(smiles);
System.out.println(molecule.toString());
}
catch (InvalidSmilesException e) {
// TODO Auto-generated catch block
}
try {
engine.process(molecule);
}
catch (CDKException e) {
e.printStackTrace();
// TODO Auto-generated catch block
}
Map<Object, Object> props = molecule.getProperties();
Iterator<Object> iter = props.keySet().iterator();
// for all calculated descriptors
while (iter.hasNext()){
DescriptorSpecification obj_key = (DescriptorSpecification)
iter.next();
// for debugging
org.openscience.cdk.qsar.DescriptorValue val =
(DescriptorValue) props.get(obj_key);
System.out.print(obj_key.getImplementationTitle());
System.out.println(" Value:" + val.getValue());
}
}
}
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user