Change to the method get_base_count():
Requiring that all of $a, $c, $t, and $g be non-zero is too strict when trying to avoid that $a+$c+$t+g be non-zero in division. Just test the sum instead. This would have generated the wrong results for sequences which lacked one of A, C, T, or G... tr/Aa// is theoretically quicker than tr/Aa/Aa/ Formatting Tested.
Please register or sign in to comment