Hello,

ok. Then i try this with java. I do the following:

private void loadMoleculefromFile(String filename){
                try {
                        MDLV2000Reader reader = new MDLV2000Reader(new 
FileReader(new File(filename)));
                        if(reader.read((ChemObject)new ChemFile()) != null){
                                ChemFile chemFile = 
(ChemFile)reader.read((ChemObject)new ChemFile());
                                List<IAtomContainer> containersList = 
ChemFileManipulator.getAllAtomContainers(chemFile);
                                int i=0;
                                for(IAtomContainer a : containersList){
                                        System.out.println(a.toString() + "; " 
+ i + "/" + containersList.size());
                                        i++;
                                }
                        }
                } catch (CDKException e) {
                        e.printStackTrace();
                } catch (FileNotFoundException e) {
                        e.printStackTrace();
                }
                
        }


And call this function with: 

loadMoleculefromFile("query.sdf");

And with:

loadMoleculefromFile("Compound_000000001_000025000.sdf");

With the last call i'll get the printouts. 

The first call of the function works too but throws this exception:

java.lang.NullPointerException
        at 
org.openscience.cdk.io.MDLV2000Reader.readMolecule(MDLV2000Reader.java:395)
        at 
org.openscience.cdk.io.MDLV2000Reader.readChemFile(MDLV2000Reader.java:236)
        at org.openscience.cdk.io.MDLV2000Reader.read(MDLV2000Reader.java:185)
        at Main.loadMoleculefromFile(Main.java:146)
        at Main.<init>(Main.java:45)
        at Main.main(Main.java:41)

This in the 4-line or the 5-line (get the same error).

With the normal MDLReader it doesn't work for both files.

Have you an idea about this exception.

And how could i handle the similarity inside java?

Jochen

Am 22.11.2011 um 10:41 schrieb Egon Willighagen:

> On Tue, Nov 22, 2011 at 10:37 AM, Jochen Schreiber
> <[email protected]> wrote:
>> And i don't know how i could say to momsim.jar use the MDLV2000Reader.
> 
> Neither do I; I don't know that jar. I suggest contacting the author.
> 
> Egon
> 
> 
> -- 
> Dr E.L. Willighagen
> Postdoctoral Researcher
> Institutet för miljömedicin
> Karolinska Institutet (http://ki.se/imm)
> Homepage: http://egonw.github.com/
> LinkedIn: http://se.linkedin.com/in/egonw
> Blog: http://chem-bla-ics.blogspot.com/
> PubList: http://www.citeulike.org/user/egonw/tag/papers

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to