The following types of operation are supported:

Operations to retrieve the value of a data definition

Operations to retrieve the values of attributes and calculated attributes of a data definition

Arithemetic operations

Tests for equality

Boolean logical operations

Calculations that use the above operations

Unary and ternary conditional statements using the above operations

The attribute values for a given data definition in an ACD file can depend on the values from other data definitions. It is possible to retrieve the value of:

A data definition (application parameter)

An attribute of a data definition

A calculated attribute of a data definition

An ACD variable definition

Such values are retrieved using the ACD "get the value of" syntax which consists of a term

term surrounded by parentheses with a dollar sign (* ParameterName*.

`AttributeName`

`$`

) at the front:`$(`

* ParameterName*.

`AttributeName`

If just the value of the data definition is to be retrieved, the

component is omitted:`AttributeName`

`$(`

* ParameterName*)

Of course, a variable name may also be given. Variables do not have attributes therefore the syntax is:

`$(`

* VariableName*)

Of course, one needs to be careful that the type of retrieved value matches that of the attribute which is being calculated.

Calculations can be performed in ACD using the `@`

syntax. A rather silly, but legal, calculation would be:

@(5 + 9)

which equates to the value 14. Calculations can be used to add, subtract, multiply or divide, or test for equality, inequality, "greater than" or "less than" tests. The test values can be integers, floats and strings. You can use calculations with most attributes of datatypes where they make sense.

Only a single operation is allowed per set of parentheses. This means that that in some cases two or more sets of parentheses are required. In this example of a nested operations, two sets of parentheses are required, the first around the addition of `a`

and `b`

which gives `@(a + b)`

). The second around the addition of `@(a + b)`

to `c`

, which gives `@(@(a + b)+c)`

:

integer: n [ default: "@(@(a + b)+c)" ]

Where more than one operation is required, however, one would typically use an internal ACD variable to hold the intermediate results.

The supported arithmetic operations are addition, subtraction, multiplication and division. The standard characters for the arithmetic operations are used: `+`

, `-`

, `*`

and `/`

:

@(a+b) (Addition) @(a-b) (Subtraction) @(a*b) (Multiplication) @(a/b) (Division)

The operands `a`

and `b`

*must* resolve to a numerical (integer or a floating point): the result is undefined otherwise but will most probably result in an error during ACD processing.

The supported equality tests (symbols in parenthesis) are "equality" (`==`

), "non-equality" (`!=`

), "less than" (`<`

) and "greater than" (`>`

):

@(token1 == token2) (Equality) @(token1 != token2) (Non-equality) @(token1 < token2) (Less-than) @(token1 > token2) (Greater-than)

The above equality tests can be used on strings in which case the lexicographical sorting order of the string is used.

The supported boolean operations are logical `AND`

, logical `OR`

and logical `NOT`

. Again, the standard characters are used: `&`

, `|`

and `!`

:

@(!a) (NOT) @(a|b) (OR) @(a&b) (AND)

In the following example, the integer `rtfm`

will only be prompted for if the value of `fubar`

is either 3 or 7. Each of the equality tests is a calculation and the boolean test is another calculation. There are therefore three instances of `@()`

:

integer: rtfm [ standard: "@(@($(fubar)==3) | @($(fubar)==7))" etc ]

There are three kinds of conditional statements in ACD, unary, ternary and case-type

A typical use for unary conditionals is to switch prompts on or off.

In the following example, if the sequence is a protein then the prompt for `window`

is effectively turned off (see Section 4.5, “Controlling the Prompt” for more information about negation):

sequence: sequence [ parameter: "Y" type: gapany ] integer: window [ standard: "$(sequence.protein)" etc ]

Ternary conditional statements have the general form:

@(?`conditional`

:`value-if-true`

)`value-if-false`

They are useful when setting up the application for two distinct modes of usage, for example when setting gap penalty values differently for proteins and nucleic acids in alignment programs.

In the following example, `penalty`

is set to 14 for proteins and 16 for nucleic acids:

integer: penalty [ standard: "N" default: "@($(sequence.protein) ? 14 : 16)" etc ]

These have the general form:

@(=`testval`

:`poss_valA`

`ass_valA`

:`poss_valB`

else :`ass_valB`

)`default_val`

The test value (* testval*) is compared with a list of possible values (

`poss_valA`

`ass_valB`

`default_val`

`else :`

default value pair is optional and the default of `NULL`

is used as required where it is not defined.If the test value cannot unambiguously be assigned to a single associated value, the operation will resolve to the *last* associated value that matches its possible value.

Variables are useful for holding partial calculations or values and can keep your ACD files looking neat and tidy. The general syntax for them is:

:`VariableName`

`Variable value`

As an example, here is a calculation to determine the maximum size of a sequence window:

integer: start [ standard: "Y" maximum: "@(@($(sequence.length) - $(window)) + 1)" ]

This can be tidied by storing one of the calculations in a partial result as follows:

variable: lminusw "@($(sequence.length) - $(window))" integer: start [ standard: "Y" maximum: "@($(lminusw) + 1)" ]

The arithmetic operators are:

`@(a+b)`

(Addition)`@(a-b)`

(Subtraction)`@(a*b)`

(Multiplication)`@(a/b)`

(Division)

The logical operators are:

`@(!a)`

(Not boolean)`@(a|b)`

(Or)`@(a&b)`

(And)

The equality operators are:

`@(token1==token2)`

(Equality)`@(token1!=token2)`

(Non-equality)`@(token1<token2)`

(Less-than)`@(token1>token2)`

(Greater-than)

The conditional operators are:

`@(boolval ? iftrue : iffalse)`

(If)`@(testval = A : 1 B : 2 else : 0)`

(Case)