Пример #1
0
 def test_substructs_same_center_diff_atoms_nonequal(self):
     from e3fp.fingerprint.structs import Substruct
     from e3fp.conformer.util import mol_from_sdf
     mol = mol_from_sdf(PLANAR_SDF_FILE)
     atoms = list(mol.GetAtoms())
     substruct1 = Substruct(atoms[0], atoms[1:])
     substruct2 = Substruct(atoms[0], atoms[2:])
     self.assertNotEqual(substruct1, substruct2)
Пример #2
0
 def test_equal_shells_hash_to_same_value(self):
     from e3fp.fingerprint.structs import Substruct
     from e3fp.conformer.util import mol_from_sdf
     mol = mol_from_sdf(PLANAR_SDF_FILE)
     atoms = list(mol.GetAtoms())
     center_atom = atoms[0]
     substruct1 = Substruct(center_atom, atoms[1:])
     substruct2 = Substruct(center_atom, atoms[1:])
     self.assertEqual(hash(substruct1), hash(substruct2))
Пример #3
0
 def test_substructs_same_center_same_atoms_equal(self):
     from e3fp.fingerprint.structs import Substruct
     from e3fp.conformer.util import mol_from_sdf
     mol = mol_from_sdf(PLANAR_SDF_FILE)
     atoms = list(mol.GetAtoms())
     center_atom = atoms[0]
     substruct1 = Substruct(center_atom, atoms)
     substruct2 = Substruct(center_atom, atoms)
     self.assertEqual(substruct1, substruct2)
Пример #4
0
 def test_center_atom_auto_added_to_atoms(self):
     from e3fp.fingerprint.structs import Substruct
     from e3fp.conformer.util import mol_from_sdf
     mol = mol_from_sdf(PLANAR_SDF_FILE)
     atoms = list(mol.GetAtoms())
     center_atom = atoms[0]
     substruct = Substruct(center_atom, atoms[1:])
     self.assertIn(center_atom.GetIdx(), substruct.atoms)
Пример #5
0
 def test_substruct_creation_from_shell(self):
     from e3fp.fingerprint.structs import Shell, Substruct
     from e3fp.conformer.util import mol_from_sdf
     mol = mol_from_sdf(PLANAR_SDF_FILE)
     atoms = list(mol.GetAtoms())
     shell = Shell(atoms[0], atoms[1:])
     substruct = Substruct.from_shell(shell)
     self.assertEqual(shell.substruct, substruct)
Пример #6
0
 def test_shell_creation_from_substruct_without_center_fails(self):
     from e3fp.fingerprint.structs import Shell, Substruct, FormatError
     from e3fp.conformer.util import mol_from_sdf
     mol = mol_from_sdf(PLANAR_SDF_FILE)
     atoms = list(mol.GetAtoms())
     substruct = Substruct(None, atoms[:2])
     with self.assertRaises(FormatError):
         Shell.from_substruct(substruct)
Пример #7
0
    def test_error_when_atoms_has_non_atom(self):
        from e3fp.fingerprint.structs import Substruct

        atoms = [None]
        with self.assertRaises(TypeError):
            Substruct(atoms=atoms)
Пример #8
0
    def test_error_when_center_not_atom(self):
        from e3fp.fingerprint.structs import Substruct

        with self.assertRaises(TypeError):
            Substruct("foo")