This class represents a set of filters as initialized from a filter file. The primary use of this class is OEFilter.operator() method which will return whether the molecule passes or fails the filter.
OEFilter(unsigned int type=OEFilterType::Default)
The OEFilter object is usually constructed from an unsigned integer from the OEFilterType constant namespace. The default constructor will initialize the object to the OEFilterType_Default filter. The default filter is an alias for the OEFilterType_BlockBuster filter.
The Variations of Filters section.
Fine grained filter control is provided by allowing a custom filter file to be passed to the OEFilter object as the filterstr argument.
OEFilter(const OEFilter &filter)
__call__(OEMolBase mol) -> bool
Returns whether the molecule mol passes the OEFilter object’s set of filter rules. This function has been optimized by applying the filter rules in order of how expensive they are to calculate. For example, molecular weight is much easier to calculate than any of the functional group rules.
However, if an output stream has been specified using the OEFilter.SetTable method all the filter rules will be checked. This is the only way to ensure that all the fields are filled in the tabular data output to the stream specified in SetTable method.
The molecule may be altered by the steps described in the Filter Preprocessing chapter.
IsValid() -> bool
It is nearly impossible for an end user to create an invalid filter. This method is here for future API design to allow for greater programatic control of the OEFilter object.
bool AddNormalizationRule(const OEChem::OEUniMolecularRxn &rxn)
Add a OEUniMolecularRxn to apply to the molecule. Special note should be taken about what preprocessing has already occurred on the molecule before generic normalizations are applied as described by the Filter Preprocessing chapter.
The OEChem manual has a chapter devoted to reactions.
Remove all normalizations previously added with OEFilter.AddNormalizationRule.
bool GetCanonOrder() const
Returns whether to canonicalize the atom and bond order after salt removal but before the molecule is altered into a neutral pH model.
unsigned int GetFilterType() const
Return the unsigned integer constant from the OEFilterType namespace corresponding to the type of filter used to construct this object.
bool GetFlagTableFailures() const
Return whether values in tabular data output are flagged with an asterisk marking them as outside the valid range for that filter rule. This is useful for figuring out why particular molecules have failed a given filter.
bool GetMMFFTypeCheck() const
bool GetSDTag() const
Return whether to attach every molecular property checked by the filter as SD data to the molecule passed to the OEFilter.operator() method. By default the the OEFilter object will not attach SD data.
OEPlatform::oeostream *GetTable() const
Return the oeostream object that tabular data is sent to. Will return a zero-pointer, the default, if no output stream has been specified.
bool GetTypeCheck() const
bool GetpKaNormalize() const
Return whether the pKa state of molecules sent to OEFilter.operator() will be normalized to a neutral pH. The default is false.
bool ParseNewRules(OEPlatform::oeistream &rulefile)
void PrintConfig(OEPlatform::oeostream &log)
Print a human readable configuration of the object to the oeostream log.
void SetCanonOrder(bool b)
Specify whether the molecule atom and bond order should be canonicalized after salt removal but before the molecule is altered into a neutral pH model.
void SetFlagTableFailures(bool b)
Specify whether tabular output data should be marked with an asterisk if that value exceeds the limits specified by the filter.
void SetMMFFTypeCheck(bool b)
void SetSDTag(bool b)
Specify whether to attach every molecular property checked by the filter as SD data to the molecule passed to the OEFilter.operator() method.
Only the properties up to the failing property will be attached by default. Use OEFilter.SetTable to force every property to be attached as SD data. The same rule applies to SD data as tabular output data, only the properties specified in the filter file will be attached as SD data.
void SetTable(OEPlatform::oeostream *table, bool owned)
Specify the oeostream object that tabular data is sent to. The owned parameter specifies whether the OEFilter object should take ownership of the table pointer. If owned is true the OEFilter destructor will delete the table pointer, otherwise, it is the user’s responsibility.
Specifying a zero-pointer will effectively turn off tabular output data.
The owned parameter must always be false for extension languages.
void SetTypeCheck(bool b)