def test_with_smiles(self, smiles, expected): mol = Chem.MolFromSmiles(smiles, sanitize=False) bt = smu_utils_lib.rdkit_molecule_to_bond_topology(mol) self.assertEqual(utilities.is_single_fragment(bt), expected) Chem.SanitizeMol(mol, Chem.rdmolops.SanitizeFlags.SANITIZE_ADJUSTHS) mol_h = Chem.AddHs(mol) bt_h = smu_utils_lib.rdkit_molecule_to_bond_topology(mol_h) self.assertEqual(utilities.is_single_fragment(bt_h), expected)
def test_single_fragment_3_atoms_0_bonds(self): bt = text_format.Parse( """ atoms: ATOM_C atoms: ATOM_C atoms: ATOM_C """, dataset_pb2.BondTopology()) self.assertFalse(utilities.is_single_fragment(bt))
def test_single_fragment_two_connected_atoms(self): bt = text_format.Parse( """ atoms: ATOM_C atoms: ATOM_C bonds { atom_a: 0 atom_b: 1 bond_type: BOND_SINGLE } """, dataset_pb2.BondTopology()) self.assertTrue(utilities.is_single_fragment(bt))
def test_single_fragment_4_atoms_3_bonds_no_ring(self): bt = text_format.Parse( """ atoms: ATOM_C atoms: ATOM_C atoms: ATOM_C atoms: ATOM_C bonds { atom_a: 0 atom_b: 1 bond_type: BOND_SINGLE } bonds { atom_a: 1 atom_b: 2 bond_type: BOND_SINGLE } bonds { atom_a: 2 atom_b: 3 bond_type: BOND_SINGLE } """, dataset_pb2.BondTopology()) self.assertTrue(utilities.is_single_fragment(bt))