Hi,

InChI generation should work with either implicit or explicit hydrogens.

It looks like there's a bug in the passing of aromatic bonds from CDK to
InChI (do I remember correctly that CDK's aromaticity handling get adjusted
a couple of years ago?).  Anyway, delete lines 294-295 from InChIGenerator
should fix the things.

https://github.com/egonw/cdk/blob/master/src/main/org/openscience/cdk/inchi/InChIGenerator.java#L294:
if (bond.getFlag(CDKConstants.ISAROMATIC)) {
* *order = INCHI_BOND_TYPE.ALTERN;

I haven't got CDK on my machine at the moment, so it would be quicker for
someone else to makes the changes.

Cheers,

Sam


On 4 September 2011 07:39, Nina Jeliazkova <[email protected]>wrote:

>
>
> On 4 September 2011 09:25, Egon Willighagen <[email protected]>wrote:
>
>> cc:Sam (author of the CDK-InChI bridge)
>>
>> On Sun, Sep 4, 2011 at 7:52 AM, Nina Jeliazkova
>> <[email protected]> wrote:
>> > This usually happens, when the molecule does not contain explicit
>> > hydrogens.
>>
>> I was not aware of that. Doesn't sound very useful. We don't have a
>> unit test for this yet, right? That tests for InChI generation for a
>> compound with and without explicit hydrogens, do we?
>>
>> Does this happen for any compound?
>>
>
> Aromatics only.
>
> I came into this issue only recently, when working on metabolite generation
> in Toxtree, haven't tested on a large scale.
>
>
>>
>> > e.g. the test below fails with exactly the same message : "Accepted
>> unusual
>> > valence(s): C(3); Cannot process aromatic bonds"
>> >  SmilesParser p = new
>> > SmilesParser(NoNotificationChemObjectBuilder.getInstance());
>> >  IMolecule mol = p.parseSmiles("CN1C=NC2=C1C(=O)N(C(=O)N2C)C");
>> > /*
>> > CDKHydrogenAdder ha =
>> >
>> CDKHydrogenAdder.getInstance(NoNotificationChemObjectBuilder.getInstance());
>> > ha.addImplicitHydrogens(mol);
>> > AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol);
>> > */
>> >  InChIGeneratorFactory factory = InChIGeneratorFactory.getInstance();
>> >  InChIGenerator gen = factory.getInChIGenerator(mol);
>> >  INCHI_RET ret = gen.getReturnStatus();
>> >  if (ret != INCHI_RET.OKAY) {
>> >       throw new Exception(String.format("InChI failed: %s [%s]",
>> > ret.toString(),gen.getMessage()));
>> >  }
>> >  String inchi = gen.getInchi();
>> >
>>  
>> Assert.assertEquals("InChI=1S/C8H10N4O2/c1-10-4-9-6-5(10)7(13)12(3)8(14)11(6)2/h4H,1-3H3",
>> > inchi);
>>
>> I'll try to use this to create a unit test. I'll also make one for
>> methane... wondering how widespread this issue is...
>>
>
> Alkanes work fine.
>
> Nina
>
>
>>
>> > Uncomment the hydrogen adder code and the test will succeed.
>> > I haven't investigated whether the explicit H requirement is the normal
>> > InChI behaviour or something in the cdk-inchi interaction, perhaps
>> others
>> > could help.  Otherwise, I agree the current behaviour is not quite
>> > convenient.
>>
>> Sam, do you know what is going on?
>>
>> 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
>>
>
>
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> Cdk-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
>
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to