Exemple #1
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"));
 }
Exemple #2
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"));
  }
Exemple #3
0
 @Test
 public void benzene() throws Exception {
   IAtomContainer ac = TestMoleculeFactory.makeBenzene();
   Graph g = convert(ac, true, true);
   assertThat(g.toSmiles(), is("c1ccccc1"));
 }
Exemple #4
0
 @Test
 public void benzene_kekule() throws Exception {
   Graph g = convert(TestMoleculeFactory.makeBenzene());
   assertThat(g.toSmiles(), is("C=1C=CC=CC1"));
 }