6 #die "Usage: $0 <s> <t>\nW(AA), W(Aa) and W(aa) is 1-s, 1, 1-t respectively.\n" if @ARGV<2;
11 1 TAGACAATGACATACGTTATGTTGAA
12 2 ..T...TA.G.C.C...C..T.....
13 3 ..T...T.C..C.C.AA..CT.....
14 4 .TTCACT...GCG.A...T.T.G.T.
15 5 C.T...T..G.C.C...C..TC.C.G
17 my @t=split /\n/,$mfa;
19 map {@_=split /\s+/;$dat{$_[0]}=[split //,$_[1]]} @t;
21 my @seqid = sort keys %dat;
23 my $seqlen = @
{$dat{'1'}};
25 print "$_: ",join('',@
{$dat{$_}}),"\n" for @seqid;
26 print "=== @seqid ===\n$mfa";
29 for my $i (0 .. $#{$dat{'1'}}) {
30 my $ref = $dat{'1'}->[$i];
31 for my $k (keys %dat) {
33 if ($dat{$k}->[$i] eq '.') {
34 $dat{$k}->[$i] = $ref;
41 print "P: ",join('',@PolyT),"\n\n";
44 ++$PolyC if $_ and $_ eq '1';
47 print "$_: ",join('',@
{$dat{$_}}),"\n" for @seqid;
48 print "=== $seqcnt,$seqlen,$PolyC ===\n";
54 my @t = sort {$a <=> $b} values %t;
58 $p /= $sum; $q /= $sum;
59 my $Tpi = 2*$p*$q*$seqcnt / ($seqcnt-1);
65 for my $i (0 .. $#{$dat{'1'}}) {
68 push @arr,$dat{$k}->[$i];
77 for my $i ( 1 .. ($seqcnt-1) ) {
79 print "$i: $wUnder\n";
81 my $Tw = $PolyC / $wUnder / $totalLen;
82 print "-> $Tw, $wUnder\n";
84 print "Tpi: $Tpi Tw: $Tw\n";