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

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

    ref, bams = args[0], args[1:]
    tcmd = "~/export/speedseq/bin/speedseq somatic"
    tcmd += " -t 32 -F .2 -C 3 -q 30"
    cmds = []
    for b in bams:
        pf = b.split(".")[0]
        cmd = tcmd
        cmd += " -o {0}".format(pf)
        others = ",".join(sorted(set(bams) - set([b])))
        cmd += " {0} {1} {2}".format(ref, others, b)
        cmds.append(cmd)

    write_file("somatic.sh", "\n".join(cmds))
%prog somatic ref.fasta *.bam > somatic.sh
dataset/ETHPy150Open tanghaibao/jcvi/variation/snp.py/somatic