silent = all ; macro - ; macro * 5 (((2*ntax+1)*10)+300) macro [ (((((8*ntax+1)*10)+300) / 1000) + 1000 ) ; macro=; /** PLEASE, NOTE... This is an earlier version of the delcor.run script (from Giannini & Goloboff, 2010). This is actually the method presented in the 2006 Hennig Meeting, in Oaxaca, Mexico. It was subsequently modified to redistribute changes in the branches of the tree. This script is included here only for the purpose of documenting an earlier (deprecated) version of the method. ***/ goto = %0 ; /********************************************************************/ /* B E G I N B O D Y O F S C R I P T */ /********************************************************************/ if ( linux ) ptnt commtime 1 ; ptnt timeout 30 ; var : slavereps ; if ( numhosts > 1 ) var : totals [ ( numhosts-1) 3 ] end end /* Declare variables ... */ var: mindeltax truenodz nexport dotaxa parallel totreps amatch maxsample isamatch mysign nummatches daseed obsample usrec ispos isapprox verbose dograph stos nexval todo done primrec secrec tdisplay lowisat higisat delay[(2*ntax+2)] tree prim sec hadpairs inca[(2*ntax+2)] incb[(2*ntax+2)] oblargestR obsmallestR largestR smallestR thiscor moda[(2*ntax+2)] modb[(2*ntax+2)] list[(2*ntax+2)] seclist[(2*ntax+2)] norsons[(2*ntax+2)] norme[(2*ntax+2)] nunos secnunos secnod nupairs thisnod xmag delayfactor at blow samplefac usxmag ; goto SET_PARAMS %1 %2 %3 %4 %5 %6 %7 %8 %9 ; if ( 'totreps' < 0 ) proc/; end /* First, evaluate observed correlation ... */ set verbose 1 ; set daseed getrandom[1 100000] ; macseed 'daseed' ; resettime ; if ( ( !'dograph' ) || ( 'usrec' < 0 ) ) goto CORRELATE ; set obsmallestR 'smallestR' ; set oblargestR 'largestR' ; set nexval time ; macfloat 3 ; silent - all ; quote &10&10Calculated correlation for 'todo' reconstructions, &10; quote R values: 'obsmallestR' to 'oblargestR' (time used: 'nexval' secs.) &10; if ( 'dotaxa' == 0 ) quote Lowest-highest R: combinations 'lowisat' and 'higisat' &10; end end if ( 'dograph' ) if ( 'usrec' >= 0 ) set lowisat 'usrec' ; set higisat 'usrec' ; end set tdisplay 1 ; naked ] ; macseed 'daseed' ; goto CORRELATE ; ttag - ; proc/; end if ( ( 'obsmallestR' <= 0 ) && ( 'oblargestR' >= 0 ) ) silent - all ; quote NO NEED TO RANDOMIZE - NO SIGNIFICANCE - EVER! &10; proc/; end if ( 'obsmallestR' > 0 ) set ispos 1 ; else set ispos 0 ; end /* Now, evaluate significance */ set verbose 0 ; sil - all ; quote &10Randomizing:&10&10; silent = all ; if ( 'parallel' ) goto PARALLEL_CALCULATIONS ; else /* CALCULATE SERIALLY ... */ set nummatches 1 ; set nexport time ; loop 1 'totreps' rseed * ; xperm 'sec' ; /* NOTE!! only second variable is being permuted!! */ goto CORRELATE ; xperm - ; set isamatch 0 ; if ( 'ispos' ) if ( 'largestR' >= 'obsmallestR' ) set nummatches ++ ; set isamatch 1 ; end else if ( 'smallestR' <= 'oblargestR' ) set nummatches ++ ; set isamatch 1 ; end end if ( !windows && ( ( time - 'nexport' ) < 5 ) && ( #1 != 'totreps' ) ) continue ; end set mysign 100 - ( ( 'nummatches' * 100 ) / ( #1 + 1 ) ) ; set mysign += 0.000001 ; macfloat 2 ; sil - all ; set nexport time ; if ( ! 'isamatch' ) quote #1 REPS - signif. 'mysign'&37&32 ('nexport' secs.) - ('smallestR' 'largestR') &10; else quote #1 REPS - signif. 'mysign'&37&32 ('nexport' secs.) - ('smallestR' 'largestR') - a match! &10; end sil = all ; if ( windows ) progress #1 'totreps' #1 Reps ('mysign') ; end stop if ( windows ) progress/; end end lquote ] ; sil - all ; proc/; /**********************************************************/ /* E N D O F B O D Y O F S C R I P T */ /**********************************************************/ /**********************************************************/ /* R O U T I N E S C A L L E D */ /* F R O M B O D Y O F S C R I P T */ /**********************************************************/ /**********************************************************/ label CORRELATE ; set smallestR 1 ; set largestR ( -1 ) ; sil = all ; if ( 'verbose' && ( !'tdisplay' ) ) sil - all ; quote COUNTING COMPARISONS TO DO ...; sil = all ; end if ( 'dotaxa' ) /* Regress states in taxa only ..... */ set moda states[ 'prim' . 'tree'] ; set modb states[ 'sec' . 'tree'] ; set nupairs 0 ; loop 0 ntax if ( !isintree[ 'tree' #1 ] ) continue ; end set moda['nupairs'] ( contmins['prim' #1] + contmaxs['prim' #1] ) / 2 ; set modb['nupairs'] ( contmins['sec' #1] + contmaxs['sec' #1] ) / 2 ; set nupairs ++ ; stop var & moda modb 'nupairs' ; set smallestR regr ; set largestR regr ; proc/; end set primrec 0 ; set secrec 0 ; iterrecs 'tree' 'prim' + inca set primrec ++ ; endrecs ; iterrecs 'tree' 'sec' + incb set secrec ++ ; endrecs ; set todo 'primrec' * 'secrec' ; if ( 'verbose' && ( !'tdisplay' ) ) sil - all ; quote &10A TOTAL OF 'todo' RECONSTRUCTIONS NEED TO BE EVALUATED &10; sil = all ; end set samplefac 0 ; if ( 'verbose' == 0 ) if ( ( 'todo' > 50 ) && ( 'maxsample' > 0 ) ) set samplefac ( 'maxsample' * 1000 ) / 'todo' ; if ( 'samplefac' < 1 ) set samplefac 1 ; end end else if ( ( 'todo' > 1000 ) && ( 'obsample' > 0 ) ) set samplefac ( 'obsample' * 1000 ) / 'todo' ; if ( 'samplefac' < 1 ) set samplefac 1 ; end end end if ( 'delayfactor' == 0 ) /* Regress deltas node-to-node */ set nexval 0 ; macfloat 4 ; var: moda['truenodz'] modb['truenodz'] ; iterrecs 'tree' 'prim' + inca iterrecs 'tree' 'sec' + incb set done ++ ; if ( ( 'samplefac' > 0 ) && ( getrandom[1 1000] > 'samplefac' ) ) proc/; end if ( 'tdisplay' ) if ( ( 'done' != 'lowisat' ) && ( 'done' != 'higisat' ) ) proc/ ; end ttag - ; ttag * 'tree' ; macfloat 3 ; loop 0 nnodes['tree'] if ( !isintree['tree' #1] ) continue ; end ttag +#1 'inca[#1]','incb[#1]'; stop macfloat 4 ; sil - all ; quote &10&10INCREMENTS IN PRIM/SEC CHARACTERS: &10; ttag ; sil = all ; end set xmag ( 'done' * 100 ) / 'todo' ; if ( 'verbose' && ( 'xmag' >= 'nexval' ) ) progress 'xmag' 100 Working (node-to-node); set nexval += 1 ; end set nupairs 0 ; loop 0 nnodes['tree'] if ( !isintree['tree' #1] ) continue ; end set moda['nupairs'] 'inca[#1]' ; set modb['nupairs'] 'incb[#1]' ; set nupairs ++ ; stop var & moda modb ; set thiscor regr ; if ( 'tdisplay' ) sil - all ; var + 50 25 moda modb ; sil = all ; end if ( 'smallestR' > 'thiscor' ) if ( !'tdisplay' ) set lowisat 'done' ; end set smallestR 'thiscor' ; end if ( 'largestR' < 'thiscor' ) if ( !'tdisplay' ) set higisat 'done' ; end set largestR 'thiscor' ; end endrecs endrecs if ( 'verbose' ) progress/; end proc/; end if ( 'stos' == 1 ) /* Regress state-to-state */ set nupairs 0 ; macfloat 4 ; var: moda['truenodz'] modb['truenodz'] ; iterrecs 'tree' 'prim' inca iterrecs 'tree' 'sec' incb set done ++ ; if ( ( 'samplefac' > 0 ) && ( getrandom[1 1000] > 'samplefac' ) ) proc/; end if ( 'tdisplay' ) if ( ( 'done' != 'lowisat' ) && ( 'done' != 'higisat' ) ) proc/ ; end ttag - ; ttag * 'tree' ; macfloat 3 ; loop 0 nnodes['tree'] if ( !isintree['tree' #1] ) continue ; end ttag +#1 'inca[#1]','incb[#1]'; stop macfloat 4 ; sil - all ; quote &10&10STATES IN PRIM/SEC CHARACTERS: &10; ttag ; sil = all ; end set xmag ( 'done' * 100 ) / 'todo' ; if ( 'verbose' && ( 'xmag' >= 'nexval' ) ) progress 'xmag' 100 Working (state-to-state); set nexval += 1 ; end set nupairs 0 ; loop 0 nnodes['tree'] if ( !isintree['tree' #1] ) continue ; end set moda['nupairs'] 'inca[#1]' ; set modb['nupairs'] 'incb[#1]' ; set nupairs ++ ; stop var & moda modb ; var & moda modb 'nupairs'; set thiscor regr ; if ( 'tdisplay' ) sil - all ; var + 50 25 moda modb ; sil = all ; end if ( 'smallestR' > 'thiscor' ) if ( !'tdisplay' ) set lowisat 'done' ; end set smallestR 'thiscor' ; end if ( 'largestR' < 'thiscor' ) if ( !'tdisplay' ) set higisat 'done' ; end set largestR 'thiscor' ; end endrecs endrecs if ( 'verbose' ) progress/; end proc/; end set done 0 ; set nexval 0 ; macfloat 3 ; /* Regress with delays ... */ iterrecs 'tree' 'prim' + inca iterrecs 'tree' 'sec' + incb set done ++ ; if ( ( 'samplefac' > 0 ) && ( getrandom[1 1000] > 'samplefac' ) ) proc/; end if ( 'tdisplay' ) if ( ( 'done' != 'lowisat' ) && ( 'done' != 'higisat' ) ) proc/ ; end ttag - ; ttag * 'tree' ; loop 0 nnodes['tree'] ttag +#1 'inca[#1]','incb[#1]'; stop sil - all ; quote &10&10INCREMENTS IN PRIM/SEC CHARACTERS: &10; ttag ; sil = all ; ttag - ; ttag * 'tree' ; else loop 0 nnodes[ 'tree' ] set delay[ #1 ] 0 ; set norme[ #1 ] 0 ; stop set xmag ( 'done' * 100 ) / 'todo' ; if ( 'verbose' && ( 'xmag' >= 'nexval' ) ) progress 'xmag' 100 Working (delayed); set nexval += 1 ; end end set nupairs 0 ; loop 1 'nunos' set thisnod 'list[ #1 ]' ; if ( 'norme[ 'thisnod' ]' ) continue ; end set xmag 'inca[ 'thisnod' ]' + ( 'delay[ anc [ 'tree' 'thisnod' ]]' * 'delayfactor' ) ; set usxmag 'xmag' ; if ( 'xmag' < 0 ) set usxmag ( - 'xmag' ) ; end if ( 'usxmag' <= 'mindeltax' ) if ( 'tdisplay' ) ttag +'thisnod' 'nupairs':0,'incb[ 'thisnod' ]'; end set moda[ 'nupairs' ] 'xmag' ; set modb[ 'nupairs' ] 'incb[ 'thisnod' ]' ; set delay [ 'thisnod' ] 0 ; set nupairs ++ ; continue ; end if ( ( 'incb[ 'thisnod' ]' != 0 ) || ( 'thisnod' <= ntax ) ) if ( 'tdisplay' ) ttag +'thisnod' 'nupairs':('delay[ anc [ 'tree' 'thisnod' ]]'*'delayfactor'+)'inca['thisnod']','incb[ 'thisnod' ]'; end set moda[ 'nupairs' ] 'xmag' ; set modb[ 'nupairs' ] 'incb[ 'thisnod' ]' ; set delay [ 'thisnod' ] 0 ; set nupairs ++ ; continue ; end set seclist uplist[ 'tree' 'thisnod' ] ; set secnunos listsize - 1 ; loop 0 ntax if ( !isintree[ 'tree' #2 ] ) continue ; end if ( isanc[ 'tree' 'thisnod' #2 ] ) set secnunos ++ ; set seclist[ 'secnunos' ] #2 ; end stop set delay[ 'thisnod' ] 'xmag' ; loop 0 'secnunos' set norsons[ 'seclist[#2]' ] 0 ; stop set hadpairs 'nupairs' ; loop 1 'secnunos' set secnod 'seclist[ #2 ]' ; set blow anc[ 'tree' 'secnod' ] ; if ( 'norsons[ 'blow' ]' ) set norsons[ 'secnod' ] 1 ; continue ; end set xmag 'inca[ 'secnod']' + ( 'delay[ 'blow' ]' * 'delayfactor' ) ; if ( ( 'incb[ 'secnod' ]' != 0 ) || ( 'secnod' <= ntax ) ) if ( 'tdisplay' ) set at ( 'delay[ 'blow' ]' * 'delayfactor' ) ; ttag +'secnod' <<'nupairs':('delay[ 'blow' ]'*'delayfactor'+)'inca[ 'secnod']','incb[ 'secnod']'; end set at 'secnod' ; loop 1 1 set at anc [ 'tree' 'at' ] ; if ( 'at' == 'thisnod' ) endloop ; end if ( 'tdisplay' && ( 'norme['at']' != 1 ) ) ttag +'at' <<; end set norme [ 'at' ] 1 ; setloop 1 ; stop set moda [ 'nupairs' ] 'xmag' ; set modb [ 'nupairs' ] 'incb[ 'secnod' ]' ; set nupairs ++ ; set norsons[ 'secnod' ] 1 ; set norme[ 'secnod' ] 1 ; set delay[ 'secnod' ] 0 ; continue ; end if ( 'inca[ 'secnod' ]' != 0 ) set norsons[ 'secnod' ] 1 ; set delay [ 'secnod' ] 'delay[ 'blow' ]' * 'delayfactor' ; set at 'secnod' ; if ( 'tdisplay' ) ttag +'secnod' ||; end loop 1 1 set at anc [ 'tree' 'at' ] ; if ( 'at' == 'thisnod' ) endloop ; end if ( 'norme['at]' == 0 ) set norme [ 'at' ] 2 ; end setloop 1 ; stop continue ; end set delay [ 'secnod' ] 'delay[ 'blow' ]' * 'delayfactor' ; stop if ( 'tdisplay' && ( 'hadpairs' != 'nupairs' ) ) ttag +'thisnod' ('delay[ anc [ 'tree' 'thisnod' ]]'*'delayfactor'+)'inca['thisnod']'>>; end stop var & moda modb 'nupairs' ; set thiscor regr ; if ( 'tdisplay' ) sil - all ; quote &10Correlation (R) = 'thiscor' (reconstruction 'done') &10; ttag ; set at 0 ; loop 0 ('nupairs'-1) quote #1: '/+6.3moda[#1]','/+-6.3modb[#1]' &32 &32 &32; set at ++ ; if ( 'at' == 5 ) quote &10 ; set at 0 ; end stop quote &10 ; var: modmod[ 'nupairs'] ; loop 0 ('nupairs'-1) set modmod[#1] 'modb[#1]' ; stop var + 50 25 moda modmod ; var - modmod ; sil = all ; end if ( 'smallestR' > 'thiscor' ) if ( !'tdisplay' ) set lowisat 'done' ; end set smallestR 'thiscor' ; end if ( 'largestR' < 'thiscor' ) if ( !'tdisplay' ) set higisat 'done' ; end set largestR 'thiscor' ; end endrecs endrecs if ( 'verbose' ) progress/; end proc/; /************** end of CORRELATE ***************/ /**********************************************************/ label PARALLEL_CALCULATIONS ptnt begin randomize /trees 1 'tree' = macro - ; macro * 5 (((2*ntax+1)*10)+300) macro [ (((((8*ntax+1)*10)+300) / 1000) + 500 ) ; macro=; silent = all ; var: i j k results[3] maxsample mysign verbose nexval todo done primrec secrec usxmag delay [ ( 2*ntax+2 ) ] tree inca [ ( 2*ntax+2 ) ] incb [ ( 2*ntax+2 ) ] largestR smallestR thiscor moda [ ( 2*ntax+2 ) ] modb [ ( 2*ntax+2 ) ] list [ ( 2*ntax+2 ) ] seclist [ ( 2*ntax+2 ) ] norsons [ ( 2*ntax+2 ) ] norme [ ( 2*ntax+2 ) ] secnunos nunos secnod nupairs thisnod xmag delayfactor at blow samplefac ; set list uplist[ 0 root ] ; set nunos listsize - 1 ; loop 0 ntax if ( !isintree[ 'tree' #1 ] ) continue ; end set nunos ++ ; set list[ "nunos" ] #1 ; stop macfloat 0 ; set results[0] 0 ; set results[1] 0 ; set results[2] 0 ; loop 1 'slavereps' macfloat 3 ; rseed * ; xperm 'sec' ; set smallestR 1 ; set largestR ( -1 ) ; set primrec 0 ; set secrec 0 ; iterrecs 0 'prim' + inca set primrec ++ ; endrecs ; iterrecs 0 'sec' + incb set secrec ++ ; endrecs ; set todo "primrec" * "secrec" ; set samplefac 0 ; if ( ( "todo" > 50 ) && ( 'maxsample' > 0 ) ) set samplefac ( 'maxsample' * 1000 ) / "todo" ; if ( "samplefac" < 1 ) set samplefac 1 ; end end set done 0 ; set nexval 0 ; iterrecs 0 'prim' + inca iterrecs 0 'sec' + incb set done ++ ; if ( ( "samplefac" > 0 ) && ( getrandom[1 1000] > "samplefac" ) ) proc/; end loop 0 nnodes[ 'tree' ] set delay[ #1 ] 0 ; set norme[ #1 ] 0 ; stop set nupairs 0 ; loop 1 'nunos' set thisnod "list[ #1 ]" ; if ( "norme[ "thisnod" ]" ) continue ; end set xmag "inca[ "thisnod" ]" + ( "delay[ anc [ 0 "thisnod" ]]" * 'delayfactor' ) ; set usxmag ( "xmag" ) ; if ( "xmag" < 0 ) set usxmag ( - "xmag" ) ; end if ( "usxmag" <= 'mindeltax' ) set moda[ "nupairs" ] "xmag" ; set modb[ "nupairs" ] "incb[ "thisnod" ]" ; set delay[ "thisnod" ] 0 ; set nupairs ++ ; continue ; end if ( ( "incb[ "thisnod" ]" != 0 ) || ( "thisnod" <= ntax ) ) set moda[ "nupairs" ] "xmag" ; set modb[ "nupairs" ] "incb[ "thisnod" ]" ; set delay [ 'thisnod' ] 0 ; set nupairs ++ ; continue ; end set seclist uplist[ 0 "thisnod" ] ; set secnunos listsize - 1 ; loop 0 ntax if ( !isintree[ 0 #2 ] ) continue ; end if ( isanc[ 0 "thisnod" #2 ] ) set secnunos ++ ; set seclist[ "secnunos" ] #2 ; end stop set delay[ "thisnod" ] "xmag" ; loop 0 "secnunos" set norsons[ "seclist[ #2 ]" ] 0 ; stop loop 1 "secnunos" set secnod "seclist[ #2 ]" ; set blow anc[ 0 "secnod" ] ; if ( "norsons[ "blow" ]" ) set norsons[ "secnod" ] 1 ; continue ; end set xmag "inca[ "secnod"]" + ( "delay[ "blow" ]" * 'delayfactor' ) ; if ( "incb[ "secnod" ]" != 0 ) set at "secnod" ; loop 1 1 set at anc [ 0 "at" ] ; if ( "at" == "thisnod" ) endloop ; end set norme [ "at" ] 1 ; setloop 1 ; stop set moda [ "nupairs" ] "xmag" ; set modb [ "nupairs" ] "incb[ "secnod" ]" ; set nupairs ++ ; set norsons[ "secnod" ] 1 ; set norme[ "secnod" ] 1 ; set delay[ "secnod" ] 0 ; continue ; end if ( "inca[ "secnod" ]" != 0 ) set norsons[ "secnod" ] 1 ; set delay [ "secnod" ] "delay[ "blow" ]" * 'delayfactor' ; set at "secnod" ; loop 1 1 set at anc [ 0 "at" ] ; if ( "at" == "thisnod" ) endloop ; end set norme [ "at" ] 1 ; setloop 1 ; stop continue ; end set delay [ "secnod" ] "delay[ "blow" ]" * 'delayfactor' ; stop stop var & moda modb "nupairs" ; set thiscor regr ; if ( "smallestR" > "thiscor" ) set smallestR "thiscor" ; end if ( "largestR" < "thiscor" ) set largestR "thiscor" ; end endrecs endrecs if ( 'ispos' ) if ( "largestR" >= 'obsmallestR' ) set results[0] ++ ; else set results[1] ++ ; end else if ( "smallestR" <= 'oblargestR' ) set results[0] ++ ; else set results[1] ++ ; end end set results[2] ++ ; xperm - ; stop return ; resettime ; loop 1 1 ptnt wait [4] ( percdone[randomize] == 100 ) randomize ; slaveget [ randomize ] totals results ; set isapprox 0 ; set nummatches 1 ; set done 0 ; loop 0 ( numtasks[ randomize ] - 1 ) if ( 'totals[#2 0]' < 0 ) continue ; end if ( ( 'totals[#2 0]' + 'totals[#2 1]' ) != 'totals[#2 2]' ) set isapprox 1 ; end set nummatches += 'totals[#2 0]' ; set done += 'totals[#2 2]' ; stop set mysign 100 - ( ( 'nummatches' * 100 ) / ( 'done' + 1 ) ) ; set mysign += 0.000001 ; macfloat 2 ; sil - all ; set nexval time ; if ( !'isapprox' ) quote 'done' REPS - signif. 'mysign'&37&32('nexval' secs.) &10; else quote 'done' REPS - signif. 'mysign'&37&32(approx.) ('nexval' secs.) &10; end sil = all ; if ( ( 'done' >= 'totreps' ) || ( percdone[randomize] == 100 ) ) endloop ; end ; setloop 1 ; stop ptnt kill randomize ; proc/; /******* end of PARALLEL_CALCULATIONS ********/ /**********************************************************/ label SHOW_USAGE report - ; lquote [ ; sil - all ; quote &10&10 -------------------------------------------------------------------- This script, %0, calculates inc/dec correlations, given that secondary variable can have a delayed response. Arguments: chars P Q independent and dependent characters (default = 0 and 1 ). tree N run test on tree N (default tree = 0 ). delay N delay factor (default = 0.5., if set to 0, correlation done node-to-node). sample N max. number of reconstructions to evaluate during randomization (default = 100). obsample N max. number of reconstructions to evaluate during calculation of observed correlation (default = all). reps N number of replications (=significance). minchg N percentage of average change in independent variable which may trigger a response in dependent variable (default = 0). states correlate state-to-state instead of incs/decs. taxa correlate states in taxa (without regard to tree). parallel run in parallel (Linux/Mac systems only). graphic instead of testing, display values for observed corre- lation. When a number N provided, shows only combina- tion of reconstructions number N (otherwise, it shows those with highest/lowest R) . go as single argument, runs without asking anything. --------------------------------------------------------------------; pause ; lquote ]; proc/; /******* end of SHOW_USAGE *********************/ /**********************************************************/ label SET_PARAMS /* DEFAULTS: */ set prim 0 ; /* primary (indep) variable */ set sec 1 ; /* secondary (dep) variable */ set tree 0 ; /* tree to use */ set delayfactor 0.5 ; /* delay factor (0 = no delay) */ set totreps 1000 ; /* total number of reps */ set maxsample 100 ; /* max number of recons */ set stos 0 ; /* use state-to-state */ set parallel 0 ; /* dont run in parallel */ set dograph 0 ; /* dont display graphically */ set tdisplay 0 ; /* ditto */ set dotaxa 0 ; /* dont correlate states in taxa */ set usrec ( -1 ) ; /* dont display specific reconst */ set obsample 0 ; /* max number of recons for obs */ set mindeltax 0 ; /* min change in X to which Y may respond */ if ( linux ) if ( numhosts > 1 ) set slavereps ( 'totreps' * 5 ) / ( numhosts-1) ; /* take into account some hosts may be slower, see below !!! */ end end if ( ( ntax < 0 ) || ( ntrees < 0 ) ) errmsg To run this script, must read data and have at least a tree in memory ; end if ( ( !argnumber ) && ( !windows ) ) if ( getresponse [ Run script with default parameters? ] == no ) goto SHOW_USAGE ; set totreps ( - 1 ) ; proc/; end end lquote [ ; lquote - ; report - ; if ( ( !argnumber ) && windows ) goto INITIAL_DIALOG ; if ( 'totreps' < 0 ) proc/; end end if ( argnumber ) sil - all ; quote &10&10Parsing options... ; var: i j k ; loop 1 argnumber set i #1 ; set j #1 + 1 ; set k #1 + 2 ; if ( eqstring [ %('i') go ] ) endloop ; else if ( eqstring [ %('i') states ] ) set stos 1 ; else if ( eqstring [ %('i') graphic ] ) set dograph 1 ; if ( argnumber > #1 ) set usrec %('j') ; setloop ( #1 + 2 ) ; end else if ( eqstring [ %('i') parallel ] ) set parallel 1 ; else if ( eqstring [ %('i') taxa ] ) set dotaxa 1 ; else if ( eqstring [ %('i') tree ] ) if ( argnumber == #1 ) errmsg Number expected after &34tree&34; end set tree %('j') ; setloop ( #1 + 2 ) ; else if ( eqstring [ %('i') minchg ] ) if ( argnumber == #1 ) errmsg Number expected after &34minchg&34; end set mindeltax %('j') ; setloop ( #1 + 2 ) ; else if ( eqstring [ %('i') delay ] ) if ( argnumber == #1 ) errmsg Number expected after &34delay&34; end set delayfactor %('j') ; setloop ( #1 + 2 ) ; else if ( eqstring [ %('i') reps ] ) if ( argnumber == #1 ) errmsg Number expected after &34reps&34; end set totreps %('j') ; setloop ( #1 + 2 ) ; else if ( eqstring [ %('i') obsample ] ) if ( argnumber == #1 ) errmsg Number expected after &34obsample&34; end set obsample %('j') ; setloop ( #1 + 2 ) ; else if ( eqstring [ %('i') sample ] ) if ( argnumber == #1 ) errmsg Number expected after &34sample&34; end set maxsample %('j') ; setloop ( #1 + 2 ) ; else if ( eqstring [ %('i') chars ] ) if ( argnumber < ( #1 + 2 ) ) errmsg Two numbers expected after &34chars&34; end set prim %('j') ; set sec %('k') ; setloop ( #1 + 3 ) ; else errmsg Unrecognized option: %('i') ; end end end end end end end end end end end end quote &10; sil = all ; stop /** Check sanity of user parameters */ if ( ( 'mindeltax' < 0 ) || ( 'mindeltax' > 1 ) ) errmsg Sorry, minimum change value must be 0 <= change <= 1 ; end if ( 'delayfactor' < 0 ) errmsg Sorry, delay factor must be 0 <= f ... ; end if ( 'maxsample' < 5 ) errmsg Sorry, min. sample size is 5... ; end if ( 'parallel' ) if ( ! linux ) errmsg In Windows machines, &34parallel&34 is not a valid option; end if ( numhosts < 1 ) errmsg Cannot run &34parallel&34 --no multiple machines available; end if ( ( !'delayfactor' ) || 'dotaxa' || 'stos' ) errmsg Parallel randomization implemented only for delayed increments!&10(others are fast enough., parallelization is not needed) ; end end end set list uplist[ 'tree' root ] ; set nunos listsize - 1 ; set truenodz 0 ; loop 0 nnodes['tree'] if ( isintree['tree' #1] ) set truenodz ++ ; end stop loop = term 0 ntax if ( !isintree[ 'tree' #term ] ) continue ; end set nunos ++ ; set list[ 'nunos' ] #term ; stop set mindeltax 'mindeltax' * ( length[ 'tree' 'prim' ] / ( tsize[ 'tree'] - 2 ) ) ; lquote = ; proc/; /******* end of SET_PARAMS *******************/ /*******************************************************/ label INITIAL_DIALOG var : chalis[ ( nchar+1 ) ] type action graphtype choschars ; if ( nchar > 1 ) loop 2 nchar set chalis[#1] 0 ; stop end set chalis[0] 1 ; set chalis[1] 1 ; set type 0 ; set delayfactor 50 ; set totreps 100 ; set action 0 ; set graphtype 1 ; set usrec 1 ; opendlg 30 30 545 360 Test correlation ... ; frame 15 15 180 100 Compare ... ; choose type 35 35 150 16 delayed correlations + showtxt 350 215 165 20 delay factor && minchg: ; subdlg 465 215 44 20 change; 150 120 250 160 Change delay factor / minchg spin 1 100 delayfactor 25 25 115 20 delay factor (o/o); spin 0 100 mindeltax 25 50 115 20 minimum change (o/o); closedlg ; = 35 55 150 16 increment-to-increment 35 75 150 16 state-to-state 35 95 150 16 terminal taxa ; - spin 5 30000 obsample 350 152 75 20 sets (observed) ; spin 5 30000 maxsample 350 182 75 20 sets (permuted) ; = frame [ (ntrees>0) ] 205 15 180 100 Using ... ; showtxt [ (ntrees>0) ] 210 35 60 20 Tree nr. ; spin [ (ntrees>0) ] 0 ntrees tree 270 35 180 20 ; charsel [ (nchar>1) ] chalis 295 70 70 20 ; showtxt [ (nchar>1) ] 220 70 135 20 Characters: ; frame 15 130 315 130 ; choose action 35 150 130 20 Test, permuting ... + spin 1 10000 totreps 165 150 40 20 times ; = [-6] 35 175 200 20 Display a plot of comparisons ; + choose graphtype 60 195 200 20 Best and worst set of reconstructions 60 215 180 20 For set of reconstructions nr. ; + spin 1 30000 usrec 240 215 1 20 ; = = frame 335 130 195 130 Sample ... ; closedlg ; if ( !exstatus ) set totreps ( - 1 ) ; proc/; end set choschars 0 ; loop 0 nchar if ( 'chalis[#1]' > 0 ) set choschars ++ ; end stop if ( 'choschars' != 2 ) errmsg To run this script, you must choose 2 (TWO) characters!! &10Is that so difficult??!! ; end if ( 'type' == 0 ) set delayfactor 'delayfactor' / 100 ; set mindeltax 'mindeltax' / 100 ; end if ( 'type' == 1 ) set delayfactor 0 ; end if ( 'type == 2 ) set stos 1 ; end if ( 'type' == 3 ) set dotaxa 1 ; end if ( 'action' == 1 ) set dograph 1 ; if ( 'graphtype' == 0 ) set usrec ( - 1 ) ; end end proc/; /****** end of INITIAL_DIALOG *************/ /*******************************************************/ /* E N D O F S C R I P T */ /*******************************************************/