public void fullPermutationTest(IAtomContainer mol) {
   AtomContainerAtomPermutor permutor = new AtomContainerAtomPermutor(mol);
   String expected = new MoleculeSignature(mol).toCanonicalString();
   int numberOfPermutationsTried = 0;
   while (permutor.hasNext()) {
     IAtomContainer permutation = permutor.next();
     String actual = new MoleculeSignature(permutation).toCanonicalString();
     numberOfPermutationsTried++;
     String msg = "Failed on permutation " + numberOfPermutationsTried;
     Assert.assertEquals(msg, expected, actual);
   }
 }
  @Test
  public void testAtomPermutation() throws CDKException {
    IAtomContainer pamine = makePropylAmine();
    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));
    }
  }
  @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));
    }
  }
Beispiel #4
0
 /** A unit test for JUnit */
 @Test
 public void testAtomPermutation() {
   IAtomContainer mol = new AtomContainer();
   mol.addAtom(new Atom("S"));
   mol.addAtom(new Atom("O"));
   mol.addAtom(new Atom("O"));
   mol.addAtom(new Atom("O"));
   mol.addAtom(new Atom("O"));
   mol.addBond(0, 1, IBond.Order.DOUBLE);
   mol.addBond(0, 2, IBond.Order.DOUBLE);
   mol.addBond(0, 3, IBond.Order.SINGLE);
   mol.addBond(0, 4, IBond.Order.SINGLE);
   mol.getAtom(3).setImplicitHydrogenCount(1);
   mol.getAtom(4).setImplicitHydrogenCount(1);
   AtomContainerAtomPermutor acap = new AtomContainerAtomPermutor(mol);
   SmilesGenerator sg = new SmilesGenerator();
   String smiles = "";
   String oldSmiles = sg.createSMILES(mol);
   while (acap.hasNext()) {
     smiles = sg.createSMILES(new AtomContainer((AtomContainer) acap.next()));
     // logger.debug(smiles);
     Assert.assertEquals(oldSmiles, smiles);
   }
 }