Пример #1
0
    def test_create_mol_from_smiles(self):
        from rdkit import Chem

        # Check create only for valid smiles
        self.assertIsNot(Molecule.create_from_smiles("C(C)(C)(C)(C)"), False)
        # Check not unicity of mol_rdkit field
        self.assertFalse(Molecule.create_from_smiles("C(C)(C)(C)(C)"))
        # Check create only for valid smiles
        self.assertFalse(Molecule.create_from_smiles("C(C)(C)(C)(C)(C)"))
        m = Molecule.create_from_smiles("CC1=CC=CC=C1")
        kekulize_options = {False: "Cc1ccccc1", True: "CC1=CC=CC=C1"}
        for k in kekulize_options:
            self.assertEqual(RDKit.mol_to_smiles(m.mol_rdkit, kekulize=k),
                             kekulize_options[k])
Пример #2
0
 def test_load_from_smiles(self):
     m = Molecule.create_from_smiles("CCC")
     self.assertIsNot(Molecule.load_from_smiles("CCC"), False)
     self.assertIsNot(Molecule.load_from_smiles("CCCC"), False)
     self.assertFalse(Molecule.load_from_smiles("HHOHH"))
Пример #3
0
 def test_find_from_smiles(self):
     m = Molecule.create_from_smiles("CC")
     self.assertIsNot(Molecule.find_from_smiles("CC"), False)
     self.assertEqual(Molecule.find_from_smiles("CC"), m)
     self.assertFalse(Molecule.find_from_smiles("C"))
Пример #4
0
 def test_smiles(self):
     sm_init = "C(C)(C)(C)(C)"
     sm_target = RDKit.mol_to_smiles(RDKit.mol_from_smiles(sm_init))
     m = Molecule.create_from_smiles(sm_init)
     self.assertEqual(m.smiles(), sm_target)
Пример #5
0
 def test_load_from_smiles(self):
     m = Molecule.create_from_smiles('CCC')
     self.assertIsNot(Molecule.load_from_smiles('CCC'), False)
     self.assertIsNot(Molecule.load_from_smiles('CCCC'), False)
     self.assertFalse(Molecule.load_from_smiles('HHOHH'))