count_dict function for allele and gene counts