def swap(args):
    p = OptionParser(swap.__doc__)

    opts, args = p.parse_args(args)

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

    blastfile, = args
    swappedblastfile = blastfile + ".swapped"
    fp = must_open(blastfile)
    fw = must_open(swappedblastfile, "w")
    for row in fp:
        b = BlastLine(row)
        print >> fw, b.swapped

    fw.close()
    sort([swappedblastfile])
%prog swap blastfile
dataset/ETHPy150Open tanghaibao/jcvi/formats/blast.py/swap