John
Thanks for that. Adding implicit hydrogens does indeed resolve the problem.
But does this mean that for formats like this you MUST add IMPLICIT
hydrogens everywhere (there's no way for them to be explicit)? That's ugly!
Tim
On 21/06/2016 19:04, John M wrote:
SMILES, InChI, Molfile have explicit valence models and thus their
hydrogens are set automatically on read. For other formats you need to
add them. The CDK doesn't do this by valence counting but rather
through more expensive atom typing. Very clunky:
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
CDKHydrogenAdder.getInstance(mol.getBuilder()).addImplicitHydrogens(mol);
If someone can point at the Tripos Mol2 valence model, am happy to add
it. Should be easy right as they encode the atom types in the format?
John
Regards,
John W May
john.wilkinson...@gmail.com <mailto:john.wilkinson...@gmail.com>
On 21 June 2016 at 17:22, Tim Dudgeon <tdudgeon...@gmail.com
<mailto:tdudgeon...@gmail.com>> wrote:
I'm having difficulty reading Mol2 format files. Code is:
def is = new FileInputStream("../../data/testfiles/ligand.mol2")
def reader = new Mol2Reader(is)
def file = reader.read(new ChemFile())
def mol = ChemFileManipulator.getAllAtomContainers(file).get(0)
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol)
def out = new ByteArrayOutputStream()
def writer = new SMILESWriter(out)
writer.writeAtomContainer(mol)
println new String(out.toByteArray())
The file appears to be a valid mol2 format file, but when I try to
write it out as smiles it blows up with:
java.lang.NullPointerException: One or more atoms had an undefined
number of implicit hydrogens
at
com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229)
at org.openscience.cdk.smiles.CDKToBeam.toBeamAtom(CDKToBeam.java:195)
at
org.openscience.cdk.smiles.CDKToBeam.toBeamGraph(CDKToBeam.java:145)
at
org.openscience.cdk.smiles.SmilesGenerator.create(SmilesGenerator.java:369)
at
org.openscience.cdk.smiles.SmilesGenerator.create(SmilesGenerator.java:325)
at
org.openscience.cdk.io.SMILESWriter.writeAtomContainer(SMILESWriter.java:179)
What am I missing?
Tim
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park
in San
Francisco, CA to explore cutting-edge tech and listen to tech
luminaries
present their vision of the future. This family event has
something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net <mailto:Cdk-user@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/cdk-user
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user