def test_repair_graph_with_mutation_modification_error(system_mod, caplog, resid, mutations, modifications): mol = system_mod.molecules[0] # Let's mutate res1 to ALA for node_idx in mol: if mol.nodes[node_idx].get('resid') == resid: if mutations: mol.nodes[node_idx]['mutation'] = mutations if modifications: mol.nodes[node_idx]['modification'] = modifications with pytest.raises(ValueError), caplog.at_level(logging.WARNING): assert not caplog.records mol = vermouth.RepairGraph().run_molecule(mol) assert len(caplog.records) == 1
def test_repair_graph_with_mutation_modification(system_mod, resid, mutations, modifications, atomnames): mol = system_mod.molecules[0] # Let's mutate res1 to ALA for node_idx in mol: if mol.nodes[node_idx].get('resid') == resid: if mutations: mol.nodes[node_idx]['mutation'] = mutations if modifications: mol.nodes[node_idx]['modification'] = modifications mol = vermouth.RepairGraph().run_molecule(mol) resid1_atomnames = set() for node_idx in mol: if mol.nodes[node_idx].get('resid') == resid: if mutations: assert mol.nodes[node_idx]['resname'] == mutations[0] if modifications: assert mol.nodes[node_idx].get('modification') == modifications resid1_atomnames.add(mol.nodes[node_idx]['atomname']) assert resid1_atomnames == set(atomnames.split())
def repaired_graph(request, system_mod): vermouth.RepairGraph(include_graph=request.param).run_system(system_mod) return system_mod