On Fri, May 8, 2009 at 5:36 PM, Loren Lenzen <[email protected]> wrote:
> My fault, I did not mean ID tags.  I was referring to the data fields that
> come after the structural information.  For example:
>
>>  <Vendor>
> Sigma
>
> I know I can get them by looking for the regex, but I assumed that the
> MDLReaders would already have a method to do that.

Ah, ic.

Well, those property fields are part of the MDL SD file format, not of
the MDL molfile format.

So, you should read a IChemFile, and not a IMolecule (1.2.0 introduced
the SDFWriter, and I think I will have to introduce a SDFReader too...
would make things easier to understand...)

Here is a relevent unit test:

        String filename = "data/mdl/emptyStructure.sdf";
        logger.info("Testing: " + filename);
        InputStream ins =
this.getClass().getClassLoader().getResourceAsStream(filename);
        MDLV2000Reader reader = new MDLV2000Reader(ins);
        ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
        Assert.assertNotNull(chemFile);
        List<IAtomContainer> containersList =
ChemFileManipulator.getAllAtomContainers(chemFile);
        Assert.assertEquals(1, containersList.size());

        IAtomContainer container = containersList.get(0);
        Assert.assertNotNull(container);
        Assert.assertEquals(0, container.getAtomCount());
        Assert.assertEquals(0, container.getBondCount());


        Map<Object,Object> props = container.getProperties();
        Set<Object> keys = props.keySet();

        Assert.assertTrue(keys.contains("SubstanceType"));
        Assert.assertTrue(keys.contains("TD50 Rat"));
        Assert.assertTrue(keys.contains("ChemCount"));

Where the SD file property sections looks like:

>  <SubstanceType>
mixture or unknown

>  <ChemNote>
unknown composition

>  <ChemCount>
1

>  <StudyType>
carcinogenicity

>  <Species>
rat

>  <Endpoint>
TD50, Tumor Target Sites

>  <TD50 Rat>
NP

I hope this helps.

Egon

-- 
Post-doc @ Uppsala University
http://chem-bla-ics.blogspot.com/

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to