From: Syed A. R. <as...@eb...> - 2008-11-07 16:45:21
|
Hi Egon, It works with MDLV2000Reader as suggested by you but not with MDLReader. I was using MDLReader because the mols which I am handling are mixture of V3 and V2 formats in my Database. Thanks Asad PS: Any suggestion how to automated it (may be its a naive question but the answer will be deeply appreciated :-) ). Egon Willighagen wrote: > On Fri, Nov 7, 2008 at 5:11 PM, Syed Asad Rahman <as...@eb...> wrote: > >> I tried fetching getMassNumber() on two mols by reading MDLReader. But >> unfortunately it fails (gives same result for both) or I am missing >> something. >> >> http://www.ebi.ac.uk/chebi/searchFreeText.do?searchString=37340 >> > > Works for me: > > @Test public void testReadingMISOLines() throws Exception { > String filename = "data/mdl/ChEBI_37340.mol"; > logger.info("Testing: " + filename); > InputStream ins = > this.getClass().getClassLoader().getResourceAsStream(filename); > MDLV2000Reader reader = new MDLV2000Reader(ins, Mode.STRICT); > ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile()); > Assert.assertNotNull(chemFile); > List containersList = > ChemFileManipulator.getAllAtomContainers(chemFile); > Assert.assertEquals(1, containersList.size()); > Assert.assertTrue(((IAtomContainer)containersList.get(0)).getAtomCount() > >> 0); >> > Assert.assertEquals(210, > ((IAtomContainer)containersList.get(0)).getAtom(0).getMassNumber().intValue()); > } > > (commit to cdk1.2.x/ branch pending...) > > Egon > > -- **************************************************************** Syed Asad Rahman (BEngg, PhD) Research Scientist EMBL-EBI Phone:+44-(0)1223-492537 Wellcome Trust Genome Campus Fax:+44-(0)1223 494486 Hinxton CB10 1SD E-mail: as...@eb... Cambridge, UK Home Page: www.ebi.ac.uk/~asad ***************************************************************** |