OESubsetDesignUnit¶
Attention
This API is currently available in C++ and Python.
bool OESubsetDesignUnit(OEDesignUnit &du, const OEDesignUnit &refDu,
const unsigned componentMask,
const OESystem::OEUnaryPredicate<OEChem::OEAtomBase>& pred=OEChem::OEIsTrueAtom())
This function generates a fully-functional
OEDesignUnit object (du
) as subset of another
OEDesignUnit (refDu
) object. An additional bit mask
(componentMask
) is required to specify which components should
be extracted as the subset. The bit mask should be specified from
constants in the OEDesignUnitComponents
namespace.
The optional predicate can be used to subset some of the components
in the specified bit mask. The predicate does not have to be complete,
e.g. two water molecules can be specified to subset the solvent category,
but that will not subset the protein component also included in that mask.
In essence the predicate is checked to see if it matches part of a design unit
component and only in this case does it take effect.
Warning
If the design unit contains a receptor it will persist in the subset, except if the subset action removes a component that was part of receptor generation mask, see
OEReceptor::GetTargetMask
bool OESubsetDesignUnit(OEDesignUnit &du,
const unsigned componentMask,
const OESystem::OEUnaryPredicate<OEChem::OEAtomBase>& pred=OEChem::OEIsTrueAtom())
This function behaves similarly as the above one, but does the subsetting
on the passed design-unit removing the need for a copy.
See also
OEDesignUnit class
OEReceptor class
OEDesignUnitComponents
namespaceOEUpdateDesignUnit
function
Examples
The example below demonstrate how to use OESubsetDesignUnit
to subset an existing OEDesignUnit object.
OEDesignUnit ligProtDU;
if(!OESubsetDesignUnit(ligProtDU, du, OEDesignUnitComponents::Protein | OEDesignUnitComponents::Ligand))
OEThrow.Fatal("Error: Could create a subset of the reference OEDesignUnit.");