in reply to programs taking ages to exit
Try this, it should be faster. But I'm sure it could be improved further...
open (INFILE, $ARGV[0]) or die "unable to open file: $!"; # It's a good idea to check the error message in Perl's special variab +le $! my ($a_count, $c_count, $g_count, $t_count, $err_count) = 0; while ( <INFILE> ) { s/^>genome//; s/\s//g; $a_count += tr /[Aa]//; $c_count += tr /[Cc]//; $g_count += tr /[Gg]//; $t_count += tr /[Tt]//; $err_count += tr /[ACGTacgt]//c; } print "As: $a_count\n", "Cs: $c_count\n", "Gs: $g_count\n", "Ts: $t_count\n", "Errors: $err_count\n";
hth
dave
|
|---|