/* Copyright 2007 Brendan Halpin brendan.halpin@ul.ie Distribution is permitted under the terms of the GNU General Public Licence */ #delimit ; capture program drop oma; capture program drop omamatv3; program omamatv3, plugin; program define oma; version 9; syntax varlist [if] [in] [using/] , SUBSmat(string) INDel(real) PWDist(string) LENgth(string) [WORkspace]; marksample touse; tempvar idvar; tempvar lengthvar; gen `lengthvar' = `length'; tempname indelcost; scalar `indelcost' = `indel'; local printworkspace 0; if "`workspace'" ~= "" {; local printworkspace 1; }; local adjdur 0; local exponent 0; /* Unnecessary, C code checks if present */ gen `idvar'=_n; matrix `pwdist' = J(_N,_N,0); /* Arguments hardcoded into omamatv3: 0: substitution matrix name 1: indel cost 2: output matrix 3: adjust for duration? 4: show workspace? 5: exponent */ /* Checks? 1: is subsmat a matrix, a square matrix, with dimension >= n-states 2: is indel an integer? relate to max subscost? 3: let pwdist be a name only */ scalar subsrows = rowsof(`subsmat'); scalar subscols = colsof(`subsmat'); if subsrows!=subscols {; di "Error: non square substitution matrix"; exit; }; plugin call omamatv3 `idvar' `lengthvar' `varlist', `subsmat' `indelcost' `pwdist' `adjdur' `printworkspace' `exponent'; end;