Hi Neil,

On Tue, Dec 1, 2009 at 4:10 PM, Neil Swainston
<neil.swains...@manchester.ac.uk> wrote:
> /**
>  ...@param inchiterm
>  ...@return ichemobject
>  ...@throws cdkexception
>  */
> private IChemObject getIChemObject( final String inchiTerm
> ) throws CDKException
> {
> return new INChIPlainTextReader( new ByteArrayInputStream(
> inchiTerm.replace( "InChI", "INChI" ).getBytes() ) ).read( new ChemFile()
> ); // Need to replace 'InChI' for 'INChI', unfortunately...
> }

That INChI reader is not for the current IUPAC International Chemical
Identifier, but for an earlier beta version, which explains the
replacement of the prefix you need to do.

Instead, please use the InChIToStructure class.

> I'm wanting to generate BitSets from Inchi strings, but am failing in the
> getIChemObject method. It seems that the reader doesn't like the
> following Inchi string, despite the fact that it came from ChEBI and seems
> to be OK in other applications.

The algorithm between betas and the final InChI library changed; this
may or may not affect the parsing, but your fails seems to support
that thought.

> InChI=1/C3H6N2O4/c4-3(9)5-1(6)2(7)8/h1,6H,(H,7,8)(H3,4,5,9)/t1-/m0/s1/f/h5,7H,4H2
>
> I'm aware that there may be better ways of reading Inchis, but looking at
> the API, this was the best that I can do.

Please let me know if it works with the InChIToStructure class. Its
JavaDoc has a code example.

I guess the IUPAC/NIST Chemical Identifier parser should be removed or
rewritten as IUPAC International Chemical Identifier parser. BTW,
there is a patch/bug report related to this under discussion.

Egon


-- 
Post-doc @ Uppsala University
Homepage: http://egonw.github.com/
Blog: http://chem-bla-ics.blogspot.com/
PubList: http://www.citeulike.org/user/egonw/tag/papers

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to