Hi,
On 3 September 2011 22:21, Susur Kicěk <[email protected]> wrote:
> Hi, does CDK InChi generator perceive atom valency in molecule
> differently from other parts of the
> kit?
> Problem is, I can read and process molecule, get atom valency, but when
> I try to generate InChi, it
> gives ERROR : Accepted unusual valence(s): C(3); N(4); Cannot process
> aromatic bonds
>
This usually happens, when the molecule does not contain explicit
hydrogens.
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);
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.
Best regards,
Nina
> even though when iterating through atoms and using getValency() returns
> C valency: 4 | C valency: 4 | C valency: 4 | C valency: 4 | C valency: 4
> | C valency: 4 | N valency: 3 | C valency: 4 | N valency: 3 | O valency:
> 2 | C valency: 4 | C valency: 4 | C valency: 4 | C valency: 4 | C
> valency: 4 | C valency: 4 | O valency: 2 | O valency: 2 | N valency: 3 |
> O valency: 2 | C valency: 4 | C valency: 4 | C valency: 4 | C valency: 4
> | C valency: 4 | O valency: 2 |
>
>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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