def index(args):
    p = OptionParser(index.__doc__)
    p.add_option("--fasta", help="Generate bedgraph and index")
    p.add_option("--query", help="Chromosome location")
    p.set_outfile()

    opts, args = p.parse_args(args)

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

    bedfile, = args
    fastafile = opts.fasta
    if fastafile:
        bedfile = make_bedgraph(bedfile, fastafile)

    bedfile = sort([bedfile])

    gzfile = bedfile + ".gz"
    if need_update(bedfile, gzfile):
        cmd = "bgzip {0}".format(bedfile)
        sh(cmd)

    tbifile = gzfile + ".tbi"
    if need_update(gzfile, tbifile):
        cmd = "tabix -p bed {0}".format(gzfile)
        sh(cmd)

    query = opts.query
    if not query:
        return

    cmd = "tabix {0} {1}".format(gzfile, query)
    sh(cmd, outfile=opts.outfile)
Test that 'pytest' archives match for 'pytest'
dataset/ETHPy150Open tanghaibao/jcvi/formats/bed.py/index--crossover with--dataset/ETHPy150Open pypa/pip/tests/unit/test_finder.py/test_link_package_versions.test_link_package_versions_match_wheel