diff --git a/modules/mol/alg/doc/molalg.rst b/modules/mol/alg/doc/molalg.rst index 89b170b958a7ef759f03ace52e823edbb9b261a0..3f44eae5de575b507c08cc692be5d8bd77e48bf4 100644 --- a/modules/mol/alg/doc/molalg.rst +++ b/modules/mol/alg/doc/molalg.rst @@ -1356,7 +1356,8 @@ API .. function:: Molck(ent, lib, settings, [prune=True]) - Runs Molck on provided entity. + Runs Molck on provided entity. Reprocesses *ent* with + :class:`ost.conop.HeuristicProcessor` and given *lib* once done. :param ent: Structure to check :type ent: :class:`~ost.mol.EntityHandle` @@ -1369,8 +1370,7 @@ API :type prune: :class:`bool` - -.. function:: MapNonStandardResidues(ent, lib) +.. function:: MapNonStandardResidues(ent, lib, reprocess=True) Maps modified residues back to the parent amino acid, for example MSE -> MET. @@ -1378,10 +1378,16 @@ API :type ent: :class:`~ost.mol.EntityHandle` :param lib: Compound library :type lib: :class:`~ost.conop.CompoundLib` + :param reprocess: The function generates a deep copy of *ent*. Highly + recommended to enable *reprocess* that runs + :class:`ost.conop.HeuristicProcessor` with given *lib*. + If set to False, you'll have no connectivity etc. after + calling this function. .. function:: RemoveAtoms(ent, lib, rm_unk_atoms=False, rm_non_std=False, \ rm_hyd_atoms=True, rm_oxt_atoms=False, \ - rm_zero_occ_atoms=False, colored=False) + rm_zero_occ_atoms=False, colored=False, + reprocess=True) Removes atoms and residues according to some criteria. @@ -1395,6 +1401,11 @@ API :param rm_oxt_atoms: See :attr:`MolckSettings.rm_oxt_atoms` :param rm_zero_occ_atoms: See :attr:`MolckSettings.rm_zero_occ_atoms` :param colored: See :attr:`MolckSettings.colored` + :param reprocess: Removing atoms may impact certain annotations on the + structure (chem class etc.) which are set by + :class:`ost.conop.Processor`. If set to True, + a :class:`ost.conop.HeuristicProcessor` with given + *lib* reprocesses *ent*. .. function:: CleanUpElementColumn(ent, lib) diff --git a/modules/mol/alg/pymod/export_molck.cc b/modules/mol/alg/pymod/export_molck.cc index 9671434ba012bf41f2d7494479e905092130cbe8..aa50a674f6775536e05ce38796f4a0458c1826a5 100644 --- a/modules/mol/alg/pymod/export_molck.cc +++ b/modules/mol/alg/pymod/export_molck.cc @@ -121,7 +121,7 @@ void export_Molck() def("MapNonStandardResidues", &MapNonStandardResidues, (arg("ent"), arg("lib"), - arg("log_diags")=false)); + arg("reprocess")=true)); def("RemoveAtoms", &RemoveAtoms, (arg("ent"), arg("lib"), @@ -130,7 +130,8 @@ void export_Molck() arg("rm_hyd_atoms")=true, arg("rm_oxt_atoms")=false, arg("rm_zero_occ_atoms")=false, - arg("colored")=false)); + arg("colored")=false, + arg("reprocess")=true)); def("CleanUpElementColumn", &CleanUpElementColumn, (arg("ent"), arg("lib"))); diff --git a/modules/mol/alg/src/molck.cc b/modules/mol/alg/src/molck.cc index 1a140b559f6639ee9132d0fec836cdddeb73d39b..d9dd3ce63f295d02ab77ed645fda3d1bcaf91411 100644 --- a/modules/mol/alg/src/molck.cc +++ b/modules/mol/alg/src/molck.cc @@ -12,7 +12,7 @@ using namespace ost::mol; namespace ost{ namespace mol{ namespace alg{ -void MapNonStandardResidues(EntityHandle& ent, CompoundLibPtr lib, bool log_diags) { +void MapNonStandardResidues(EntityHandle& ent, CompoundLibPtr lib, bool reprocess) { // TODO: Maybe it is possible to make it in-place operation if(!lib) { @@ -52,9 +52,11 @@ void MapNonStandardResidues(EntityHandle& ent, CompoundLibPtr lib, bool log_diag } } ent = new_ent; - // Since we didn't do it in-place: reprocess the new entity - RuleBasedProcessor pr(lib); - pr.Process(ent, log_diags); + + if(reprocess) { + RuleBasedProcessor pr(lib); + pr.Process(ent, false); + } } void RemoveAtoms(EntityHandle& ent, @@ -64,7 +66,8 @@ void RemoveAtoms(EntityHandle& ent, bool rm_hyd_atoms, bool rm_oxt_atoms, bool rm_zero_occ_atoms, - bool colored /*=true*/){ + bool colored, /*=true*/ + bool reprocess){ if(!lib) { throw ost::Error("Require valid compound library!"); @@ -140,6 +143,11 @@ void RemoveAtoms(EntityHandle& ent, } LOG_INFO(ss.str()); } + + if(reprocess) { + RuleBasedProcessor pr(lib); + pr.Process(ent, false); + } } void CleanUpElementColumn(EntityHandle& ent, CompoundLibPtr lib){ @@ -191,7 +199,8 @@ void Molck(ost::mol::EntityHandle& ent, settings.rm_hyd_atoms, settings.rm_oxt_atoms, settings.rm_zero_occ_atoms, - settings.colored); + settings.colored, + false); if (settings.assign_elem) { CleanUpElementColumn(ent, lib); } @@ -199,7 +208,11 @@ void Molck(ost::mol::EntityHandle& ent, if(prune) { ost::mol::XCSEditor edi = ent.EditXCS(); edi.Prune(); - } + } + + // reprocess + RuleBasedProcessor pr(lib); + pr.Process(ent, false); } }}} // ns \ No newline at end of file diff --git a/modules/mol/alg/src/molck.hh b/modules/mol/alg/src/molck.hh index 0dae68b930a4f20da86049d471c1fca70626df14..145171b8e88b5c35111a47366c0f0d3a996cfcbe 100644 --- a/modules/mol/alg/src/molck.hh +++ b/modules/mol/alg/src/molck.hh @@ -81,7 +81,7 @@ struct MolckSettings{ void MapNonStandardResidues(ost::mol::EntityHandle& ent, ost::conop::CompoundLibPtr lib, - bool log_diags = true); + bool reprocess=true); void RemoveAtoms(ost::mol::EntityHandle& ent, ost::conop::CompoundLibPtr lib, @@ -90,7 +90,8 @@ void RemoveAtoms(ost::mol::EntityHandle& ent, bool rm_hyd_atoms, bool rm_oxt_atoms, bool rm_zero_occ_atoms, - bool colored=true); + bool colored=true, + bool reprocess=true); void CleanUpElementColumn(ost::mol::EntityHandle& ent, ost::conop::CompoundLibPtr lib);