def run_bedtools():

    # set up a BAM-based BedTool
    bt = pybedtools.BedTool(bam_fn)

    print 'pybedtools coverageBed starting...',
    sys.stdout.flush()
    t0 = time.time()

    # Need to sort to maintain consistency with metaseq
    bt_result = bt.coverage(windows, counts=True).sort()
    bt_array = np.array([i[-1] for i in bt_result], dtype=int)

    t1 = time.time()
    print 'completed in %.2fs' % (t1 - t0)
    sys.stdout.flush()
    return bt_array
dataset/ETHPy150Open daler/metaseq/metaseq/test/examples/compare_coverage_bed.py/run_bedtools/original