InChIGenerator { public String getInchi() { return (output.getInchi()); } protected  InChIGenerator(IAtomContainer atomContainer, boolean ignoreAromaticBonds); protected  InChIGenerator(IAtomContainer atomContainer, String options, boolean ignoreAromaticBonds); protected  InChIGenerator(IAtomContainer atomContainer, List<INCHI_OPTION> options, boolean ignoreAromaticBonds); INCHI_RET getReturnStatus(); String getInchi(); String getInchiKey(); String getAuxInfo(); String getMessage(); String getLog();  }
@Test public void bug1295() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(getClass().getResourceAsStream("/data/mdl/bug1295.mol")); try { IAtomContainer container = reader.read(new AtomContainer()); InChIGenerator generator = getFactory().getInChIGenerator(container); Assert.assertEquals("InChI=1S/C7H15NO/c1-4-7(3)6-8-9-5-2/h6-7H,4-5H2,1-3H3", generator.getInchi()); } finally { reader.close(); } }
@Test public void r_penta_2_3_diene_impl_h() throws Exception { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(new Atom("CH3")); m.addAtom(new Atom("CH")); m.addAtom(new Atom("C")); m.addAtom(new Atom("CH")); m.addAtom(new Atom("CH3")); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(1, 2, IBond.Order.DOUBLE); m.addBond(2, 3, IBond.Order.DOUBLE); m.addBond(3, 4, IBond.Order.SINGLE); int[][] atoms = new int[][]{{0, 1, 3, 4}, {1, 0, 3, 4}, {1, 0, 4, 3}, {0, 1, 4, 3}, {4, 3, 1, 0}, {4, 3, 0, 1}, {3, 4, 0, 1}, {3, 4, 1, 0},}; Stereo[] stereos = new Stereo[]{Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE}; for (int i = 0; i < atoms.length; i++) { IStereoElement element = new ExtendedTetrahedral(m.getAtom(2), new IAtom[]{m.getAtom(atoms[i][0]), m.getAtom(atoms[i][1]), m.getAtom(atoms[i][2]), m.getAtom(atoms[i][3])}, stereos[i]); m.setStereoElements(Collections.singletonList(element)); InChIGenerator generator = getFactory().getInChIGenerator(m); assertThat(generator.getInchi(), is("InChI=1S/C5H8/c1-3-5-4-2/h3-4H,1-2H3/t5-/m0/s1")); } }
@Test public void s_penta_2_3_diene_impl_h() throws Exception { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(new Atom("CH3")); m.addAtom(new Atom("CH")); m.addAtom(new Atom("C")); m.addAtom(new Atom("CH")); m.addAtom(new Atom("CH3")); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(1, 2, IBond.Order.DOUBLE); m.addBond(2, 3, IBond.Order.DOUBLE); m.addBond(3, 4, IBond.Order.SINGLE); int[][] atoms = new int[][]{{0, 1, 3, 4}, {1, 0, 3, 4}, {1, 0, 4, 3}, {0, 1, 4, 3}, {4, 3, 1, 0}, {4, 3, 0, 1}, {3, 4, 0, 1}, {3, 4, 1, 0},}; Stereo[] stereos = new Stereo[]{Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE}; for (int i = 0; i < atoms.length; i++) { IStereoElement element = new ExtendedTetrahedral(m.getAtom(2), new IAtom[]{m.getAtom(atoms[i][0]), m.getAtom(atoms[i][1]), m.getAtom(atoms[i][2]), m.getAtom(atoms[i][3])}, stereos[i]); m.setStereoElements(Collections.singletonList(element)); InChIGenerator generator = getFactory().getInChIGenerator(m); assertThat(generator.getInchi(), is("InChI=1S/C5H8/c1-3-5-4-2/h3-4H,1-2H3/t5-/m1/s1")); } }
@Test public void r_penta_2_3_diene_expl_h() throws Exception { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(new Atom("CH3")); m.addAtom(new Atom("C")); m.addAtom(new Atom("C")); m.addAtom(new Atom("C")); m.addAtom(new Atom("CH3")); m.addAtom(new Atom("H")); m.addAtom(new Atom("H")); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(1, 2, IBond.Order.DOUBLE); m.addBond(2, 3, IBond.Order.DOUBLE); m.addBond(3, 4, IBond.Order.SINGLE); m.addBond(1, 5, IBond.Order.SINGLE); m.addBond(3, 6, IBond.Order.SINGLE); int[][] atoms = new int[][]{{0, 5, 6, 4}, {5, 0, 6, 4}, {5, 0, 4, 6}, {0, 5, 4, 6}, {4, 6, 5, 0}, {4, 6, 0, 5}, {6, 4, 0, 5}, {6, 4, 5, 0},}; Stereo[] stereos = new Stereo[]{Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE}; for (int i = 0; i < atoms.length; i++) { IStereoElement element = new ExtendedTetrahedral(m.getAtom(2), new IAtom[]{m.getAtom(atoms[i][0]), m.getAtom(atoms[i][1]), m.getAtom(atoms[i][2]), m.getAtom(atoms[i][3])}, stereos[i]); m.setStereoElements(Collections.singletonList(element)); InChIGenerator generator = getFactory().getInChIGenerator(m); assertThat(generator.getInchi(), is("InChI=1S/C5H8/c1-3-5-4-2/h3-4H,1-2H3/t5-/m0/s1")); } }
@Test public void s_penta_2_3_diene_expl_h() throws Exception { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(new Atom("CH3")); m.addAtom(new Atom("C")); m.addAtom(new Atom("C")); m.addAtom(new Atom("C")); m.addAtom(new Atom("CH3")); m.addAtom(new Atom("H")); m.addAtom(new Atom("H")); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(1, 2, IBond.Order.DOUBLE); m.addBond(2, 3, IBond.Order.DOUBLE); m.addBond(3, 4, IBond.Order.SINGLE); m.addBond(1, 5, IBond.Order.SINGLE); m.addBond(3, 6, IBond.Order.SINGLE); int[][] atoms = new int[][]{{0, 5, 6, 4}, {5, 0, 6, 4}, {5, 0, 4, 6}, {0, 5, 4, 6}, {4, 6, 5, 0}, {4, 6, 0, 5}, {6, 4, 0, 5}, {6, 4, 5, 0},}; Stereo[] stereos = new Stereo[]{Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE, Stereo.CLOCKWISE, Stereo.ANTI_CLOCKWISE}; for (int i = 0; i < atoms.length; i++) { IStereoElement element = new ExtendedTetrahedral(m.getAtom(2), new IAtom[]{m.getAtom(atoms[i][0]), m.getAtom(atoms[i][1]), m.getAtom(atoms[i][2]), m.getAtom(atoms[i][3])}, stereos[i]); m.setStereoElements(Collections.singletonList(element)); InChIGenerator generator = getFactory().getInChIGenerator(m); assertThat(generator.getInchi(), is("InChI=1S/C5H8/c1-3-5-4-2/h3-4H,1-2H3/t5-/m1/s1")); } }