Sib-pair Command: macro


ClassGlobal
Namemacro
Arguments <macro_name> [ (= <macro_body>) | (<- bur | che | epo | imp | ite | min | ple | pwd| sex | twi |
las | lik | pva |
(all | freq <marker_name>))].

Create a macro variable or function. If an equals sign is present, the rest of the line is taken as the macro variable body. If the "<-" (setting) sign is present, the macro variable takes the current value of the named program setting: burnin, checking, epoch, imputation_level, iteration, ls, mincount, plevel, pwd, sex_informative_marker, twin_indicator, the last P-value or algebra result, the likelihood and number of parameters from the last model, or the list of allele names or allele frequencies for a specified marker locus.

Otherwise, multiple lines of the body of a macro function are macro expected to follow on subsequent lines, terminating with an empty line or ";;;;".

The body of a macro variable contains numbers, strings and Sib-pair commands. The body of a macro function contains these entities and function arguments for substitution, represented as %1, %2 etc.

A macro is called either as a function or a variable. To call a macro as a function, the entire macro name must be the first word on the command line, followed by any required parameters (which can be any legal string). The function body is evaluated, and the resulting Sib-pair commands are then acted upon.

During evaluation of a macro function, the %% keyword is replaced by the macro call ID, a unique 5 character string. The %0 keyword is replaced by all the macro parameters, while %+2, %+3... is replaced by that parameter and all subsequent parameters.

To call the macro as a variable, the entire macro name is prepended by the "%" character. It can then appear anywhere in a command. The macro variable is replaced by the macro body, but there is no evaluation of macro function parameters or %%. The resulting command is then parsed.

Example:

>> macro add
add> %1 + %2
add> ;;;;

>> add 1 2
=>  3.
>> macro three <- last
>> %three^2
=>  9.

# Draw a pedigree (need to have dot and gv):
# First set up macro
>> macro draw
draw> select pedigree %1
draw> write dot %%.dot %2
draw> $ dot -Tps -o %%.ps %%.dot
draw> $ gv --scale=-4 %%.ps
draw> $ rm %%.dot %%.ps
draw> unselect
draw> 
# Call macro
>> draw ped1 trait

>> macro a=1
>> macro b=+
>> %a%b%a
=> 2.
>> macro a=D14S52 D14S43
>> tab %a
------------------------------------------------
Cross-tabulation of "D14S52" ... "D14S43"
------------------------------------------------
[...]


<< (chosen)Up to index>> (percent)