def _reads_per_position(bam_in, loci_file, out_dir):
data = Counter()<EOL>a = pybedtools.BedTool(bam_in)<EOL>b = pybedtools.BedTool(loci_file)<EOL>c = a.intersect(b, s=True, bed=True, wo=True)<EOL>for line in c:<EOL><INDENT>end = int(line[<NUM_LIT:1>]) + <NUM_LIT:1> + int(line[<NUM_LIT:2>]) if line[<NUM_LIT:5>] == "<STR_LIT:+>" else int(line[<NUM_LIT:1>]) + <NUM_LIT:1><EOL>start = int(line[<NUM_LIT:1>]) + <NUM_LIT:1> if line[<NUM_LIT:5>] == "<STR_LIT:+>" else int(line[<NUM_LIT:1>]) + <NUM_LIT:1> + int(line[<NUM_LIT:2>])<EOL>side5 = "<STR_LIT>" % (line[<NUM_LIT:15>], start)<EOL>side3 = "<STR_LIT>" % (line[<NUM_LIT:15>], end)<EOL>data[side5] += <NUM_LIT:1><EOL>data[side3] += <NUM_LIT:1><EOL><DEDENT>counts_reads = op.join(out_dir, '<STR_LIT>')<EOL>with open(counts_reads, '<STR_LIT:w>') as out_handle:<EOL><INDENT>for k in data:<EOL><INDENT>print(k, file=out_handle, end="<STR_LIT>")<EOL><DEDENT><DEDENT>return counts_reads<EOL>
Create input for compute entropy