Metaphorics Logo

Expression Clause


 
Magnet Documentation
SEA Reference
   Selections
   Expressions
   Actions
   Examples

The expression clause uses the atoms selected in the selection clauses to compute an expression value. This value can include various geometric properties of the atoms combined using the standard logical and arithmetic operators. The operators include

-

Unary negative

/ *

Division and multiplication

+ -

Addition and subtraction

> >= < <= == !=

and or

Comparison operators

&& ||

Logical operators

The precedence of the operators is descending from highest to lowest in the table. The precedence can be altered by using parentheses.

The expression functions are

Function Name

Value Returned

vdw(atom, atom)

Sum of van der Waals radii

dist(atom, atom)

Distance between atoms

angle(atom, atom, atom)

Angle between atoms

torsion(atom, atom, atom, atom)

Torsion angle between atoms

abs(expression)

Absolute value of expression

asa(atom)

Solvent accessible surface area

float(string)

Convert a string to a floating point number

volume(atom, atom, atom, atom)

Signed volume of tetrahedron

pointdist(atom, x, y, z)

Distance between atom and given point

getatomprop(atom,"propertyname")

String value of named atom property

getrealatomprop(atom,"propertyname")

Real value of named atom property

getmolprop(l or r,"propertyname")

String value of named molecule property for ligand (l) or receptor (r)

notdef(atom, atom, typestring)

Is interaction of type typestring already defined between atoms?

In addition, floating point or integer constants can be used in the expression clause. Variables are also available for use in expressions. Variable names must start with V followed by any number of digits or upper or lower case letters. The values of all variables are initialized to 0.0 at the beginning of processing each ligand (or ligand conformation). The value of a variable can be set with the set() action (see action section below).

getatomprop returns the string value of a named atom property. If this property is not present in the input (or is not set with setrealatomprop , see action section below) the returned value is blank. Generally, the strings returned by getatomprop are used in printf statements although if the string represents a real number it can be used in an expression by applying the float function. Real valued properties can also be retrieved with getrealatomprop which returns a real value and can be used in expressions directly.

Atoms are passed from the left and right selection clauses via special variables l1, l2, l3 and r1, r2, r3 etc respectively. So, for example, the first atom which is matched by the left clause is referred to as l1. Unless a smarts phrase is used, only l1 or r1 are defined. If a smarts phrase is used in the left selection, then l1 is defined by the first atom which matches the smarts pattern, l2 the second etc. Similarly for the right selection clause and variables r1, r2 etc.

Evaluation of the expression clause yields a result which is taken as true if nonzero. If the value is true, the action clause is executed, otherwise the next match is evaluated.

Examples of selection and expression clauses:

{all()},{all()} {dist(l1,r1)<4.0)} 

would evaluate to true for all atom pairs between ligand and receptor which are less than 4 Angstroms apart.

{resname("SER")atnames( "C","N","O" )},{smarts("*")} {dist(l1,r1)<4.0} 

would evaluate true for all SER backbone atoms which are less than 4.0 Angstroms from any atom in the ligand.

{smarts("[#6]")},{chain("A") smarts("C(=O)N") {dist(l1,r3)<1.1*vdw(l1,r3)} 

would evaluate to true for all amide nitrogens in chain A of the receptor and carbon atoms in the ligand which have an interatomic distance of less than 1.1 times the sum of their van def Waals radii.

{smarts("[#6]")},{chain("A") smarts("C(=O)N") 
  {dist(l3,r1)<1.1*vdw(l3,r1)&&angle(l1,l3,r1)<120} 

The pairs of atoms from the previous example which also have an angle between the receptor C and N and ligand C atoms of less that 120 degrees.

The notdef(atom,atom,string) function is used to provide some precedence between the rules. If a previously evaluated rule has used the accept action (see Actions section below) to mark a pair of atoms as being involved in an interaction of type string, then the notdef function will evaluate to false. A type string of "*" means any interaction type. Thus an expression which starts out with a notdef term will never trigger an action on a pair of atoms which has already been assigned the appropriate type. In this way, the actions which are earlier in the rules file can take precedence over those which come later and therefore the more specific rules should be earlier in the file than more general rules. notdef can also be useful to prevent multiple printf actions (see next section) from being triggered by redundant or symmetric smarts matches for the same rule.


© Metaphorics, LLC
info@metaphorics.com