def density(args):
    p = OptionParser(density.__doc__)
    opts, args = p.parse_args(args)

    if len(args) != 2:
        sys.exit(not p.print_help())

    bedfile, fastafile = args
    bed = Bed(bedfile)
    sizes = Sizes(fastafile).mapping
    header = "seqid features size density_per_Mb".split()
    print "\t".join(header)
    for seqid, bb in bed.sub_beds():
        nfeats = len(bb)
        size = sizes[seqid]
        ds = nfeats * 1e6 / size
        print "\t".join(str(x) for x in \
                    (seqid, nfeats, size, "{0:.1f}".format(ds)))
Test PackageFinder only accepts stable versioned releases by default.
dataset/ETHPy150Open tanghaibao/jcvi/formats/bed.py/density--crossover with--dataset/ETHPy150Open pypa/pip/tests/unit/test_finder.py/test_finder_only_installs_stable_releases