Thanks for your help Rajarshi and Thomas  .

The code here is kludgey, but I am beginning to understand how I can get
from here to something that elegantly calculates the descriptors I am
interested in .

Got calcs for two sample descriptors

Code attached

Thanks again

Hari


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;
import org.openscience.cdk.qsar.DescriptorEngine;
import org.openscience.cdk.io.iterator.IteratingMDLReader;
import java.io.*;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.qsar.IMolecularDescriptor;
    public class MyDescriptorCalcExample {
        public static void main(String[] args) throws FileNotFoundException{
            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";
            DescriptorEngine engine = new
DescriptorEngine(DescriptorEngine.MOLECULAR,null);
            org.openscience.cdk.interfaces.IMolecule molecule = null  ;
//            IteratingMDLReader iteratingMDLReader = new
IteratingMDLReader(new BufferedReader(new
FileReader("H:/Netbeans/glevec.sdf")),DefaultChemObjectBuilder.getInstance());
        try {
            molecule = smilesParser.parseSmiles(smiles);
        } catch (InvalidSmilesException ex) {

 Logger.getLogger(MyDescriptorCalcExample.class.getName()).log(Level.SEVERE,
null, ex);
        }

           //     molecule = (IMolecule) iteratingMDLReader.next();
//                System.out.println(molecule.toString());

            IMolecularDescriptor descriptor = new
org.openscience.cdk.qsar.descriptors.molecular.LargestChainDescriptor();
            DescriptorValue retval = descriptor.calculate(molecule);
            System.out.println("LARGESTCHAIN:" + retval.getValue());

            IMolecularDescriptor alogp = null;
        try {
            alogp = new
org.openscience.cdk.qsar.descriptors.molecular.ALOGPDescriptor();
        } catch (CDKException ex) {

 Logger.getLogger(MyDescriptorCalcExample.class.getName()).log(Level.SEVERE,
null, ex);
        }
            DescriptorValue alogp_val = alogp.calculate(molecule);
            System.out.println("ALOGP:" + alogp_val.getValue());



        }
    }


On Mon, Feb 7, 2011 at 6:48 PM, Rajarshi Guha <rajarshi.g...@gmail.com>wrote:

> On Mon, Feb 7, 2011 at 6:41 PM, hari jayaram <hari...@gmail.com> wrote:
>
> > Now that I know it can work , i will try to calculate these using code
>  and
> > the examples you have here : http://rguha.net/code/java/#desc
>
> I should point out that the code out there may be out of date
>
> > I am very rusty with my java so its been slow beginning. Wishing
> > I weren't spoiled by list comprehensions in Python.
>
> Indeed - life sucks without list comprehensions
>
> --
> Rajarshi Guha
> NIH Chemical Genomics Center
>
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to