Skip to content

Commit

Permalink
Added rudimentary detection of the Co.oh atom type
Browse files Browse the repository at this point in the history
Change-Id: I2379c9a886f731f72c0e4dfeb4d3511334e57291

Signed-off-by: John May <john.wilkinsonmay@gmail.com>
  • Loading branch information
egonw authored and johnmay committed Oct 3, 2013
1 parent 3fdfde1 commit 5374cd7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Expand Up @@ -124,6 +124,11 @@ public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom)
if (neighbors > 4 && neighbors <= 6) return factory.getAtomType("Cr.oh");
else if (neighbors > 0) return factory.getAtomType("Cr.th");
}
else if ("Co".equals(atom.getSymbol())) {
// if only I had good descriptions of the Sybyl atom types
int neibors = atomContainer.getConnectedBondsCount(atom);
if (neibors == 6) return factory.getAtomType("Co.oh");
}
if (type == null) return null;
else atom.setAtomTypeName(type.getAtomTypeName());
String mappedType = mapCDKToSybylType(atom);
Expand Down
Expand Up @@ -818,6 +818,21 @@ public void testCroh() throws Exception {
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}

@Test
public void testCooh() throws Exception {
IAtomContainer mol = new AtomContainer();
// this is made up, and may be wrong; info on the web is sparse, and PubChem has no
// octa-coordinate structure; lone pairs involved?
IAtom a1 = new Atom("Co"); mol.addAtom(a1);
for (int i=0; i<6; i++) {
IAtom atom = new Atom("O"); mol.addAtom(atom);
mol.addBond(new Bond(a1, atom, IBond.Order.SINGLE));
}

String[] expectedTypes = {"Co.oh", "O.3", "O.3", "O.3", "O.3", "O.3", "O.3"};
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}

@AfterClass
public static void testTestedAtomTypes() throws Exception {
countTestedAtomTypes(testedAtomTypes, factory);
Expand Down

0 comments on commit 5374cd7

Please sign in to comment.