Package schrodinger :: Package utils :: Module ligfilter :: Class Criterion
[hide private]
[frames] | no frames]

Class Criterion

Known Subclasses:


A base class for a structure matching criterion. Each instance will test
a structure for some property and indicate whether it passes or not.

Attributes

    type - The classification of the Criterion.  Can be PREDEFINED,
        PROPERTY, or SMARTS.

Instance Methods [hide private]
 
__init__(self, name=None, compstr=None)
Parameters
 
setCompStr(self, compstr)
Set the compstr attributes according to specified line Raises RuntimeError if the string is invalid
 
parseLine(self, line)
Parse a line of the form: <name> (Property criterion only) or: <name> <oper> <value> or: <name> <oper> <value> AND/OR <oper> <value>
 
__str__(self)
Return a standard string form of the Criterion suitable for filter files.
 
match_compstr(self, value)
Return True if the value matches self.compstr, False if not.
 
matches(self, st, addprops=False)
Return True if the structure 'st' matches the criterion, False if not.
 
getvalue(self, st)
Return the value of this criterion in the structure 'st'.
Method Details [hide private]

__init__(self, name=None, compstr=None)
(Constructor)

 

Parameters

    name - the name of the Criterion. See subclasses for meaning, as
        it depends on the implementation.

    compstr - a comparison string for evaluating the value of the
        named property. Examples are 'VALUE < 300' or 'VALUE >= 1'. 

If name or compstr are not specified, parseLine() method should be used

If a PROPERTY Criterion has no operator or value, the Criterion is
just the existence of the property in the tested structure.

The reason why comstr is one string instead of two values (operator and number)
is in order to support implementation of Ev:50600 - Add the ability to create 
criteria with multiple (boolean) conditions

parseLine(self, line)

 

Parse a line of the form:
    <name>
    (Property criterion only)
or:
    <name> <oper> <value>
or:
    <name> <oper> <value> AND/OR <oper> <value>

Set the name and compstr attributes from the parsed line;
Raises RuntimeError if the string is invalid

matches(self, st, addprops=False)

 

Return True if the structure 'st' matches the criterion, False if not. OVERWRITE this method in the subclass

st (Structure) - Structure object addprops (bool) - whether to add properties for each description

getvalue(self, st)

 

Return the value of this criterion in the structure 'st'. OVERWRITE this method in the subclass