Skip to content
Snippets Groups Projects
Commit 678c0156 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

ensure proper processing of Entity when calling Molck

parent a0a5cfbe
Branches
Tags
No related merge requests found
...@@ -1356,7 +1356,8 @@ API ...@@ -1356,7 +1356,8 @@ API
.. function:: Molck(ent, lib, settings, [prune=True]) .. 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 :param ent: Structure to check
:type ent: :class:`~ost.mol.EntityHandle` :type ent: :class:`~ost.mol.EntityHandle`
...@@ -1369,8 +1370,7 @@ API ...@@ -1369,8 +1370,7 @@ API
:type prune: :class:`bool` :type prune: :class:`bool`
.. function:: MapNonStandardResidues(ent, lib, reprocess=True)
.. function:: MapNonStandardResidues(ent, lib)
Maps modified residues back to the parent amino acid, for example MSE -> MET. Maps modified residues back to the parent amino acid, for example MSE -> MET.
...@@ -1378,10 +1378,16 @@ API ...@@ -1378,10 +1378,16 @@ API
:type ent: :class:`~ost.mol.EntityHandle` :type ent: :class:`~ost.mol.EntityHandle`
:param lib: Compound library :param lib: Compound library
:type lib: :class:`~ost.conop.CompoundLib` :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, \ .. function:: RemoveAtoms(ent, lib, rm_unk_atoms=False, rm_non_std=False, \
rm_hyd_atoms=True, rm_oxt_atoms=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. Removes atoms and residues according to some criteria.
...@@ -1395,6 +1401,11 @@ API ...@@ -1395,6 +1401,11 @@ API
:param rm_oxt_atoms: See :attr:`MolckSettings.rm_oxt_atoms` :param rm_oxt_atoms: See :attr:`MolckSettings.rm_oxt_atoms`
:param rm_zero_occ_atoms: See :attr:`MolckSettings.rm_zero_occ_atoms` :param rm_zero_occ_atoms: See :attr:`MolckSettings.rm_zero_occ_atoms`
:param colored: See :attr:`MolckSettings.colored` :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) .. function:: CleanUpElementColumn(ent, lib)
......
...@@ -121,7 +121,7 @@ void export_Molck() ...@@ -121,7 +121,7 @@ void export_Molck()
def("MapNonStandardResidues", &MapNonStandardResidues, (arg("ent"), def("MapNonStandardResidues", &MapNonStandardResidues, (arg("ent"),
arg("lib"), arg("lib"),
arg("log_diags")=false)); arg("reprocess")=true));
def("RemoveAtoms", &RemoveAtoms, (arg("ent"), def("RemoveAtoms", &RemoveAtoms, (arg("ent"),
arg("lib"), arg("lib"),
...@@ -130,7 +130,8 @@ void export_Molck() ...@@ -130,7 +130,8 @@ void export_Molck()
arg("rm_hyd_atoms")=true, arg("rm_hyd_atoms")=true,
arg("rm_oxt_atoms")=false, arg("rm_oxt_atoms")=false,
arg("rm_zero_occ_atoms")=false, arg("rm_zero_occ_atoms")=false,
arg("colored")=false)); arg("colored")=false,
arg("reprocess")=true));
def("CleanUpElementColumn", &CleanUpElementColumn, (arg("ent"), arg("lib"))); def("CleanUpElementColumn", &CleanUpElementColumn, (arg("ent"), arg("lib")));
......
...@@ -12,7 +12,7 @@ using namespace ost::mol; ...@@ -12,7 +12,7 @@ using namespace ost::mol;
namespace ost{ namespace mol{ namespace alg{ 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 // TODO: Maybe it is possible to make it in-place operation
if(!lib) { if(!lib) {
...@@ -52,9 +52,11 @@ void MapNonStandardResidues(EntityHandle& ent, CompoundLibPtr lib, bool log_diag ...@@ -52,9 +52,11 @@ void MapNonStandardResidues(EntityHandle& ent, CompoundLibPtr lib, bool log_diag
} }
} }
ent = new_ent; ent = new_ent;
// Since we didn't do it in-place: reprocess the new entity
RuleBasedProcessor pr(lib); if(reprocess) {
pr.Process(ent, log_diags); RuleBasedProcessor pr(lib);
pr.Process(ent, false);
}
} }
void RemoveAtoms(EntityHandle& ent, void RemoveAtoms(EntityHandle& ent,
...@@ -64,7 +66,8 @@ void RemoveAtoms(EntityHandle& ent, ...@@ -64,7 +66,8 @@ void RemoveAtoms(EntityHandle& ent,
bool rm_hyd_atoms, bool rm_hyd_atoms,
bool rm_oxt_atoms, bool rm_oxt_atoms,
bool rm_zero_occ_atoms, bool rm_zero_occ_atoms,
bool colored /*=true*/){ bool colored, /*=true*/
bool reprocess){
if(!lib) { if(!lib) {
throw ost::Error("Require valid compound library!"); throw ost::Error("Require valid compound library!");
...@@ -140,6 +143,11 @@ void RemoveAtoms(EntityHandle& ent, ...@@ -140,6 +143,11 @@ void RemoveAtoms(EntityHandle& ent,
} }
LOG_INFO(ss.str()); LOG_INFO(ss.str());
} }
if(reprocess) {
RuleBasedProcessor pr(lib);
pr.Process(ent, false);
}
} }
void CleanUpElementColumn(EntityHandle& ent, CompoundLibPtr lib){ void CleanUpElementColumn(EntityHandle& ent, CompoundLibPtr lib){
...@@ -191,7 +199,8 @@ void Molck(ost::mol::EntityHandle& ent, ...@@ -191,7 +199,8 @@ void Molck(ost::mol::EntityHandle& ent,
settings.rm_hyd_atoms, settings.rm_hyd_atoms,
settings.rm_oxt_atoms, settings.rm_oxt_atoms,
settings.rm_zero_occ_atoms, settings.rm_zero_occ_atoms,
settings.colored); settings.colored,
false);
if (settings.assign_elem) { if (settings.assign_elem) {
CleanUpElementColumn(ent, lib); CleanUpElementColumn(ent, lib);
} }
...@@ -199,7 +208,11 @@ void Molck(ost::mol::EntityHandle& ent, ...@@ -199,7 +208,11 @@ void Molck(ost::mol::EntityHandle& ent,
if(prune) { if(prune) {
ost::mol::XCSEditor edi = ent.EditXCS(); ost::mol::XCSEditor edi = ent.EditXCS();
edi.Prune(); edi.Prune();
} }
// reprocess
RuleBasedProcessor pr(lib);
pr.Process(ent, false);
} }
}}} // ns }}} // ns
\ No newline at end of file
...@@ -81,7 +81,7 @@ struct MolckSettings{ ...@@ -81,7 +81,7 @@ struct MolckSettings{
void MapNonStandardResidues(ost::mol::EntityHandle& ent, void MapNonStandardResidues(ost::mol::EntityHandle& ent,
ost::conop::CompoundLibPtr lib, ost::conop::CompoundLibPtr lib,
bool log_diags = true); bool reprocess=true);
void RemoveAtoms(ost::mol::EntityHandle& ent, void RemoveAtoms(ost::mol::EntityHandle& ent,
ost::conop::CompoundLibPtr lib, ost::conop::CompoundLibPtr lib,
...@@ -90,7 +90,8 @@ void RemoveAtoms(ost::mol::EntityHandle& ent, ...@@ -90,7 +90,8 @@ void RemoveAtoms(ost::mol::EntityHandle& ent,
bool rm_hyd_atoms, bool rm_hyd_atoms,
bool rm_oxt_atoms, bool rm_oxt_atoms,
bool rm_zero_occ_atoms, bool rm_zero_occ_atoms,
bool colored=true); bool colored=true,
bool reprocess=true);
void CleanUpElementColumn(ost::mol::EntityHandle& ent, void CleanUpElementColumn(ost::mol::EntityHandle& ent,
ost::conop::CompoundLibPtr lib); ost::conop::CompoundLibPtr lib);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment