IStereoElement element = createTetrahedral(v, centers); if (element != null) elements.add(element); break;
/** * The embedding of 3D depictions may cause bonds of abnormal length * (e.g. CHEBI:7621). The parity computation should consider this, here * we check we get the correct (anti-clockwise) configuration. */ @Test public void differentBondLengthsDoNotAffectWinding() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("O", 1, 14.50d, -8.72d)); m.addAtom(atom("N", 2, 14.50d, -11.15d)); m.addAtom(atom("C", 0, 15.28d, -7.81d)); m.addAtom(atom("C", 3, 12.91d, -7.81d)); m.addAtom(atom("H", 0, 16.00d, -7.39d)); m.addBond(2, 0, IBond.Order.SINGLE); m.addBond(2, 1, IBond.Order.SINGLE); m.addBond(3, 2, IBond.Order.SINGLE); m.addBond(2, 4, IBond.Order.SINGLE, IBond.Stereo.DOWN); StereoElementFactory sef = StereoElementFactory.using2DCoordinates(m); ITetrahedralChirality element = sef.createTetrahedral(2, Stereocenters.of(m)); assertThat(element.getChiralAtom(), is(m.getAtom(2))); IAtom[] ligands = element.getLigands(); assertThat(ligands[0], is(m.getAtom(0))); assertThat(ligands[1], is(m.getAtom(1))); assertThat(ligands[2], is(m.getAtom(3))); assertThat(ligands[3], is(m.getAtom(4))); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.ANTI_CLOCKWISE)); }
@Test public void r_butan2ol() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("O", 1, -0.46d, 1.98d)); m.addAtom(atom("C", 1, -1.28d, 1.96d)); m.addAtom(atom("C", 2, -1.71d, 2.67d)); m.addAtom(atom("C", 3, -1.68d, 1.24d)); m.addAtom(atom("C", 3, -2.53d, 2.66d)); m.addBond(1, 0, IBond.Order.SINGLE, IBond.Stereo.DOWN); m.addBond(1, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(2, 4, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(1), null); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.CLOCKWISE)); }
@Test public void s_butan2ol() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("O", 1, -0.46d, 1.98d)); m.addAtom(atom("C", 1, -1.28d, 1.96d)); m.addAtom(atom("C", 2, -1.71d, 2.67d)); m.addAtom(atom("C", 3, -1.68d, 1.24d)); m.addAtom(atom("C", 3, -2.53d, 2.66d)); m.addBond(1, 0, IBond.Order.SINGLE, IBond.Stereo.UP); m.addBond(1, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(2, 4, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(1), null); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.ANTI_CLOCKWISE)); }
@Test public void s_butan2ol_3d() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("C", 1, -0.17d, -0.12d, -0.89d)); m.addAtom(atom("C", 2, 1.12d, -0.91d, -0.51d)); m.addAtom(atom("C", 3, -0.10d, 0.46d, -2.32d)); m.addAtom(atom("C", 3, 1.07d, -1.54d, 0.91d)); m.addAtom(atom("O", 1, -0.38d, 0.96d, 0.02d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), Stereocenters.of(m)); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.ANTI_CLOCKWISE)); }
@Test public void inverse_style_downbond() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("O", 1, -0.46d, 1.98d)); m.addAtom(atom("C", 1, -1.28d, 1.96d)); m.addAtom(atom("C", 2, -1.71d, 2.67d)); m.addAtom(atom("C", 3, -1.68d, 1.24d)); m.addAtom(atom("C", 3, -2.53d, 2.66d)); m.addBond(1, 0, IBond.Order.SINGLE, IBond.Stereo.DOWN_INVERTED); m.addBond(1, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(2, 4, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(1), Stereocenters.of(m)); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.CLOCKWISE)); }
@Test public void r_butan2ol_3d() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("C", 1, 0.56d, 0.05d, 0.71d)); m.addAtom(atom("C", 2, -0.53d, 0.51d, -0.30d)); m.addAtom(atom("C", 3, 1.81d, -0.53d, 0.02d)); m.addAtom(atom("C", 3, -1.80d, 1.06d, 0.37d)); m.addAtom(atom("O", 1, 0.95d, 1.15d, 1.54d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), Stereocenters.of(m)); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.CLOCKWISE)); }
/** * @cdk.inchi InChI=1S/C3H8OS/c1-3-5(2)4/h3H2,1-2H3/t5-/m0/s1 */ @Test public void s_methanesulfinylethane() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("S", 0, 0.01d, 1.50d)); m.addAtom(atom("C", 3, 0.03d, 0.00d)); m.addAtom(atom("C", 2, -1.30d, 2.23d)); m.addAtom(atom("C", 3, -1.33d, 3.73d)); m.addAtom(atom("O", 0, 1.29d, 2.28d)); m.addBond(0, 1, IBond.Order.SINGLE, IBond.Stereo.UP); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(2, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.DOUBLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), null); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.CLOCKWISE)); }
/** * @cdk.inchi InChI=1S/C3H8OS/c1-3-5(2)4/h3H2,1-2H3/t5-/m1/s1 */ @Test public void r_methanesulfinylethane() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("S", 0, 0.01d, 1.50d)); m.addAtom(atom("C", 3, 0.03d, 0.00d)); m.addAtom(atom("C", 2, -1.30d, 2.23d)); m.addAtom(atom("C", 3, -1.33d, 3.73d)); m.addAtom(atom("O", 0, 1.29d, 2.28d)); m.addBond(0, 1, IBond.Order.SINGLE, IBond.Stereo.DOWN); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(2, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.DOUBLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), null); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.ANTI_CLOCKWISE)); }
@Test public void r_butan2ol_3d_expH() { IAtomContainer m = new AtomContainer(6, 5, 0, 0); m.addAtom(atom("C", 0, -0.07d, -0.14d, 0.50d)); m.addAtom(atom("C", 2, -0.05d, -1.20d, -0.65d)); m.addAtom(atom("C", 3, 0.98d, -0.46d, 1.60d)); m.addAtom(atom("C", 3, -1.11d, -0.94d, -1.75d)); m.addAtom(atom("O", 1, 0.21d, 1.16d, -0.01d)); m.addAtom(atom("H", 0, -1.06d, -0.13d, 0.96d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); m.addBond(0, 5, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), Stereocenters.of(m)); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.CLOCKWISE)); }
@Test public void s_butan2ol_3d_expH() { IAtomContainer m = new AtomContainer(6, 5, 0, 0); m.addAtom(atom("C", 0, -0.17d, -0.12d, -0.89d)); m.addAtom(atom("C", 2, 1.12d, -0.91d, -0.51d)); m.addAtom(atom("C", 3, -0.10d, 0.46d, -2.32d)); m.addAtom(atom("C", 3, 1.07d, -1.54d, 0.91d)); m.addAtom(atom("O", 1, -0.38d, 0.96d, 0.02d)); m.addAtom(atom("H", 0, -1.03d, -0.79d, -0.83d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); m.addBond(0, 5, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), Stereocenters.of(m)); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.ANTI_CLOCKWISE)); }
@Test public void unspec_butan2ol() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("O", 1, -0.46d, 1.98d)); m.addAtom(atom("C", 1, -1.28d, 1.96d)); m.addAtom(atom("C", 2, -1.71d, 2.67d)); m.addAtom(atom("C", 3, -1.68d, 1.24d)); m.addAtom(atom("C", 3, -2.53d, 2.66d)); m.addBond(1, 0, IBond.Order.SINGLE, IBond.Stereo.UP_OR_DOWN); m.addBond(1, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(2, 4, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(1), null); assertNull(element); }
@Test public void inverse_style_downbond_ambiguous() throws CDKException { IAtomContainer m = new AtomContainer(6, 4, 0, 0); m.addAtom(atom("O", 1, -0.46d, 1.98d)); m.addAtom(atom("C", 1, -1.28d, 1.96d)); m.addAtom(atom("C", 1, -1.71d, 2.67d)); m.addAtom(atom("C", 3, -1.68d, 1.24d)); m.addAtom(atom("C", 3, -2.53d, 2.66d)); m.addAtom(atom("O", 1, -1.31d, 3.39d)); m.addBond(1, 0, IBond.Order.SINGLE); m.addBond(1, 2, IBond.Order.SINGLE, IBond.Stereo.DOWN_INVERTED); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(2, 4, IBond.Order.SINGLE); m.addBond(2, 5, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(1), Stereocenters.of(m)); assertNull(element); }