Hi,
Sorry to have to revisit the old implicit/explicit hydrogen thing again, but
I can't quite wrap my brain around it.
I'd like to take an InChI string and return an IMolecule that has all the
hydrogens set explicitly. The code I have so far is below. Unfortunately it
doesn't work properly.
It would appear that the atomtyping returns sp3 hybridisation for all the
carbon atoms and so too much hydrogen is added.
Would someone be kind enough to identify what's missing/wrong?
Thanks,
Alex
(using cdk-1.5.0.git.jar downloaded and built today)
String
inchi="InChI=1S/C6H8O6/c7-1-2(8)5-3(9)4(10)6(11)12-5/h2,5,7-10H,1H2/t2-,5+/m0/s1";
// ascorbic acid C6H8O6
StringReader ins = new StringReader(inchi);
INChIPlainTextReader reader = new INChIPlainTextReader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new
ChemFile());
IChemSequence seq = chemFile.getChemSequence(0);
IChemModel model = seq.getChemModel(0);
IMoleculeSet moleculeSet = model.getMoleculeSet();
IMolecule molecule = moleculeSet.getMolecule(0);
CDKAtomTypeMatcher matcher =
CDKAtomTypeMatcher.getInstance(molecule.getBuilder());
for (IAtom atom : molecule.atoms()) {
IAtomType type = matcher.findMatchingAtomType(molecule, atom);
AtomTypeManipulator.configure(atom, type);
}
CDKHydrogenAdder adder =
CDKHydrogenAdder.getInstance(molecule.getBuilder());
adder.addImplicitHydrogens(molecule);
AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule);
int atomCount = molecule.getAtomCount(); // should be 20 but returns
24
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user