my $countref = ($t[8] =~ tr/.,//); my $ratioo = $countref/$t[7] ; if ($countref/$t[7] >0.95) { # print "$t[1]\t$t[2]\t$t[3]: $ratioo \n"; $seq .=$t[2]; } elsif ($countref/$t[7] <=0.95){ $t[8] =~ s/[.,]/$t[2]/g; my $counta = ($t[8] =~ tr/aA//); my $countt = ($t[8] =~ tr/tT//); my $countg = ($t[8] =~ tr/gG//); my $countc = ($t[8] =~ tr/cC//); my ($ratioa, $ratiot, $ratiog, $ratioc, $rat); my @rat = (); $ratioa = $counta/$t[7]; $ratiot = $countt/$t[7]; $ratiog = $countg/$t[7]; $ratioc = $countc/$t[7]; print " $t[1] : A $ratioa T $ratiot G $ratiog C $ratioc "; my $rrat = \@rat; push (@rat, "$ratioa", "$ratiot", "$ratiog", "$ratioc"); my $countnut = 0; my $i; my @ncode; my $ccode; for $i(0..$#rat){ if ( $rrat->[$i] >= 0.05){ $i++; push (@ncode, $i); $countnut ++; $i--; } $ccode = join ("", @ncode); if ($countnut >= 3) { # print "N\n"; $seq .= "N"; } #print " code:$ccode count $countnut\n"; else { my %hash; %hash = {1, 'A', 2, 'T', 3, 'G', 4, 'C', 12, 'W', 21, 'W', 13, 'R', 31, 'R', 14, 'M', 41, 'M', 23, 'K', 32, 'K', 24, 'Y', 42, 'Y', }; print "cc", $hash{$ccode},"\n" ; } } }