Пример #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"));
 }
Пример #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"));
  }