def calc_coverage(ref, start, end, length, nucs):
ref = ref[start - <NUM_LIT:1>:end]<EOL>bases = <NUM_LIT:0><EOL>for pos in ref:<EOL><INDENT>for base, count in list(pos.items()):<EOL><INDENT>if base in nucs:<EOL><INDENT>bases += count<EOL><DEDENT><DEDENT><DEDENT>return float(bases)/float(length)<EOL>
calculate coverage for positions in range start -> end