Scripts/Codonweight.run
From TNT
codonweight
Author: Mark Siddall.
Version: 2.0.
For: reweight 1st 2nd 3rd codon positions.
Arguments: 5 see first errmsg in script.
Example: not provided.
Script
Scripts may not be displaying correctly here at present, use the script from the provided file in the archive.
macro =;
if ( !argnumber ) errmsg
This macro differentially weights codon positions. Rerun with 5 arguments specifying:
1st - first pos weight
2nd - second pos weight
3rd - third pos weight
4th - starting char num
5th - ending char num
Of course it assumes that starting char num is pos 1 And checks if you want to downweight
end if (%5 > nchar) errmsg
End of partition exceeds character numbers. Everything starts from 0 not from 1
end if (%4 == 1) errmsg
Everything starts from 0 not from 1
end if (%4 >= %5) errmsg
Did you want me to count backwards? That makes no sense at all!
end
var: i j group1[(nchar/3+1)] group2[(nchar/3+1)] group3[(nchar/3+1)] gp1 gp2 gp3 maxwt;
if (getresponse [Would you like to reset all character weights to the maximum you have entered? If you answer Y all prior weights are gone.]==1)
if (%1 > 'maxwt') set maxwt %1; end if (%2 > 'maxwt') set maxwt %2; end if (%3 > 'maxwt') set maxwt %3; end ccode /'maxwt' .; end;
set gp1 0; set gp2 0; set gp3 0;
set j %4 ; loop %4 %5 if (#1 == 'j') set group1['gp1'] #1; set gp1++; end if (#1 == ('j'+1)) set group2['gp2'] #1; set gp2 ++ ; end if (#1 == ('j'+2)) set group3['gp3'] #1;
set gp3 ++ ;
set j +=3;
end
stop ; set gp1--; set gp2--; set gp3--;
loop 0 'gp1' set i 'group1[#1]'; ccode /%1 'i'; stop;
loop 0 'gp2' set i 'group2[#1]'; ccode /%2 'i'; stop;
loop 0 'gp3' set i 'group3[#1]'; ccode /%3 'i'; stop;
ccode; quote If your intent was to downweight third positions in this partition
do consider upweighting the characters NOT in the partition.;
macro-; proc/;