/** * Convert to an identity template library. * * @return identity template library */ IdentityTemplateLibrary toIdentityTemplateLibrary() { IdentityTemplateLibrary lib = IdentityTemplateLibrary.empty(); for (IAtomContainer mol : templates) { lib.add(AtomContainerManipulator.anonymise(mol)); } return lib; } }
/** * Convert to an identity template library. * * @return identity template library */ IdentityTemplateLibrary toIdentityTemplateLibrary() { IdentityTemplateLibrary lib = IdentityTemplateLibrary.empty(); for (IAtomContainer mol : templates) { lib.add(AtomContainerManipulator.anonymise(mol)); } return lib; } }
query = QueryAtomContainerCreator.createAnyAtomContainer(m, false); } else { query = AtomContainerManipulator.anonymise(m);
/** * Layout a macro cycle (the rest of the ring set is untouched). * * @param macrocycle the macrocycle * @param ringset the ring set the macrocycle belongs to (may only be it's self) * @return layout was successfully, if false caller fall-back to regular polygons */ boolean layout(IRing macrocycle, IRingSet ringset) { final IAtomContainer anon = roundUpIfNeeded(AtomContainerManipulator.anonymise(macrocycle)); final Collection<Point2d[]> coords = TEMPLATES.getCoordinates(anon); if (coords.isEmpty()) return false; Point2d[] best = new Point2d[anon.getAtomCount()]; int bestOffset = selectCoords(coords, best, macrocycle, ringset); for (int i = 0; i < macrocycle.getAtomCount(); i++) { macrocycle.getAtom(i).setPoint2d(best[(bestOffset + i) % macrocycle.getAtomCount()]); macrocycle.getAtom(i).setFlag(ISPLACED, true); macrocycle.getAtom(i).setProperty(MACROCYCLE_ATOM_HINT, true); } macrocycle.setFlag(ISPLACED, true); return true; }
/** * Layout a macro cycle (the rest of the ring set is untouched). * * @param macrocycle the macrocycle * @param ringset the ring set the macrocycle belongs to (may only be it's self) * @return layout was successfully, if false caller fall-back to regular polygons */ boolean layout(IRing macrocycle, IRingSet ringset) { final IAtomContainer anon = roundUpIfNeeded(AtomContainerManipulator.anonymise(macrocycle)); final Collection<Point2d[]> coords = TEMPLATES.getCoordinates(anon); if (coords.isEmpty()) return false; Point2d[] best = new Point2d[anon.getAtomCount()]; int bestOffset = selectCoords(coords, best, macrocycle, ringset); for (int i = 0; i < macrocycle.getAtomCount(); i++) { macrocycle.getAtom(i).setPoint2d(best[(bestOffset + i) % macrocycle.getAtomCount()]); macrocycle.getAtom(i).setFlag(ISPLACED, true); macrocycle.getAtom(i).setProperty(MACROCYCLE_ATOM_HINT, true); } macrocycle.setFlag(ISPLACED, true); return true; }
final IAtomContainer anonymous = clearHydrogenCounts(AtomContainerManipulator.anonymise(ringSystem));
final IAtomContainer anonymous = clearHydrogenCounts(AtomContainerManipulator.anonymise(ringSystem));
@Test public void testAnonymise() throws Exception { IAtomContainer cyclohexane = TestMoleculeFactory.makeCyclohexane(); cyclohexane.getAtom(0).setSymbol("O"); cyclohexane.getAtom(2).setSymbol("O"); cyclohexane.getAtom(1).setAtomTypeName("remove me"); cyclohexane.getAtom(3).setFlag(CDKConstants.ISAROMATIC, true); cyclohexane.getAtom(4).setImplicitHydrogenCount(2); cyclohexane.getBond(0).setFlag(CDKConstants.SINGLE_OR_DOUBLE, true); cyclohexane.getBond(1).setFlag(CDKConstants.ISAROMATIC, true); IAtomContainer anonymous = AtomContainerManipulator.anonymise(cyclohexane); Assert.assertTrue(new UniversalIsomorphismTester().isIsomorph(anonymous, TestMoleculeFactory.makeCyclohexane())); assertThat(anonymous.getAtom(0).getSymbol(), is("C")); assertThat(anonymous.getAtom(2).getSymbol(), is("C")); assertNull(anonymous.getAtom(1).getAtomTypeName()); assertThat(anonymous.getAtom(4).getImplicitHydrogenCount(), is(0)); assertFalse(anonymous.getAtom(3).getFlag(CDKConstants.ISAROMATIC)); assertFalse(anonymous.getBond(1).getFlag(CDKConstants.ISAROMATIC)); assertFalse(anonymous.getBond(1).getFlag(CDKConstants.SINGLE_OR_DOUBLE)); }