@Test public void testViaFlags() throws Exception { IAtomContainer molecule = TestMoleculeFactory.makeBenzene(); for (Iterator atoms = molecule.atoms().iterator(); atoms.hasNext();) { ((IAtom) atoms.next()).setFlag(CDKConstants.ISAROMATIC, true); } Assert.assertEquals(6, ((IntegerResult) descriptor.calculate(molecule).getValue()).intValue()); } }
@Test public void test3LargestChainDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true), new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C=CC=CCc2ccc(Cc1ccncc1C=C)cc2"); //logger.debug("test3>"+((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); Assert.assertEquals(5, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void test6LargestChainDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true), new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCNOC"); //logger.debug("test6>"+((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); Assert.assertEquals(5, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void testSingleCAtom() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true), new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C"); //logger.debug("test7>"+((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); Assert.assertEquals(0, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void test11LargestChainDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true), new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("COc1ccc(cc1)c1noc(c1)Cn1nc(C)c(c(c1=O)C#N)C"); Assert.assertEquals(2, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void test2LargestChainDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true), new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C=CC=Cc1ccccc1"); //logger.debug("test2>"+((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); Assert.assertEquals(4, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void test4LargestChainDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true), new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CC=CNCC"); //logger.debug("test4>"+((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); Assert.assertEquals(6, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void testSingleOAtom() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true), new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("O"); //logger.debug("test7>"+((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); Assert.assertEquals(0, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void test8LargestChainDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true), new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("Cc1nn(c(c1)N)c1nc2c(s1)cccc2"); Assert.assertEquals(0, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void testDiSpiroPentane() throws Exception { IAtomContainer mol = sp.parseSmiles("CC1C[C]11(CC1)[C]123CC1.C2C3"); // ethanol DescriptorValue value = descriptor.calculate(mol); Assert.assertEquals(2, ((IntegerResult) value.getValue()).intValue()); }
@Test public void testHBondAcceptorCountDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); // original molecule O=N(=O)c1cccc2cn[nH]c12 - correct kekulisation will give // the same result. this test though should depend on kekulisation working IAtomContainer mol = sp.parseSmiles("O=N(=O)C1=C2NN=CC2=CC=C1"); Assert.assertEquals(1, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void test1LongestAliphaticChainDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCCCc1ccccc1"); // benzol //logger.debug("test1>:"+((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); Assert.assertEquals(4, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void test3LargestChainDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C=C(CCC1CC1C(C)C(C)C)C(C)CC2CCCC2"); //logger.debug("test3>"+((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); Assert.assertEquals(5, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void test4LargestChainDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(true)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCCCNCC"); //logger.debug("test4>"+((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); Assert.assertEquals(4, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void test1LargestPiSystemDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { Object[] params = {new Boolean(false)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("c1ccccc1"); // benzol Assert.assertEquals(6, ((IntegerResult)descriptor.calculate(mol).getValue()).intValue()); }
/** * @see <a href="https://github.com/cdk/cdk/issues/495">Issue 495</a> */ @Test public void exocyclicOxygenInAromaticRing() throws InvalidSmilesException { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer m = sp.parseSmiles("Cn1c2nc([nH]c2c(=O)n(c1=O)C)C1CCCC1"); HBondAcceptorCountDescriptor hbond_acceptor_desc = new HBondAcceptorCountDescriptor(); int actual = ((IntegerResult)hbond_acceptor_desc.calculate(m).getValue()).intValue(); Assert.assertThat(actual, CoreMatchers.is(3)); } }
@Test public void testButaneIncludeTerminals() throws Exception { IAtomContainer container = makeButane(); IMolecularDescriptor descriptor = new RotatableBondsCountDescriptor(); descriptor.setParameters(new Object[]{true, false}); DescriptorValue result = descriptor.calculate(container); Assert.assertEquals(3, ((IntegerResult) result.getValue()).intValue()); }
@Test public void testSulphurAcidGroup() throws Exception { SmilesParser sp = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("OS(=O)(=O)O"); IntegerResult result = (IntegerResult) descriptor.calculate(mol).getValue(); Assert.assertEquals(2, result.intValue()); }
@Test public void testAromaticAtomsCountDescriptor() throws java.lang.Exception { Object[] params = {true}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCOc1ccccc1"); // ethanol Assert.assertEquals(6, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue()); }
@Test public void testAtomValenceDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { IAtomicDescriptor descriptor = new AtomValenceDescriptor(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCCl"); // Assert.assertEquals(7, ((IntegerResult) descriptor.calculate(mol.getAtom(2), mol).getValue()).intValue()); } }