private static void addExtendedCisTransConfig(ExtendedCisTrans ect, GraphBuilder gb, Map<IAtom, Integer> indices, IAtomContainer container) { IAtom[] ends = ExtendedCisTrans.findTerminalAtoms(container, ect.getFocus()); IBond[] carriers = ect.getCarriers().toArray(new IBond[2]); if (ends != null) { Configuration.DoubleBond config; if (ect.getConfigOrder() == IStereoElement.TOGETHER) config = Configuration.DoubleBond.TOGETHER; else if (ect.getConfigOrder() == IStereoElement.OPPOSITE) config = Configuration.DoubleBond.OPPOSITE; else config = Configuration.DoubleBond.UNSPECIFIED; gb.extendedGeometric(indices.get(ends[0]), indices.get(ends[1])) .configure(indices.get(carriers[0].getOther(ends[0])), indices.get(carriers[1].getOther(ends[1])), config); } } }
/** * {@inheritDoc} */ @Override protected IStereoElement<IBond, IBond> create(IBond focus, List<IBond> carriers, int cfg) { return new ExtendedCisTrans(focus, carriers.toArray(new IBond[2]), cfg); } }
/** * Helper method to locate two terminal atoms in a container for this * extended Cis/Trans element. The atoms are ordered such that the first * atom is closer to first carrier. * * @param container structure representation * @return the terminal atoms (ordered) */ public static IAtom[] findTerminalAtoms(IAtomContainer container, IBond focus) { IAtom a = focus.getBegin(); IAtom b = focus.getEnd(); IAtom aPrev = a, bPrev = b; IAtom aNext, bNext; aNext = getOtherAtom(container, a, b); bNext = getOtherAtom(container, b, a); while (aNext != null && bNext != null) { IAtom tmp = getOtherAtom(container, aNext, aPrev); aPrev = aNext; aNext = tmp; tmp = getOtherAtom(container, bNext, bPrev); bPrev = bNext; bNext = tmp; } if (aPrev != null && bPrev != null) return new IAtom[]{aPrev, bPrev}; return null; }
@Test public void extendedExtendedCis5() throws Exception { IAtomContainer mol = load("C/C=C=C=C=C=C\\C"); for (IStereoElement se : mol.stereoElements()) { if (se instanceof ExtendedCisTrans) { ExtendedCisTrans ect = (ExtendedCisTrans) se; assertThat(ect.getConfigOrder(), is(IStereoElement.TOGETHER)); assertThat(ect.getFocus(), is(mol.getBond(3))); assertThat(ect.getCarriers().get(0), is(mol.getBond(0))); assertThat(ect.getCarriers().get(1), is(mol.getBond(6))); } } }
IBond middle = elem.getFocus(); IAtom[] ends = ExtendedCisTrans.findTerminalAtoms(container, middle); IBond[] bonds = elem.getCarriers().toArray(new IBond[2]);
endBonds.remove(dbs.get(dbs.size() - 1)); IAtom[] ends = ExtendedCisTrans.findTerminalAtoms(container, focus); assert ends != null; if (ends[0].equals(begAtom)) { config = IStereoElement.TOGETHER; return new ExtendedCisTrans(focus, carriers, config);
/** * (E)-hexa-2,3,4-triene * @cdk.smiles C/C=C=C=C/C */ @Test public void e_hexa234triene() { IAtomContainer mol = new AtomContainer(); mol.addAtom(atom("C", 1, 2.48d, 0.00d)); mol.addAtom(atom("C", 0, 1.65d, 0.00d)); mol.addAtom(atom("C", 0, 0.83d, 0.00d)); mol.addAtom(atom("C", 1, 0.00d, 0.00d)); mol.addAtom(atom("C", 3, -0.41d, -0.71d)); mol.addAtom(atom("C", 3, 2.89d, 0.71d)); mol.addBond(0,1,IBond.Order.DOUBLE); mol.addBond(1,2,IBond.Order.DOUBLE); mol.addBond(2,3,IBond.Order.DOUBLE); mol.addBond(3,4,IBond.Order.SINGLE); mol.addBond(0,5,IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(mol); List<IBond> dbs = new ArrayList<>(); dbs.add(mol.getBond(0)); dbs.add(mol.getBond(1)); dbs.add(mol.getBond(2)); ExtendedCisTrans element = factory.createExtendedCisTrans(dbs, Stereocenters.of(mol)); assertNotNull(element); assertThat(element.getConfigOrder(), is(IStereoElement.OPPOSITE)); }
@Test public void extendedExtendedTrans3() throws Exception { IAtomContainer mol = load("C/C=C=C=C/C"); for (IStereoElement se : mol.stereoElements()) { if (se instanceof ExtendedCisTrans) { ExtendedCisTrans ect = (ExtendedCisTrans) se; assertThat(ect.getConfigOrder(), is(IStereoElement.OPPOSITE)); assertThat(ect.getFocus(), is(mol.getBond(2))); assertThat(ect.getCarriers().get(0), is(mol.getBond(0))); assertThat(ect.getCarriers().get(1), is(mol.getBond(4))); } } }
IBond middle = elem.getFocus(); IAtom[] ends = ExtendedCisTrans.findTerminalAtoms(container, middle); IBond[] bonds = elem.getCarriers().toArray(new IBond[2]);
endBonds.remove(dbs.get(dbs.size() - 1)); IAtom[] ends = ExtendedCisTrans.findTerminalAtoms(container, focus); assert ends != null; if (ends[0].equals(begAtom)) { config = IStereoElement.TOGETHER; return new ExtendedCisTrans(focus, carriers, config);
/** * (Z)-hexa-2,3,4-triene * @cdk.smiles C/C=C=C=C\C */ @Test public void z_hexa234triene_3D() { IAtomContainer mol = new AtomContainer(); mol.addAtom(atom("C", 1, -0.09d, -0.45d, -1.07d)); mol.addAtom(atom("C", 0, -0.67d, -1.04d, -0.11d)); mol.addAtom(atom("C", 0, -1.23d, -1.59d, 0.79d)); mol.addAtom(atom("C", 1, -1.84d, -2.17d, 1.74d)); mol.addAtom(atom("C", 3, -3.13d, -1.73d, 2.21d)); mol.addAtom(atom("C", 3, -0.70d, 0.69d, -1.73d)); mol.addBond(0,1,IBond.Order.DOUBLE); mol.addBond(1,2,IBond.Order.DOUBLE); mol.addBond(2,3,IBond.Order.DOUBLE); mol.addBond(3,4,IBond.Order.SINGLE); mol.addBond(0,5,IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(mol); List<IBond> dbs = new ArrayList<>(); dbs.add(mol.getBond(0)); dbs.add(mol.getBond(1)); dbs.add(mol.getBond(2)); ExtendedCisTrans element = factory.createExtendedCisTrans(dbs, Stereocenters.of(mol)); assertNotNull(element); assertThat(element.getConfigOrder(), is(IStereoElement.TOGETHER)); }
} else if (se instanceof ExtendedCisTrans) { ExtendedCisTrans db = (ExtendedCisTrans) se; int config = db.getConfigOrder(); IBond focus = db.getFocus(); IBond orgLeft = db.getCarriers().get(0); IBond orgRight = db.getCarriers().get(1); IAtom[] ends = ExtendedCisTrans.findTerminalAtoms(org, focus); IAtom u = ends[0]; IAtom v = ends[1]; IBond cpyRight = !Objects.equals(yNew, y) ? org.getBond(v, yNew) : orgRight; elements.add(new ExtendedCisTrans(focus, new IBond[]{cpyLeft, cpyRight}, config));
@Test public void extendedExtendedCis3() throws Exception { IAtomContainer mol = load("C/C=C=C=C\\C"); for (IStereoElement se : mol.stereoElements()) { if (se instanceof ExtendedCisTrans) { ExtendedCisTrans ect = (ExtendedCisTrans) se; assertThat(ect.getConfigOrder(), is(IStereoElement.TOGETHER)); assertThat(ect.getFocus(), is(mol.getBond(2))); assertThat(ect.getCarriers().get(0), is(mol.getBond(0))); assertThat(ect.getCarriers().get(1), is(mol.getBond(4))); } } }
/** * (Z)-hexa-2,3,4-triene * @cdk.smiles C/C=C=C=C\C */ @Test public void z_hexa234triene() { IAtomContainer mol = new AtomContainer(); mol.addAtom(atom("C", 1, 2.48d, 0.00d)); mol.addAtom(atom("C", 0, 1.65d, 0.00d)); mol.addAtom(atom("C", 0, 0.83d, 0.00d)); mol.addAtom(atom("C", 1, 0.00d, 0.00d)); mol.addAtom(atom("C", 3, -0.41d, -0.71d)); mol.addAtom(atom("C", 3, 2.92d, -0.69d)); mol.addBond(0,1,IBond.Order.DOUBLE); mol.addBond(1,2,IBond.Order.DOUBLE); mol.addBond(2,3,IBond.Order.DOUBLE); mol.addBond(3,4,IBond.Order.SINGLE); mol.addBond(0,5,IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(mol); List<IBond> dbs = new ArrayList<>(); dbs.add(mol.getBond(0)); dbs.add(mol.getBond(1)); dbs.add(mol.getBond(2)); ExtendedCisTrans element = factory.createExtendedCisTrans(dbs, Stereocenters.of(mol)); assertNotNull(element); assertThat(element.getConfigOrder(), is(IStereoElement.TOGETHER)); }
/** * {@inheritDoc} */ @Override protected IStereoElement<IBond, IBond> create(IBond focus, List<IBond> carriers, int cfg) { return new ExtendedCisTrans(focus, carriers.toArray(new IBond[2]), cfg); } }
/** * Helper method to locate two terminal atoms in a container for this * extended Cis/Trans element. The atoms are ordered such that the first * atom is closer to first carrier. * * @param container structure representation * @return the terminal atoms (ordered) */ public static IAtom[] findTerminalAtoms(IAtomContainer container, IBond focus) { IAtom a = focus.getBegin(); IAtom b = focus.getEnd(); IAtom aPrev = a, bPrev = b; IAtom aNext, bNext; aNext = getOtherAtom(container, a, b); bNext = getOtherAtom(container, b, a); while (aNext != null && bNext != null) { IAtom tmp = getOtherAtom(container, aNext, aPrev); aPrev = aNext; aNext = tmp; tmp = getOtherAtom(container, bNext, bPrev); bPrev = bNext; bNext = tmp; } if (aPrev != null && bPrev != null) return new IAtom[]{aPrev, bPrev}; return null; }
/** * (E)-hexa-2,3,4-triene * @cdk.smiles C/C=C=C=C/C */ @Test public void e_hexa234triene_3D() { IAtomContainer mol = new AtomContainer(); mol.addAtom(atom("C", 1, 0.29d, 0.01d, 0.02d)); mol.addAtom(atom("C", 0, -0.56d, -0.90d, 0.25d)); mol.addAtom(atom("C", 0, -1.37d, -1.75d, 0.46d)); mol.addAtom(atom("C", 1, -2.24d, -2.65d, 0.67d)); mol.addAtom(atom("C", 3, -3.66d, -2.36d, 0.68d)); mol.addAtom(atom("C", 3, 1.69d, -0.32d, -0.11d)); mol.addBond(0,1,IBond.Order.DOUBLE); mol.addBond(1,2,IBond.Order.DOUBLE); mol.addBond(2,3,IBond.Order.DOUBLE); mol.addBond(3,4,IBond.Order.SINGLE); mol.addBond(0,5,IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(mol); List<IBond> dbs = new ArrayList<>(); dbs.add(mol.getBond(0)); dbs.add(mol.getBond(1)); dbs.add(mol.getBond(2)); ExtendedCisTrans element = factory.createExtendedCisTrans(dbs, Stereocenters.of(mol)); assertNotNull(element); assertThat(element.getConfigOrder(), is(IStereoElement.OPPOSITE)); }
ac.getBond(ac.getAtom(v), ac.getAtom(second.other(v)))}; ac.addStereoElement(new ExtendedCisTrans(middleBond, ligands, cfg));