OEFilter

class OEFilter

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.

Constructors

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.

See also

The Variations of Filters section.

OEFilter(OEPlatform::oeistream &filterstr)

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)

The OEFilter object can be copy constructed from another OEFilter object.

operator()

__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.

Note

The molecule may be altered by the steps described in the Filter Preprocessing chapter.

See also

This method will write logging data to OEThrow as described in this example.

operator bool

IsValid() -> bool

Returns whether the OEFilter object is in a valid state ready to accept molecules to its OEFilter.operator() method.

Note

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 programmatic control of the OEFilter object.

AddNormalizationRule

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.

See also

The OEChem manual has a chapter devoted to reactions.

ClearNormalizationRules

void ClearNormalizationRules()

Remove all normalizations previously added with OEFilter.AddNormalizationRule.

GetCanonOrder

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.

GetFilterType

unsigned int GetFilterType() const

Return the unsigned integer constant from the OEFilterType namespace corresponding to the type of filter used to construct this object.

GetFlagTableFailures

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.

GetMessage

std::string GetMessage(OEChem::OEMolBase &);
std::string GetMessage(OEChem::OEMCMolBase &);

Return a message that is “Pass” if the molecule passes the filter, and a reason for failure if it does not.

GetMMFFTypeCheck

bool GetMMFFTypeCheck() const

Return whether molecules sent to OEFilter.operator() will be MMFF atom type checked before any other filtering criteria are applied. The default is false.

GetSDTag

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.

GetTable

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.

GetTypeCheck

bool GetTypeCheck() const

Return whether molecules sent to OEFilter.operator() will be type checked before any other filtering criteria are applied. The default is false.

GetpKaNormalize

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.

ParseNewRules

bool ParseNewRules(OEPlatform::oeistream &rulefile)

Parse the data from the rulefile oeistream as a NEWRULE file. These rules will override any rules specified by the filter file given to the OEFilter constructors.

See also

New Rules

PrintConfig

void PrintConfig(OEPlatform::oeostream &log)

Print a human readable configuration of the object to the oeostream log.

SetCanonOrder

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.

SetErrorLevel

void SetErrorLevel(unsigned int level)

Sets the verbosity of warnings, using a level in the OEErrorLevel namespace, that are output when calling the operator OEFilter.operator() or the function GetMessage on the filter object.

SetFlagTableFailures

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.

SetMMFFTypeCheck

void SetMMFFTypeCheck(bool b)

Specify whether molecules sent to OEFilter.operator() will be MMFF atom type checked before any other filtering criteria are applied.

See also

SetSDTag

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.

Warning

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.

SetTable

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.

Note

The owned parameter must always be false for extension languages.

SetTypeCheck

void SetTypeCheck(bool b)

Specify whether molecules sent to OEFilter.operator() will be type checked before any other filtering criteria are applied.

See also

SetpKaNormalize

void SetpKaNormalize(bool b)

Specify whether the pKa state of molecules sent to OEFilter.operator() will be normalized to a neutral pH.