diff --git a/sidechain/pymod/_reconstruct_sidechains.py b/sidechain/pymod/_reconstruct_sidechains.py index 7bc30c0b280171fc62d64771a0b9ecce717ecca3..8a2ced98b9dc1ffe58177726e788b39358cdf7f6 100644 --- a/sidechain/pymod/_reconstruct_sidechains.py +++ b/sidechain/pymod/_reconstruct_sidechains.py @@ -376,43 +376,48 @@ def _GetDisulfidBridges(frame_residues, cystein_indices, res_list, rotamer_libra def Reconstruct(ent, keep_sidechains=False, build_disulfids=True, rotamer_model="frm", consider_ligands=True, - rotamer_library=None): + rotamer_library=None, graph_max_complexity=100000000, + graph_intial_epsilon=0.02): '''Reconstruct sidechains for the given structure. - :param ent: Structure for sidechain reconstruction. Note, that the - sidechain reconstruction gets directly applied on the - structure itself. + :param ent: Structure for sidechain reconstruction. Note, that the sidechain + reconstruction gets directly applied on the structure itself. + :type ent: :class:`ost.mol.EntityHandle` :param keep_sidechains: Flag, whether complete sidechains in *ent* (i.e. containing all required atoms) should be kept rigid and directly be added to the frame. + :type keep_sidechains: :class:`bool` :param build_disulfids: Flag, whether possible disulfid bonds should be searched. If a disulfid bond is found, the two participating cysteins are fixed and added to the frame. + :type build_disulfids: :class:`bool` :param rotamer_model: Rotamer model to be used, can either be "frm" or "rrm" + :type rotamer_model: :class:`str` :param consider_hbonds: Flag, whether hbonds should be evaluated in the energy function. If set to False, no hydrogens will be built when building rotamers and frame. + :type consider_hbonds: :class:`bool` :param consider_ligands: Flag, whether to add ligands (anything in chain '_') as static objects. + :type consider_ligands: :class:`bool` :param rotamer_library: A rotamer library to extract the rotamers from. The default is the :meth:`Dunbrack <LoadDunbrackLib>` library. - - - :type ent: :class:`ost.mol.EntityHandle` - :type keep_sidechains: :class:`bool` - :type build_disulfids: :class:`bool` - :type rotamer_model: :class:`str` - :type consider_hbonds: :class:`bool` - :type consider_ligands: :class:`bool` - :type rotamer_library: :class:`BBDepRotamerLib` / :class:`RotamerLib` + :type rotamer_library: :class:`BBDepRotamerLib` / :class:`RotamerLib` + + :param graph_max_complexity: Max. complexity for + :meth:`RotamerGraph.TreeSolve`. + :type graph_max_complexity: :class:`int` + :param graph_intial_epsilon: Initial epsilon for + :meth:`RotamerGraph.TreeSolve`. + :type graph_intial_epsilon: :class:`float` ''' prof_name = 'sidechain::Reconstruct' prof = core.StaticRuntimeProfiler.StartScoped(prof_name) @@ -495,16 +500,19 @@ def Reconstruct(ent, keep_sidechains=False, build_disulfids=True, else: graph = sidechain.RotamerGraph.CreateFromRRMList(rotamer_groups) - solution = graph.TreeSolve(100000000,0.02)[0] + solution = graph.TreeSolve(max_complexity=graph_max_complexity, + initial_epsilon=graph_intial_epsilon)[0] # update structure - for i,rot_group,sol in zip(residues_with_rotamer_group,rotamer_groups,solution): + for i, rot_group, sol in zip(residues_with_rotamer_group, rotamer_groups, + solution): try: res_handle = prot.residues[i].handle rot_group[sol].ApplyOnResidue(res_handle, consider_hydrogens=False) sidechain.ConnectSidechain(res_handle, rotamer_ids[i]) except: - print "there is a backbone atom missing... ", res_handle.GetQualifiedName() + print "there is a backbone atom missing... ", \ + res_handle.GetQualifiedName() # these methods will be exported into module __all__ = ('Reconstruct',) diff --git a/sidechain/pymod/export_graph.cc b/sidechain/pymod/export_graph.cc index fb78d8fe3468409f85206303d404cbf17e4103e7..d572fcbcbc4bbe5a067d5ebd8ba91cd18746bfd5 100644 --- a/sidechain/pymod/export_graph.cc +++ b/sidechain/pymod/export_graph.cc @@ -59,17 +59,23 @@ boost::python::tuple WrapAStarSolve(RotamerGraphPtr graph, void export_Graph() { - class_<RotamerGraph,boost::noncopyable>("RotamerGraph", no_init) - .def("CreateFromRRMList",&WrapRRMList,(arg("rotamer_groups"))).staticmethod("CreateFromRRMList") - .def("CreateFromFRMList",&WrapFRMList,(arg("rotamer_groups"))).staticmethod("CreateFromFRMList") - .def("Prune",&RotamerGraph::Prune,(arg("epsilon"),arg("e_cut")=0.0,arg("consider_all_nodes")=false)) + class_<RotamerGraph, boost::noncopyable>("RotamerGraph", no_init) + .def("CreateFromRRMList", &WrapRRMList, (arg("rotamer_groups"))) + .staticmethod("CreateFromRRMList") + .def("CreateFromFRMList", &WrapFRMList, (arg("rotamer_groups"))) + .staticmethod("CreateFromFRMList") + .def("Prune", &RotamerGraph::Prune, + (arg("epsilon"), arg("e_cut")=0.0, arg("consider_all_nodes")=false)) .def("Reset", &RotamerGraph::Reset) .def("GetNumNodes", &RotamerGraph::GetNumNodes) .def("GetNumEdges", &RotamerGraph::GetNumEdges) .def("GetNumActiveNodes", &RotamerGraph::GetNumActiveNodes) .def("GetNumActiveEdges", &RotamerGraph::GetNumActiveEdges) - .def("TreeSolve",&WrapTreeSolve,(arg("max_complexity")=std::numeric_limits<uint64_t>::max(),arg("initial_epsilon")=0.02)) - .def("AStarSolve",&WrapAStarSolve,(arg("e_thresh"),arg("max_n")=100,arg("max_visited_nodes")=100000000)) + .def("TreeSolve", &WrapTreeSolve, + (arg("max_complexity")=std::numeric_limits<uint64_t>::max(), + arg("initial_epsilon")=0.02)) + .def("AStarSolve", &WrapAStarSolve, + (arg("e_thresh"), arg("max_n")=100, arg("max_visited_nodes")=100000000)) ; register_ptr_to_python<RotamerGraphPtr>();