Esempio n. 1
0
    def test_extended_connectivities(self):
        mol = helium.Molecule()
        SMILES.read('CCC', mol)

        ec = helium.extended_connectivities(mol, helium.DefaultAtomInvariant())
        self.assertTrue(isinstance(ec, list))
        self.assertEqual(3, len(ec))

        ec = helium.extended_connectivities(mol, TestAtomInvariant())
        self.assertTrue(isinstance(ec, list))
        self.assertEqual(3, len(ec))
Esempio n. 2
0
    def test_canonical(self):
        mol = helium.Molecule()
        SMILES.read('CCC', mol)

        atomInvariant1 = helium.DefaultAtomInvariant()
        atomInvariant2 = TestAtomInvariant()
        bondInvariant1 = helium.DefaultBondInvariant()
        bondInvariant2 = TestBondInvariant()

        ec = helium.extended_connectivities(mol, atomInvariant1)

        can = helium.canonicalize_component(mol, ec, atomInvariant1, bondInvariant1)
        self.assertTrue(isinstance(can, tuple))
        self.assertTrue(isinstance(can[0], list))
        self.assertTrue(isinstance(can[1], list))
        self.assertEqual(3, len(can[0]))

        can = helium.canonicalize_component(mol, ec, atomInvariant2, bondInvariant1)
        self.assertTrue(isinstance(can, tuple))
        self.assertTrue(isinstance(can[0], list))
        self.assertTrue(isinstance(can[1], list))
        self.assertEqual(3, len(can[0]))

        can = helium.canonicalize_component(mol, ec, atomInvariant1, bondInvariant2)
        self.assertTrue(isinstance(can, tuple))
        self.assertTrue(isinstance(can[0], list))
        self.assertTrue(isinstance(can[1], list))
        self.assertEqual(3, len(can[0]))

        can = helium.canonicalize_component(mol, ec, atomInvariant2, bondInvariant2)
        self.assertTrue(isinstance(can, tuple))
        self.assertTrue(isinstance(can[0], list))
        self.assertTrue(isinstance(can[1], list))
        self.assertEqual(3, len(can[0]))
Esempio n. 3
0
    def test_default_atom_invariant(self):
        mol = helium.Molecule()
        SMILES.read('CNO', mol)

        invariant = helium.DefaultAtomInvariant()
        self.assertEqual(2110012006, invariant(mol, mol.atom(0)))

        invariant = helium.DefaultAtomInvariant(helium.DefaultAtomInvariant.Invariants.Element)
        self.assertEqual(6, invariant(mol, mol.atom(0)))

        invariant = helium.DefaultAtomInvariant(helium.DefaultAtomInvariant.Invariants.Mass)
        self.assertEqual(12000, invariant(mol, mol.atom(0)))

        ec = helium.extended_connectivities(mol, invariant)
        self.assertTrue(isinstance(ec, list))
        self.assertEqual(3, len(ec))
Esempio n. 4
0
    def test_default_atom_invariant(self):
        mol = helium.Molecule()
        SMILES.read('CNO', mol)

        invariant = helium.DefaultAtomInvariant()
        self.assertEqual(2110012006, invariant(mol, mol.atom(0)))

        invariant = helium.DefaultAtomInvariant(
            helium.DefaultAtomInvariant.Invariants.Element)
        self.assertEqual(6, invariant(mol, mol.atom(0)))

        invariant = helium.DefaultAtomInvariant(
            helium.DefaultAtomInvariant.Invariants.Mass)
        self.assertEqual(12000, invariant(mol, mol.atom(0)))

        ec = helium.extended_connectivities(mol, invariant)
        self.assertTrue(isinstance(ec, list))
        self.assertEqual(3, len(ec))
Esempio n. 5
0
    def test_canonical(self):
        mol = helium.Molecule()
        SMILES.read('CCC', mol)

        atomInvariant1 = helium.DefaultAtomInvariant()
        atomInvariant2 = TestAtomInvariant()
        bondInvariant1 = helium.DefaultBondInvariant()
        bondInvariant2 = TestBondInvariant()

        ec = helium.extended_connectivities(mol, atomInvariant1)

        can = helium.canonicalize_component(mol, ec, atomInvariant1,
                                            bondInvariant1)
        self.assertTrue(isinstance(can, tuple))
        self.assertTrue(isinstance(can[0], list))
        self.assertTrue(isinstance(can[1], list))
        self.assertEqual(3, len(can[0]))

        can = helium.canonicalize_component(mol, ec, atomInvariant2,
                                            bondInvariant1)
        self.assertTrue(isinstance(can, tuple))
        self.assertTrue(isinstance(can[0], list))
        self.assertTrue(isinstance(can[1], list))
        self.assertEqual(3, len(can[0]))

        can = helium.canonicalize_component(mol, ec, atomInvariant1,
                                            bondInvariant2)
        self.assertTrue(isinstance(can, tuple))
        self.assertTrue(isinstance(can[0], list))
        self.assertTrue(isinstance(can[1], list))
        self.assertEqual(3, len(can[0]))

        can = helium.canonicalize_component(mol, ec, atomInvariant2,
                                            bondInvariant2)
        self.assertTrue(isinstance(can, tuple))
        self.assertTrue(isinstance(can[0], list))
        self.assertTrue(isinstance(can[1], list))
        self.assertEqual(3, len(can[0]))