Ejemplo n.º 1
0
 def test_with_smiles(self, smiles, expected):
     mol = Chem.MolFromSmiles(smiles, sanitize=False)
     bt = utilities.molecule_to_bond_topology(mol)
     self.assertEqual(utilities.is_single_fragment(bt), expected)
     mol_h = Chem.AddHs(mol)
     bt_h = utilities.molecule_to_bond_topology(mol_h)
     self.assertEqual(utilities.is_single_fragment(bt_h), expected)
Ejemplo n.º 2
0
    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))
Ejemplo n.º 3
0
    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))
Ejemplo n.º 4
0
    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))