@Test
  public void testFingerprinter_int_int() throws java.lang.Exception {
    ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(1024);
    Assert.assertNotNull(fingerprinter);

    IAtomContainer mol = TestMoleculeFactory.makeIndole();
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
    BitSet bs = fingerprinter.getBitFingerprint(mol).asBitSet();
    IAtomContainer frag1 = TestMoleculeFactory.makePyrrole();
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(frag1);
    BitSet bs1 = fingerprinter.getBitFingerprint(frag1).asBitSet();
    Assert.assertTrue(FingerprinterTool.isSubset(bs, bs1));
  }
 @Test
 public void testRegression() throws Exception {
   IAtomContainer mol1 = TestMoleculeFactory.makeIndole();
   IAtomContainer mol2 = TestMoleculeFactory.makePyrrole();
   AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1);
   AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2);
   ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter();
   IBitFingerprint bs1 = fingerprinter.getBitFingerprint(mol1);
   Assert.assertEquals(
       "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!",
       22,
       bs1.cardinality());
   IBitFingerprint bs2 = fingerprinter.getBitFingerprint(mol2);
   Assert.assertEquals(
       "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!",
       11,
       bs2.cardinality());
 }
Esempio n. 3
0
 @Test
 public void testWriteSMILESFile() throws Exception {
   StringWriter stringWriter = new StringWriter();
   IAtomContainer benzene = TestMoleculeFactory.makeBenzene();
   addImplicitHydrogens(benzene);
   SMILESWriter smilesWriter = new SMILESWriter(stringWriter);
   smilesWriter.write(benzene);
   smilesWriter.close();
   Assert.assertTrue(stringWriter.toString().contains("C=C"));
 }
 @Test
 public void testFingerprinterBitSetSize() throws Exception {
   ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(1024);
   Assert.assertNotNull(fingerprinter);
   IAtomContainer mol = TestMoleculeFactory.makeIndole();
   AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
   BitSet bs = fingerprinter.getBitFingerprint(mol).asBitSet();
   Assert.assertEquals(1024, bs.length()); // highest set bit
   Assert.assertEquals(1024, bs.size()); // actual bit set size
 }
  @Test
  public void testgetBitFingerprint_IAtomContainer() throws java.lang.Exception {
    ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter();

    IAtomContainer mol = TestMoleculeFactory.makeIndole();
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
    IBitFingerprint bs = fingerprinter.getBitFingerprint(mol);
    Assert.assertNotNull(bs);
    Assert.assertEquals(fingerprinter.getSize(), bs.size());
  }
  @Test
  public void testAtomPermutation2() throws CDKException {
    IAtomContainer pamine = TestMoleculeFactory.makeCyclopentane();
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(pamine);
    ShortestPathFingerprinter fp = new ShortestPathFingerprinter();
    IBitFingerprint bs1 = fp.getBitFingerprint(pamine);

    AtomContainerAtomPermutor acp = new AtomContainerAtomPermutor(pamine);
    while (acp.hasNext()) {
      IAtomContainer container = acp.next();
      IBitFingerprint bs2 = fp.getBitFingerprint(container);
      Assert.assertTrue(bs1.equals(bs2));
    }
  }
Esempio n. 7
0
  @Test
  public void testWriteAromatic() throws Exception {
    StringWriter stringWriter = new StringWriter();
    IAtomContainer benzene = TestMoleculeFactory.makeBenzene();
    addImplicitHydrogens(benzene);
    CDKHueckelAromaticityDetector.detectAromaticity(benzene);

    SMILESWriter smilesWriter = new SMILESWriter(stringWriter);
    Properties prop = new Properties();
    prop.setProperty("UseAromaticity", "true");
    PropertiesListener listener = new PropertiesListener(prop);
    smilesWriter.addChemObjectIOListener(listener);
    smilesWriter.customizeJob();
    smilesWriter.write(benzene);
    smilesWriter.close();
    Assert.assertFalse(stringWriter.toString().contains("C=C"));
    Assert.assertTrue(stringWriter.toString().contains("ccc"));
  }
Esempio n. 8
0
 @Test
 public void imidazole_ignoreAromatic() throws Exception {
   Graph g = convert(TestMoleculeFactory.makeImidazole(), true, true, false, true);
   assertThat(g.toSmiles(), is("C=1NC=NC1"));
 }
Esempio n. 9
0
 @Test
 public void imidazole() throws Exception {
   Graph g = convert(TestMoleculeFactory.makeImidazole(), true, true);
   assertThat(g.toSmiles(), is("c1[nH]cnc1"));
 }
Esempio n. 10
0
 @Test
 public void benzene() throws Exception {
   IAtomContainer ac = TestMoleculeFactory.makeBenzene();
   Graph g = convert(ac, true, true);
   assertThat(g.toSmiles(), is("c1ccccc1"));
 }
Esempio n. 11
0
 @Test
 public void benzene_kekule() throws Exception {
   Graph g = convert(TestMoleculeFactory.makeBenzene());
   assertThat(g.toSmiles(), is("C=1C=CC=CC1"));
 }
Esempio n. 12
0
 @Test
 public void adeneine() throws Exception {
   Graph g = convert(TestMoleculeFactory.makeAdenine());
   assertThat(g.toSmiles(), is("C12=C(N=CN=C1N)NC=N2"));
 }