macro=; var : fullis besis thisis numt taxdone curr_dec; if ( !argnumber ) errmsg This script finds the taxa which increase tree length the most (reporting ties when they exist). You must specify which tree to use (as first arg.); end set fullis length [ %1 ] ; set besis 1000000000000 ; set numt ntrees+1 ; report -; sil = all ; log tax_decrease.out; log/; loop 0 ntax progress #1 ntax Checking taxon #1... ; progress = ; if ( !isintree [ %1 #1 ] ) continue ; end copytree %1 ; pruntax 'numt' / #1 ; set thisis length [ 'numt' ] ; set curr_dec 'fullis' - 'thisis'; log+ tax_decrease.out; sil - all ; quote When Taxon #1 is pruned tree length decreases by 'curr_dec' steps; log/; sil = all ; keep 'numt' ; if ( 'thisis' < 'besis' ) set besis 'thisis' ; agroup =0 ; set taxdone 0 ; end if ( 'thisis' == 'besis' ) agroup >0 #1 ; set taxdone ++ ; end stop progress/; lquote [ ; sil - all ; report=; set besis 'fullis' - 'besis' ; quote The following 'taxdone' taxa save 'besis' steps if pruned (one at a time) from the tree: ; loop 0 ntax if ( !isinagroup [ 0 #1 ] ) continue ; end ; quote &32 $taxon #1 (#1); stop proc/;