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(type: int) -> OEFilter
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(filterstr: oeistream) -> OEFilter
Fine grained filter control is provided by allowing a custom
filter file to be passed to the OEFilter
object as the filterstr argument.
OEFilter(filter: OEFilter) -> OEFilter
The OEFilter object can be copy constructed from another OEFilter object.
operator()
__call__(arg2: Union[OEGraphMol,OEQMol]) -> bool
__call__(arg2: OEMol) -> 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.
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
AddNormalizationRule(rxn: OEUniMolecularRxn) -> bool
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
ClearNormalizationRules() -> None
Remove all normalizations previously added with
OEFilter.AddNormalizationRule.
GetCanonOrder
GetCanonOrder() -> bool
Returns whether to canonicalize the atom and bond order after salt removal but before the molecule is altered into a neutral pH model.
See also
GetFilterType
GetFilterType() -> int
Return the unsigned integer constant from the
OEFilterType namespace corresponding to
the type of filter used to construct this object.
GetFlagTableFailures
GetFlagTableFailures() -> bool
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
GetMessage(arg2: Union[OEGraphMol,OEQMol]) -> str
GetMessage(arg2: OEMol) -> str
Return a message that is “Pass” if the molecule passes the filter, and a reason for failure if it does not.
GetMMFFTypeCheck
GetMMFFTypeCheck() -> bool
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
GetSDTag() -> bool
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.
See also
GetTable
GetTable() -> oeostream
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
GetTypeCheck() -> bool
Return whether molecules sent to
OEFilter.operator() will be
type checked before any
other filtering criteria are applied. The default is false.
See also
GetpKaNormalize
GetpKaNormalize() -> bool
Return whether the pKa state of molecules sent to
OEFilter.operator() will be normalized to
a neutral pH. The default is false.
ParseNewRules
ParseNewRules(rulefile: oeistream) -> bool
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
PrintConfig
PrintConfig(log: oeostream) -> None
Print a human readable configuration of the object to the
oeostream log.
SetCanonOrder
SetCanonOrder(b: bool) -> None
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.
See also
SetErrorLevel
SetErrorLevel(level: int) -> None
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
SetFlagTableFailures(b: bool) -> None
Specify whether tabular output data should be marked with an asterisk if that value exceeds the limits specified by the filter.
SetMMFFTypeCheck
SetMMFFTypeCheck(b: bool) -> None
Specify whether molecules sent to
OEFilter.operator() will be
MMFF atom type checked before any
other filtering criteria are applied.
See also
Atom Type Checks subsection describing filter files
SetSDTag
SetSDTag(b: bool) -> None
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
SetTable(table: oeostream, owned: bool) -> None
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
SetTypeCheck(b: bool) -> None
Specify whether molecules sent to
OEFilter.operator() will be
type checked before any
other filtering criteria are applied.
See also
Atom Type Checks subsection describing filter files
SetpKaNormalize
SetpKaNormalize(b: bool) -> None
Specify whether the pKa state of molecules sent to
OEFilter.operator() will be normalized to
a neutral pH.