String smi = "[O-][N ](c1c(N(CC)CCCC)c([N ]([O-])=O)[14cH2]c(C(F)(F)F)c1)=O"; IAtomContainer mol = new SmilesParser(SilentChemObjectBuilder.getInstance()).parseSmiles(smi); mol = AtomContainerManipulator.copyAndSuppressedHydrogens(mol); System.out.println(SmilesGenerator.absolute().create(mol));
causes
Exception in thread "main" org.openscience.cdk.exception.CDKException: An InChI could not be generated and used to canonise SMILES: null
at org.openscience.cdk.smiles.SmilesGenerator.inchiNumbers(SmilesGenerator.java:509)
at org.openscience.cdk.smiles.SmilesGenerator.labels(SmilesGenerator.java:477)
at org.openscience.cdk.smiles.SmilesGenerator.create(SmilesGenerator.java:380)
at org.openscience.cdk.smiles.SmilesGenerator.create(SmilesGenerator.java:330)
..
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.openscience.cdk.smiles.SmilesGenerator.inchiNumbers(SmilesGenerator.java:502)
... 5 more
Caused by: org.openscience.cdk.exception.CDKException: Could not generate InChI Numbers: Unknown element(s): *
at org.openscience.cdk.graph.invariant.InChINumbersTools.auxInfo(InChINumbersTools.java:235)
at org.openscience.cdk.graph.invariant.InChINumbersTools.getUSmilesNumbers(InChINumbersTools.java:77)
... 10 more
cdk version is 1.5.10 not 1.0 (cannot change ticket anymore)
Actually I don't think that's a bug.. In your input you have '[N ]' which is loaded a pseudoatom '*' or 'R'. InChI does not support pseudo atoms so nothing we can do for now.
Just to check can you print the isomeric SMILES - should have a '*' in it? Where is the input from?
John
Sorry, you are completly right, the original input was
[O-]N+c(N+=O)[14cH2]c(C(F)(F)F)c1)=O
The plus-characters got lost when posting to our web-services...
Awesome - I do have prototypes for a better canonicaliser that will do stereo (we have to use InChI for now) and allow pseudo atoms. Okay to close?