Statistiques
| Branche: | Tag: | Révision :

dockonsurf / tests / test_isolated.py @ b4b2f307

Historique | Voir | Annoter | Télécharger (1,49 ko)

1
from unittest import TestCase
2

    
3
from isolated import *
4

    
5
mol = Chem.MolFromMolFile('acetic.mol', removeHs=False)
6
num_confs = 5
7
Chem.EmbedMultipleConfs(mol, num_confs)
8

    
9

    
10
class Test(TestCase):
11
    def test_remove_c_linked_hs(self):
12
        h2o = Chem.MolFromSmiles('O')
13
        h2o = Chem.AddHs(h2o)
14
        ch4 = Chem.MolFromSmiles('C')
15
        ch4 = Chem.AddHs(ch4)
16
        self.assertEqual(len(remove_C_linked_Hs(h2o).GetAtoms()), 3)
17
        self.assertEqual(len(remove_C_linked_Hs(ch4).GetAtoms()), 1)
18

    
19
    def test_gen_confs(self):
20
        self.assertEqual(gen_confs(mol, num_confs).GetNumConformers(),
21
                         num_confs)
22

    
23
    """def test_rmsd(self):
24
        self.assertIsInstance(get_rmsd(mol), np.ndarray)
25
        self.assertEqual(get_rmsd(mol).shape, (num_confs, num_confs))
26
        tril_T = np.tril(get_rmsd(mol)).T
27
        triu = np.triu(get_rmsd(mol))
28
        self.assertTrue(np.array_equal(tril_T, triu))
29
        mol.RemoveAllConformers()
30
        self.assertRaises(ValueError, get_rmsd, mol)"""  # TODO -> clustering
31

    
32
    def test_moments_of_inertia(self):
33
        self.assertIsInstance(get_moments_of_inertia(mol), np.ndarray)
34
        self.assertEqual(get_moments_of_inertia(mol).shape, (num_confs, 3))
35

    
36
    def test_mmff_opt_confs(self):
37
        Chem.EmbedMultipleConfs(mol, num_confs)
38
        self.assertIsInstance(mmff_opt_confs(mol)[0], Chem.rdchem.Mol)
39
        self.assertIsInstance(mmff_opt_confs(mol)[1], np.ndarray)
40
        self.assertIsInstance(mmff_opt_confs(mol, max_iters=0), np.ndarray)