def rmdup(args):
    p = OptionParser(rmdup.__doc__)
    p.add_option("-S", default=False, action="store_true",
                 help="Treat PE reads as SE in rmdup")
    opts, args = p.parse_args(args)

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

    bams = args
    cmd = "samtools rmdup"
    if opts.S:
        cmd += " -S"
    for b in bams:
        if "rmdup" in b:
            continue
        rb = b.rsplit(".", 1)[0] + ".rmdup.bam"
        if not need_update(b, rb):
            continue
        print " ".join((cmd, b, rb))
%prog rmdup *.bam > rmdup.cmds
dataset/ETHPy150Open tanghaibao/jcvi/variation/snp.py/rmdup