InChITautomerGenerator { public List<IAtomContainer> getTautomers(IAtomContainer mol) throws CDKException, CloneNotSupportedException { String opt = ""; if ((flags & KETO_ENOL) != 0) opt += " -KET"; if ((flags & ONE_FIVE_SHIFT) != 0) opt += " -15T"; InChIGenerator gen = InChIGeneratorFactory.getInstance().getInChIGenerator(mol, opt); String inchi = gen.getInchi(); String aux = gen.getAuxInfo(); long[] amap = new long[mol.getAtomCount()]; InChINumbersTools.parseAuxInfo(aux, amap); if (inchi == null) throw new CDKException(InChIGenerator.class + " failed to create an InChI for the provided molecule, InChI -> null."); return getTautomers(mol, inchi, amap); } InChITautomerGenerator(int flags);  InChITautomerGenerator(); List<IAtomContainer> getTautomers(IAtomContainer mol); @Deprecated List<IAtomContainer> getTautomers(IAtomContainer mol, String inchi); static final int KETO_ENOL; static final int ONE_FIVE_SHIFT; }
@Test public void test_withJniInchi() throws Exception { String mdlInput = "\n" + " Mrv0541 02151109592D\n" + "\n" + " 9 9 0 0 0 0 999 V2000\n" + " 2.1434 -0.4125 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 1.4289 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 0.7145 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 0.0000 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n" + " -0.7145 -0.4125 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 0.0000 0.8250 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 0.7145 1.2375 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 0.7145 2.0625 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 1.4289 0.8250 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n" + " 1 2 1 0 0 0 0\n" + " 2 3 2 0 0 0 0\n" + " 3 4 1 0 0 0 0\n" + " 4 5 1 0 0 0 0\n" + " 4 6 2 0 0 0 0\n" + " 6 7 1 0 0 0 0\n" + " 7 8 1 0 0 0 0\n" + " 7 9 2 0 0 0 0\n" + " 2 9 1 0 0 0 0\n" + "M END\n"; MDLV2000Reader reader = new MDLV2000Reader(new StringReader(mdlInput)); IAtomContainer molecule = reader.read(new AtomContainer()); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(molecule.getBuilder()); hAdder.addImplicitHydrogens(molecule); List<IAtomContainer> tautomers = tautomerGenerator.getTautomers(molecule); Assert.assertEquals(5, tautomers.size()); }
@Test public void testAdenine() throws CDKException, CloneNotSupportedException { IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance(); IAtomContainer mol = builder.newInstance(IAtomContainer.class); IAtom a1 = builder.newInstance(IAtom.class, "N"); mol.addAtom(a1); IAtom a2 = builder.newInstance(IAtom.class, "N"); mol.addAtom(a2); IAtom a3 = builder.newInstance(IAtom.class, "N"); mol.addAtom(a3); IAtom a4 = builder.newInstance(IAtom.class, "N"); mol.addAtom(a4); IAtom a5 = builder.newInstance(IAtom.class, "N"); mol.addAtom(a5); IAtom a6 = builder.newInstance(IAtom.class, "C"); mol.addAtom(a6); IAtom a7 = builder.newInstance(IAtom.class, "C"); mol.addAtom(a7); IAtom a8 = builder.newInstance(IAtom.class, "C"); mol.addAtom(a8); IAtom a9 = builder.newInstance(IAtom.class, "C"); mol.addAtom(a9); IAtom a10 = builder.newInstance(IAtom.class, "C"); mol.addAtom(a10); IAtom a11 = builder.newInstance(IAtom.class, "H"); mol.addAtom(a11); IAtom a12 = builder.newInstance(IAtom.class, "H"); mol.addAtom(a12); IAtom a13 = builder.newInstance(IAtom.class, "H"); mol.addAtom(a13); IAtom a14 = builder.newInstance(IAtom.class, "H"); mol.addAtom(a14); IAtom a15 = builder.newInstance(IAtom.class, "H"); mol.addAtom(a15); IBond b1 = builder.newInstance(IBond.class, a1, a6, IBond.Order.SINGLE); mol.addBond(b1); IBond b2 = builder.newInstance(IBond.class, a1, a9, IBond.Order.SINGLE); mol.addBond(b2); IBond b3 = builder.newInstance(IBond.class, a1, a11, IBond.Order.SINGLE); mol.addBond(b3); IBond b4 = builder.newInstance(IBond.class, a2, a7, IBond.Order.SINGLE); mol.addBond(b4); IBond b5 = builder.newInstance(IBond.class, a2, a9, IBond.Order.DOUBLE); mol.addBond(b5); IBond b6 = builder.newInstance(IBond.class, a3, a7, IBond.Order.DOUBLE); mol.addBond(b6); IBond b7 = builder.newInstance(IBond.class, a3, a10, IBond.Order.SINGLE); mol.addBond(b7); IBond b8 = builder.newInstance(IBond.class, a4, a8, IBond.Order.SINGLE); mol.addBond(b8); IBond b9 = builder.newInstance(IBond.class, a4, a10, IBond.Order.DOUBLE); mol.addBond(b9); IBond b10 = builder.newInstance(IBond.class, a5, a8, IBond.Order.SINGLE); mol.addBond(b10); IBond b11 = builder.newInstance(IBond.class, a5, a14, IBond.Order.SINGLE); mol.addBond(b11); IBond b12 = builder.newInstance(IBond.class, a5, a15, IBond.Order.SINGLE); mol.addBond(b12); IBond b13 = builder.newInstance(IBond.class, a6, a7, IBond.Order.SINGLE); mol.addBond(b13); IBond b14 = builder.newInstance(IBond.class, a6, a8, IBond.Order.DOUBLE); mol.addBond(b14); IBond b15 = builder.newInstance(IBond.class, a9, a12, IBond.Order.SINGLE); mol.addBond(b15); IBond b16 = builder.newInstance(IBond.class, a10, a13, IBond.Order.SINGLE); mol.addBond(b16); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); List<IAtomContainer> tautomers = tautomerGenerator.getTautomers(mol); Assert.assertEquals(8, tautomers.size()); }