def genome_coverage(genomes, scaffold_coverage, total_bases):
coverage = {}<EOL>custom = {}<EOL>std = {}<EOL>for genome in genomes:<EOL><INDENT>for sequence in parse_fasta(genome):<EOL><INDENT>scaffold = sequence[<NUM_LIT:0>].split('<STR_LIT:>>')[<NUM_LIT:1>].split()[<NUM_LIT:0>]<EOL>coverage, std = sum_coverage(coverage, std, genome, scaffold, sequence, scaffold_coverage)<EOL>custom = calc_custom(custom, genome, scaffold, sequence, scaffold_coverage, total_bases)<EOL><DEDENT><DEDENT>std = calc_std(std)<EOL>custom_std = calc_std(custom)<EOL>custom_av = {}<EOL>for genome in custom:<EOL><INDENT>custom_av[genome] = []<EOL>for sample in custom[genome]:<EOL><INDENT>custom_av[genome].append(numpy.mean(sample))<EOL><DEDENT><DEDENT>for genome in coverage:<EOL><INDENT>print('<STR_LIT>' % (genome, coverage[genome][<NUM_LIT:0>][<NUM_LIT:1>]))<EOL><DEDENT>if total_bases is True:<EOL><INDENT>total_bases = calc_total_mapped_bases(coverage)<EOL><DEDENT>absolute = absolute_abundance(coverage, total_bases)<EOL>for genome in coverage:<EOL><INDENT>calculated = []<EOL>for calc in coverage[genome]:<EOL><INDENT>calculated.append(calc[<NUM_LIT:0>] / calc[<NUM_LIT:1>])<EOL><DEDENT>coverage[genome] = calculated<EOL><DEDENT>relative = relative_abundance(coverage)<EOL>return coverage, std, absolute, relative, custom_av, custom_std<EOL>
coverage = (number of bases / length of genome) * 100