From: Nina J. <ni...@ac...> - 2005-06-22 12:18:24
|
Hi all, I am trying to use org.openscience.cdk.atomtype.HybridizationStateATMatcher. It works nice with recognizing carbons and hydrogens, as parametrized by "org/openscience/cdk/config/data/hybridization_atomtypes.xml". However, I couldn't get it to recognize most of the other atom types listed , for example O, P, S , hallogens and nitrogen (except Nplus.sp3). Below is the test for oxygen with the corresponding debug log. -- test to produce the log above -- protected Molecule getMol() { Molecule mol = new Molecule(); Atom a1 = new Atom("C"); mol.addAtom(a1); Atom a2 = new Atom("C"); mol.addAtom(a2); Atom a3 = new Atom("O"); mol.addAtom(a3); Atom a4 = new Atom("O"); mol.addAtom(a4); Atom a5 = new Atom("H"); mol.addAtom(a5); Atom a6 = new Atom("H"); mol.addAtom(a6); Atom a7 = new Atom("H"); mol.addAtom(a7); Atom a8 = new Atom("H"); mol.addAtom(a8); Bond b1 = new Bond(a2, a1, 1.0); mol.addBond(b1); Bond b2 = new Bond(a3, a2, 1.0); mol.addBond(b2); Bond b3 = new Bond(a4, a2, 2.0); mol.addBond(b3); Bond b4 = new Bond(a1, a5, 1.0); mol.addBond(b4); Bond b5 = new Bond(a1, a6, 1.0); mol.addBond(b5); Bond b6 = new Bond(a1, a7, 1.0); mol.addBond(b6); Bond b7 = new Bond(a3, a8, 1.0); mol.addBond(b7); return mol; } public void testHybridizationStateATMatcher() { AtomContainer mol = getMol(); HybridizationStateATMatcher h = new HybridizationStateATMatcher(); for (int i = 0; i < mol.getAtomCount(); i++) { try { AtomType a = h.findMatchingAtomType(mol,mol.getAtomAt(i)); assertTrue(a != null); } catch (CDKException x) { fail(); x.printStackTrace(); } } } -- end test -- start log 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - My ATOM TYPE C 4.0 1.0 4 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - 0ATOM TYPE 4.0 1.0 4 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - !!!!! ATOM TYPE FOUND 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.config.AtomTypeFactory - Request for atomtype for symbol C 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.config.AtomTypeFactory - Atomtype for symbol C has this number of types: 7 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - My ATOM TYPE C 4.0 2.0 3 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - 0ATOM TYPE 4.0 1.0 4 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - 1ATOM TYPE 4.0 2.0 3 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - !!!!! ATOM TYPE FOUND 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.config.AtomTypeFactory - Request for atomtype for symbol O 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.config.AtomTypeFactory - Atomtype for symbol O has this number of types: 3 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - My ATOM TYPE O 2.0 1.0 2 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - 0ATOM TYPE 2.0 2.0 0 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - 1ATOM TYPE 3.0 2.0 0 2005-06-22 14:55:47,765 [main] DEBUG org.openscience.cdk.atomtype.HybridizationStateATMatcher - 2ATOM TYPE 1.0 1.0 0 -- end I've noticed that most of the not-recognized-atoms do not have defined "cdk:formalNeighbourCount" in hybridization_atomtypes.xml, which is then assumed zero by HybridizationStateATMatcher. Naturally, only disconnected atom can have zero neighbors count and atoms in a molecule are not matched. Finally, I am wondering if this is a bug (which could be fixed easily by editing hybridization_atomtypes.xml appropriately), or I am just not using HybridizationStateATMatcher correctly. Best regards, Nina -- ------------------------------------------------------------------ Assoc. Prof. Dr. Nina Nikolova-Jeliazkova * * Institute for Parallel Processing * * Bulgarian Academy of Sciences * IST Foundation * Acad. G. Bonchev St 25-A * The Bulgarian NREN * 1113 Sofia, Bulgaria * * Tel: +3592 9796616 * * ICQ: 10705013 http://www.ist.bg www: http://luna.acad.bg/nina ------------------------------------------------------------------ PGP Public Key http://cert.acad.bg/pgp-keys/keys/nina-nikolova-0xEEABA669.asc 8E99 8BAD D804 1A43 27B7 7F87 CF04 C7D1 EEAB A669 ------------------------------------------------------------------ |