def test_ptm_groups(atoms, edges, expected): """ Make sure PTM atoms are grouped correctly with appropriate anchors """ molecule = make_molecule(atoms, edges) found = canmod.find_ptm_atoms(molecule) assert expected == found
def test_identify_ptms(known_ptm_graphs, atoms, edges, expected): """ Make sure PTMs are identified correctly. """ molecule = make_molecule(atoms, edges) ptms = canmod.find_ptm_atoms(molecule) known_ptms = [(ptm_graph, nx.isomorphism.GraphMatcher(molecule, ptm_graph, node_match=canmod.ptm_node_matcher)) for ptm_graph in known_ptm_graphs] found = canmod.identify_ptms(molecule, ptms, known_ptms) found = [(ptm.name, match) for ptm, match in found] assert found == expected