/** * @deprecated no such thing as chiral SMILES use {@link #getSmiles} for 'a' SMILES. */ @Deprecated public static String getChiralSmiles(IChemModel model) throws CDKException, ClassNotFoundException, IOException, CloneNotSupportedException { SmilesGenerator smigen = SmilesGenerator.isomeric(); StringBuilder sb = new StringBuilder(); for(IAtomContainer container : ChemModelManipulator.getAllAtomContainers(model)) { container.setStereoElements(StereoElementFactory.using2DCoordinates(container) .interpretProjections(Projection.Haworth, Projection.Chair) .createAll()); if (sb.length() > 0) sb.append('.'); sb.append(smigen.create(container)); } return sb.toString(); }
@Test public void createExtendedTetrahedral() throws CDKException { IAtomContainer m = new AtomContainer(7, 6, 0, 0); m.addAtom(atom("C", 3, -1.56d, 0.78d)); m.addAtom(atom("C", 1, -1.13d, 1.49d)); m.addAtom(atom("C", 0, -0.31d, 1.47d)); m.addAtom(atom("C", 1, 0.52d, 1.46d)); m.addAtom(atom("C", 3, 0.94d, 2.17d)); m.addBond(1, 0, IBond.Order.SINGLE, IBond.Stereo.UP); m.addBond(1, 2, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(2, 3, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(3, 4, IBond.Order.SINGLE); m.setStereoElements(StereoElementFactory.using2DCoordinates(m).createAll()); assertTrue(m.stereoElements().iterator().hasNext()); assertThat(m.stereoElements().iterator().next(), is(instanceOf(ExtendedTetrahedral.class))); }
@Test public void hydrogenIsotope() { IAtomContainer mol = new AtomContainer(); mol.addAtom(atom("C", 3, 0.00, 0.00)); mol.addAtom(atom("C", 1, 1.30, -0.75)); mol.addAtom(atom("C", 1, 2.60, -0.00)); mol.addAtom(atom("H", 0, 3.90, -0.75)); mol.getAtom(3).setMassNumber(2); mol.addBond(0, 1, IBond.Order.SINGLE); mol.addBond(1, 2, IBond.Order.DOUBLE); mol.addBond(2, 3, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(mol); assertThat(factory.createAll().size(), is(1)); }
@Test public void createExtendedTetrahedralFrom2DCoordinatesImplicitHydrogens_cw() throws Exception { IAtomContainer m = new AtomContainer(7, 6, 0, 0); m.addAtom(atom("C", 3, -1.56d, 0.78d)); m.addAtom(atom("C", 1, -1.13d, 1.49d)); m.addAtom(atom("C", 0, -0.31d, 1.47d)); m.addAtom(atom("C", 1, 0.52d, 1.46d)); m.addAtom(atom("C", 3, 0.94d, 2.17d)); m.addBond(1, 0, IBond.Order.SINGLE, IBond.Stereo.UP); m.addBond(1, 2, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(2, 3, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(3, 4, IBond.Order.SINGLE); ExtendedTetrahedral et = StereoElementFactory.using2DCoordinates(m).createExtendedTetrahedral(2, Stereocenters.of(m)); assertThat(et.winding(), is(ITetrahedralChirality.Stereo.CLOCKWISE)); assertThat(et.peripherals(), is(new IAtom[]{m.getAtom(0), m.getAtom(1), m.getAtom(4), m.getAtom(3)})); assertThat(et.focus(), is(m.getAtom(2))); }
@Test public void createExtendedTetrahedralFrom2DCoordinatesImplicitHydrogens_ccw() throws Exception { IAtomContainer m = new AtomContainer(7, 6, 0, 0); m.addAtom(atom("C", 3, -1.56d, 0.78d)); m.addAtom(atom("C", 1, -1.13d, 1.49d)); m.addAtom(atom("C", 0, -0.31d, 1.47d)); m.addAtom(atom("C", 1, 0.52d, 1.46d)); m.addAtom(atom("C", 3, 0.94d, 2.17d)); m.addBond(1, 0, IBond.Order.SINGLE, IBond.Stereo.DOWN); m.addBond(1, 2, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(2, 3, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(3, 4, IBond.Order.SINGLE); ExtendedTetrahedral et = StereoElementFactory.using2DCoordinates(m).createExtendedTetrahedral(2, Stereocenters.of(m)); assertThat(et.winding(), is(ITetrahedralChirality.Stereo.ANTI_CLOCKWISE)); assertThat(et.peripherals(), is(new IAtom[]{m.getAtom(0), m.getAtom(1), m.getAtom(4), m.getAtom(3)})); assertThat(et.focus(), is(m.getAtom(2))); }
@Test public void keepNonStereoConfigurationPhosphorusTautomer() throws CDKException { IAtomContainer m = new AtomContainer(); m.addAtom(atom("P", 0, 0.07, 1.19)); m.addAtom(atom("O", 0, 0.56, 2.02)); m.addAtom(atom("O", 1, -0.29, 2.04)); m.addAtom(atom("C", 3, -0.66, 0.82)); m.addAtom(atom("C", 2, 0.76, 0.74)); m.addAtom(atom("C", 3, 1.50, 1.12)); m.addBond(0, 2, IBond.Order.SINGLE, IBond.Stereo.DOWN); m.addBond(0, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); m.addBond(4, 5, IBond.Order.SINGLE); m.addBond(0, 1, IBond.Order.DOUBLE); List<IStereoElement> elements = StereoElementFactory.using2DCoordinates(m).createAll(); assertThat(elements.size(), is(1)); m.setStereoElements(elements); SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Stereo); assertThat(smigen.create(m), is("[P@@](O)(C)(CC)=O")); }
@Test public void e_but2ene() { IAtomContainer m = new AtomContainer(4, 3, 0, 0); m.addAtom(atom("C", 1, -2.19d, 1.64d)); m.addAtom(atom("C", 1, -1.36d, 1.64d)); m.addAtom(atom("C", 3, -2.60d, 0.92d)); m.addAtom(atom("C", 3, -0.95d, 2.35d)); m.addBond(0, 1, IBond.Order.DOUBLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); IDoubleBondStereochemistry element = factory.createGeometric(m.getBond(0), null); assertNotNull(element); assertThat(element.getStereo(), is(OPPOSITE)); }
@Test public void z_but2ene() { IAtomContainer m = new AtomContainer(4, 3, 0, 0); m.addAtom(atom("C", 3, -2.46d, 1.99d)); m.addAtom(atom("C", 1, -1.74d, 0.68d)); m.addAtom(atom("C", 1, -0.24d, 0.65d)); m.addAtom(atom("C", 3, 0.54d, 1.94d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(1, 2, IBond.Order.DOUBLE); m.addBond(2, 3, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); IDoubleBondStereochemistry element = factory.createGeometric(m.getBond(1), null); assertNotNull(element); assertThat(element.getStereo(), is(TOGETHER)); }
@Test public void benzene() { IAtomContainer mol = new AtomContainer(); mol.addAtom(atom("C", 1, 1.30, -0.75)); mol.addAtom(atom("C", 1, -0.00, -1.50)); mol.addAtom(atom("C", 1, -1.30, -0.75)); mol.addAtom(atom("C", 1, -1.30, 0.75)); mol.addAtom(atom("C", 1, 0.00, 1.50)); mol.addAtom(atom("C", 1, 1.30, 0.75)); mol.addBond(0, 1, IBond.Order.DOUBLE); mol.addBond(1, 2, IBond.Order.SINGLE); mol.addBond(2, 3, IBond.Order.DOUBLE); mol.addBond(3, 4, IBond.Order.SINGLE); mol.addBond(4, 5, IBond.Order.DOUBLE); mol.addBond(0, 5, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(mol); assertThat(factory.createAll().size(), is(0)); }
@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)); }
/** * @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)); }
@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 doNotCreateNonStereogenicExtendedTetrahedral() throws CDKException { IAtomContainer m = new AtomContainer(7, 6, 0, 0); m.addAtom(atom("C", 3, -1.56d, 0.78d)); m.addAtom(atom("C", 1, -1.13d, 1.49d)); m.addAtom(atom("C", 0, -0.31d, 1.47d)); m.addAtom(atom("C", 0, 0.52d, 1.46d)); m.addAtom(atom("C", 3, 0.94d, 2.17d)); m.addAtom(atom("C", 3, 0.92d, 0.74d)); m.addBond(1, 0, IBond.Order.SINGLE, IBond.Stereo.UP); m.addBond(1, 2, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(2, 3, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(3, 4, IBond.Order.SINGLE); m.addBond(3, 5, IBond.Order.SINGLE); m.setStereoElements(StereoElementFactory.using2DCoordinates(m).checkSymmetry(true).createAll()); assertFalse(m.stereoElements().iterator().hasNext()); }
@Test public void unspec_but2ene_wavyBond() { IAtomContainer m = new AtomContainer(4, 3, 0, 0); m.addAtom(atom("C", 1, -1.27d, 1.48d)); m.addAtom(atom("C", 1, -2.10d, 1.46d)); m.addAtom(atom("C", 3, -2.50d, 0.74d)); m.addAtom(atom("C", 3, -0.87d, 2.20d)); m.addBond(0, 1, IBond.Order.DOUBLE); m.addBond(1, 2, IBond.Order.SINGLE); m.addBond(0, 3, IBond.Order.SINGLE, IBond.Stereo.UP_OR_DOWN); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); IDoubleBondStereochemistry element = factory.createGeometric(m.getBond(0), null); assertNull(element); }
@Test public void unspec_but2ene_byCoordinates() { IAtomContainer m = new AtomContainer(4, 3, 0, 0); m.addAtom(atom("C", 1, -1.37d, 1.64d)); m.addAtom(atom("C", 1, -2.19d, 1.63d)); m.addAtom(atom("C", 3, -2.59d, 0.90d)); m.addAtom(atom("C", 3, -0.52d, 1.73d)); m.addBond(0, 1, IBond.Order.DOUBLE); m.addBond(1, 2, IBond.Order.SINGLE); m.addBond(0, 3, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); IDoubleBondStereochemistry element = factory.createGeometric(m.getBond(0), null); assertNull(element); }
@Test public void unspec_but2ene_crossBond() { IAtomContainer m = new AtomContainer(4, 3, 0, 0); m.addAtom(atom("C", 1, -1.27d, 1.48d)); m.addAtom(atom("C", 1, -2.10d, 1.46d)); m.addAtom(atom("C", 3, -2.50d, 0.74d)); m.addAtom(atom("C", 3, -0.87d, 2.20d)); m.addBond(0, 1, IBond.Order.DOUBLE, IBond.Stereo.E_OR_Z); m.addBond(1, 2, IBond.Order.SINGLE); m.addBond(0, 3, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using2DCoordinates(m); IDoubleBondStereochemistry element = factory.createGeometric(m.getBond(0), null); assertNull(element); }
@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); }
@Test public void createExtendedTetrahedralFrom2DCoordinatesNoNonplanarBonds() throws Exception { IAtomContainer m = new AtomContainer(7, 6, 0, 0); m.addAtom(atom("C", 3, -1.56d, 0.78d)); m.addAtom(atom("C", 0, -1.13d, 1.49d)); m.addAtom(atom("C", 0, -0.31d, 1.47d)); m.addAtom(atom("C", 0, 0.52d, 1.46d)); m.addAtom(atom("C", 3, 0.94d, 2.17d)); m.addAtom(atom("H", 0, 0.92d, 0.74d)); m.addAtom(atom("H", 0, -1.53d, 2.21d)); m.addBond(1, 0, IBond.Order.SINGLE, IBond.Stereo.NONE); m.addBond(1, 2, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(2, 3, IBond.Order.DOUBLE, IBond.Stereo.NONE); m.addBond(3, 4, IBond.Order.SINGLE); m.addBond(1, 6, IBond.Order.SINGLE, IBond.Stereo.NONE); m.addBond(3, 5, IBond.Order.SINGLE); ExtendedTetrahedral et = StereoElementFactory.using2DCoordinates(m).createExtendedTetrahedral(2, Stereocenters.of(m)); assertNull(et); }