TNT_Script/guoyi.run

197 lines
5.1 KiB
Text
Raw Normal View History

2023-02-26 03:32:18 +08:00
log tnt.log;
macro=;
taxname+1000;
2023-02-26 03:32:18 +08:00
taxname=;
mxram 10240;
nstates 32;
nstates NOGAPS;
2023-02-27 01:24:22 +08:00
/*Arguments*/
if ( argnumber != 1 )
silent -console;
quote - /-----------------------------------------------\;
quote - | GUOYI TNT SCRIPT 2022-2023 MIT |;
quote - | You need to give your filename |;
2023-07-12 05:19:40 +08:00
quote - | tnt*> guoyi filename |;
2023-02-27 01:24:22 +08:00
quote - \-----------------------------------------------/;
proc/;
end
/*Report what will be done*/
quote - /-----------------------------------------------\;
quote - | Implied weighting will be estimated. |;
quote - | TBR Mult and Xmult will be performed. |;
quote - | Strict consensus will be used. |;
quote - | Relative bremer support, jackknifing and |;
quote - | boot will be shown on the resample.svg. |;
quote - | Apomorphic characters mapping will be shown |;
quote - | on the apo.svg and saved to apo*.tre. |;
2023-02-27 01:24:22 +08:00
quote - | TL, CI and RI will be calculated finally. |;
quote - \------------------------------------------------/;
/*Set K*/
2023-02-26 03:32:18 +08:00
procedure %1;
2023-02-27 01:24:22 +08:00
var:
actK
minK
maxK
gVal
a
b
Nval
maxIts
;
if (ntax<0)
quote There is no data;
2023-02-27 01:24:22 +08:00
proc/;
end
/** find the value of g **/
2023-02-27 01:24:22 +08:00
loop 0 nchar
if (!isinfo[#1]) continue; end
if (!isact[#1]) continue; end
set a=maxsteps[#1];
set b=minsteps[#1];
if (('a'-'b')>'gVal')
set gVal 'a'-'b';
end
stop
quote g value: 'gVal';
2023-02-27 01:24:22 +08:00
set actK 10;
set minK 0;
set maxK 500; /** Assume 500 as the maximum possible value of K **/
2023-02-27 01:24:22 +08:00
set maxIts 0;
/** find the best value of K **/
2023-02-27 01:24:22 +08:00
loop 0 1
quote actual k value: 'actK';
2023-02-27 01:24:22 +08:00
set a 1-('actK'/('actK'+1));
quote 'a';
set b ('actK'/('actK'+'gVal'-1))-('actK'/('actK'+'gVal'));
quote 'b';
set Nval 'a'/'b';
quote N value: 'Nval';
if (('Nval'>14.8)&&('Nval'<15.2)) endloop; end /** N is in range **/
2023-02-27 01:24:22 +08:00
if ('Nval'>15.2)
set minK 'actK';
else
set maxK 'actK';
end
set a ('maxK'-'minK')/2;
set actK 'minK' + 'a';
set maxIts ++;
if ('maxIts'==100) endloop; end /** emergency exit **/
2023-02-27 01:24:22 +08:00
setloop 0;
stop
/** If out of emergency **/
2023-02-27 01:24:22 +08:00
if ('maxIts'==100)
quote Iterations are not finished;
quote Best K is 'actK';
2023-02-27 01:24:22 +08:00
proc /;
end
quote K value: 'actK' (N='Nval');
2023-02-27 01:24:22 +08:00
piwe='actK';
2023-02-26 03:32:18 +08:00
2023-02-27 01:24:22 +08:00
/*Reopen tnt*/
2023-02-26 03:32:18 +08:00
procedure %1;
2023-07-19 01:24:49 +08:00
hold 10000;
2023-02-27 01:24:22 +08:00
/*Search trees*/
2023-02-26 03:32:18 +08:00
xpiwe(*;
2023-07-19 01:24:49 +08:00
mult=replic 1000 tbr hold 100;
2023-02-27 01:24:22 +08:00
sect: slack 1000;
2023-07-19 01:24:49 +08:00
xmult=hit 1000 noupdate replic 10 drift 10 ratchet 10 fuse 10 hold 1 keepall;
2023-02-26 03:45:29 +08:00
piwe&;
2023-02-27 01:24:22 +08:00
/*Export trees*/
2023-02-26 03:32:18 +08:00
export= trees.tre;
taxname-;
export= trees_no.tre;
taxname=;
2023-02-27 01:24:22 +08:00
/*Consensus tree*/
2023-02-26 03:32:18 +08:00
bbreak=tbr;
2023-02-27 01:24:22 +08:00
nelsen *;
2023-02-26 03:32:18 +08:00
2023-02-27 01:24:22 +08:00
/*Get Bremer/jak/boot support*/
2023-02-26 03:32:18 +08:00
ttags=;
2023-02-27 01:24:22 +08:00
sub 1; hold +1000; bbreak=fill;
sub 2; hold +2000; bbreak=fill;
sub 3; hold +3000; bbreak=fill;
sub 4; hold +4000; bbreak=fill;
sub 5; hold +5000; bbreak=fill;
sub 6; hold +6000; bbreak=fill;
sub 7; hold +7000; bbreak=fill;
sub 8; hold +8000; bbreak=fill;
bsupport[;
resample jak replications 1000;
2023-02-26 03:32:18 +08:00
resample boot replications 1000;
2023-02-27 01:24:22 +08:00
/*Export consensus tree with supports*/
ttags & resample.svg thickness 7 italics fontsize 15;
export < resample.tre;
2023-02-26 03:32:18 +08:00
taxname-;
export - resample_no.tre;
2023-02-26 03:32:18 +08:00
/*Apomorphic characters*/
export = winclada.tre;
taxname =;
ttags-;
ttags=;
apo >0;
ttags & apo.svg thickness 7 italics fontsize 15;
export < apo.tre;
taxname-;
export - apo_no.tre;
ttags-;
2023-02-27 01:24:22 +08:00
/*Caulculate TL/CI/RI score*/
2023-02-26 03:32:18 +08:00
length *;
2023-02-27 01:24:22 +08:00
report-;
var-;
var =
0 themin
1 themax
+ CIs [ ( ntrees + 1 ) ]
+ RIs [ ( ntrees + 1 ) ]
+ this
;
set themin minsteps;
set themax maxsteps;
loop 0 ntrees
progress #1 (ntrees+1) Calculating indices...;
set this length[#1];
set CIs[#1] 'themin'/'this'; /*CI=1 means no homoplasy*/
set RIs[#1] ('themax'-'this')/('themax'-'themin'); /*RI=1 character fits perfetcly*/
stop
progress/;
report=;
macfloat 3;
maketable CIs Consistency index;
maketable RIs Retention index;
/*Report*/
quote - /----------------------------------------------\;
quote - | The analysis has been finished. |;
quote - | The file `tnt.log` contains |;
quote - | K, TL, CI and RI |;
quote - | The file `trees*.tre` contain |;
quote - | trees found by mult and xmult |;
quote - | The file `resample*.tre` contain |;
2023-02-27 01:24:22 +08:00
quote - | strict consensus tree |;
quote - | The file `apo*.tre` contain |;
quote - | tree with apomorphic character |;
2023-02-27 01:24:22 +08:00
quote - | The file `*_no.tre` contain |;
quote - | tree with `taxaname-` |;
quote - | The file `resample.svg` contain |;
2023-02-27 01:24:22 +08:00
quote - | strict consensus tree with |;
quote - | relative bremer, jak and boot |;
quote - | support on the tree |;
quote - | The file `apo.svg` contain the |;
quote - | tree with apomorphy mapping |;
quote - | The file `winclada.tre` can be |;
quote - | converted by tnt2winclada |;
2023-02-27 01:24:22 +08:00
quote - \----------------------------------------------/;
/*Quit*/
zzz;