On Fri, May 7, 2010 at 1:27 PM, Rajarshi Guha <rajarshi.g...@gmail.com> wrote: > On May 7, 2010, at 12:32 AM, Egon Willighagen wrote: >> I'd guess you simply have to calculate the number of implicit hydrogens >> first? > > How would I do that?
CDKHydrogenAdder adder = CDKHydrogenAdder.getInstance( NoNotificationChemObjectBuilder.getInstance() ); adder.addImplicitHydrogens(molecule); (but do atom type perception first) >>> But if the corresponding SMILES form is read in, and implcit H's are >>> converted to explicit, H's are added. >> >> SMILES on the other hand *does* specify the number of implicit >> hydrogens (implicitly, of course), but it's part of the standard... so >> the SmilesParser does atom type detection, calculate number of >> implicit hydrogens, and actually aromaticity detection too... > > No, the parser doesn't do aromaticity detection or atom typing. That has to > be done separately Mmmm... this is the code I see in front of me: public IMolecule parseSmiles(String smiles) throws InvalidSmilesException { IMolecule molecule = this.parseString(smiles); // perceive atom types CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); int i = 0; for (IAtom atom : molecule.atoms()) { i++; try { IAtomType type = matcher.findMatchingAtomType(molecule, atom); AtomTypeManipulator.configure(atom, type); } catch (Exception e) { System.out.println("Cannot percieve atom type for the " + i + "th atom: " + atom.getSymbol()); atom.setAtomTypeName("X"); } } this.addImplicitHydrogens(molecule); this.perceiveAromaticity(molecule); return molecule; } Egon -- Post-doc @ Uppsala University Proteochemometrics / Bioclipse Group of Prof. Jarl Wikberg Homepage: http://egonw.github.com/ Blog: http://chem-bla-ics.blogspot.com/ PubList: http://www.citeulike.org/user/egonw/tag/papers ------------------------------------------------------------------------------ _______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user