add: setk

This commit is contained in:
kuoi 2023-02-26 02:42:56 +08:00
parent efcf81cd34
commit 39c4340a6d
4 changed files with 96 additions and 24 deletions

21
README Normal file
View File

@ -0,0 +1,21 @@
# TNT Script used by Guoyi
This scripts are followed MIT except for setk.run which belongs to Salvador Arias(Instituto Miguel Lillo, San Miguel de Tucumán, Argentina).
## tnt.run
- `file.tnt` must be changed to your own file;
- `trees.tre`, `bt.tre` are trees with taxaname;
- `trees_no.tre`, `bt_no.tre` are trees without taxaname which can be put into Winclada with the `file.tnt`;
- `majority` can be replaced by `nelsen`;
- `boot` can be replaced by `jack`;
## setk_tnt.run
- `file.tnt` must be changed to your own file;
- You can find the recommended k from `setk.log` and then change in `piwe=` `tnt.run`;

71
setk.run Normal file
View File

@ -0,0 +1,71 @@
macro=
var:
actK
minK
maxK
gVal
a
b
Nval
maxIts
;
if (ntax<0)
quote NO HAY DATOS!;
proc/;
end
set gVal 1;
/* busca el valor de g */
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 valor de g = 'gVal';
set actK 10;
set minK 0;
set maxK 500; /* Asume 500 como el maximo posible valor de K */
set maxIts 0;
/* busca el mejor valor de K */
loop 0 1
quote actual valor de k = 'actK';
set a 1-('actK'/('actK'+1));
quote 'a';
set b ('actK'/('actK'+'gVal'-1))-('actK'/('actK'+'gVal'));
quote 'b';
set Nval 'a'/'b';
quote valor de N = 'Nval';
if (('Nval'>14.8)&&('Nval'<15.2)) endloop; end /* N esta en el rango */
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 /* salida de emergencia */
setloop 0;
stop
/* Si salio de emergencia */
if ('maxIts'==100)
quote NO SE TERMINARON LAS ITERACIONES;
quote mejor K encontrado: 'actK';
proc /;
end
quote Valor de K: 'actK' (N='Nval');
piwe='actK';
proc/;

4
setk_tnt.run Normal file
View File

@ -0,0 +1,4 @@
log setk.log;
p file.tnt;
setk.run;
quit;

View File

@ -1,24 +0,0 @@
mxram 10240 ;
nstates 32 ;
nstates NOGAPS ;
piwe=12;
procedure mor.tnt ;
log winclada.log ;
hold 100000 ;
xpiwe(*; mult=replic 1000 tbr hold 10;
xpiwe&; piwe&;
export= treeswc.tre ;
bbreak=tbr ;
majority * ;
resample boot replications 1000;
export= btwc.tre ;
length * ;
stats.run;
quit ;