예제 #1
0
        print("run <config> <bins> <id>")
        sys.exit(1)
    else:
        config_fn = sys.argv[1]
        bin_dir = sys.argv[2]
        spid = sys.argv[3]

        f = open(config_fn, "r")
        config_dict = json.load(f)

        out_dir = config_dict["out_dir"]
        ref = config_dict["ref"]
        if not checkd(out_dir):
            mkdir(out_dir)

        man = manager(retries=2)

        jcmd = "{0}/detgaps {1} > {2}/gaps.bed".format(bin_dir, ref, out_dir)
        jout = "{}/detgaps.o".format(out_dir)
        jerr = "{}/detgaps.e".format(out_dir)

        j = hpc("lsf", cmd=jcmd, jn="detgaps", out=jout, err=jerr)
        if man.start([j], True):
            print("fail to generate gaps for {}".format(ref))
            sys.exit(1)

        procs = []

        func_list = [assess_pb, assess_10x_hic, assess_bn]
        # func_list = [aassess_bn]
        key_list = ["pb", "10x_hic", "bn"]
예제 #2
0
def func2(man):
    procs = []
    print ("func2 running")
    p = hpc("lsf", cmd="./test 1400000000", mem=1000, out="test_c2.o", err="test_c2.e" )
    procs.append(p)
    man.start(procs)
def func1(man):
    procs = []
    print ("func1 running")
    p = hpc("lsf", cmd="./test 130000", mem=1000, out="test_c1.o", err="test_c1.e")
    procs.append(p)
    man.start(procs)


if __name__ == '__main__':
    m = manager(wait=10,retries=5)  
    procs = []
    # p = hpc(cmd="ls -l > files")
    # p = hpc(cmd=["ls", '-l'], out="files")
    p = hpc("LSF", cmd="ls -l > fls", cpu="avx", hosts="bc-1-01-3", mem=1000, out="test_1.o", err="test_1.e")
    # p.chgq(m.sys[p.platform]["queues"])
    p.speak()
    procs.append(p)
    m.start(procs)
    # procs2 = []
    # p = Process(target=func2, args=(m,))
    # procs2.append(p)
    # p = Process(target=func1, args=(m,))
    # procs2.append(p)
    # for p in procs2:
        # p.start()
예제 #3
0
def cont(config_fn, bin_dir, spid, pltfm, _wait, _retries):

    f = open(config_fn, "r")
    config_dict = json.load(f)

    out_dir = config_dict["out_dir"]
    ref = config_dict["ref"]

    ref_pref = get_rm_prefix(ref)

    mkdir(out_dir)

    man = manager(wait=_wait, retries=_retries)

    procs = []
    cur_d = config_dict["cc"]
    out_cov_dir = "{}/coverage".format(out_dir)
    p = Process(target=cal_cov,
                args=(man, pltfm, ref, cur_d["ispb"], cur_d["isdip"],
                      cur_d["fofn"], cur_d["core"], cur_d["mem"],
                      cur_d["queue"], cur_d["mnmp_opt"], cur_d["bwa_opt"],
                      cur_d["skip"], out_cov_dir, bin_dir, spid, 0))
    procs.append(p)
    cur_d = config_dict["sa"]
    out_sa_dir = "{}/split_aln".format(out_dir)
    p = Process(target=split_aln,
                args=(man, pltfm, ref, cur_d["core"], cur_d["mem"],
                      cur_d["queue"], out_sa_dir, bin_dir, spid))
    procs.append(p)
    print("calculate coverage and self-alignment")
    for p in procs:
        p.start()
    for p in procs:
        p.join()
    # purge dups
    in_paf_fn = "{0}/{1}.split.paf".format(out_sa_dir, ref_pref)
    in_cov_fn = "{0}/PB.base.cov".format(out_cov_dir)
    in_cutoffs = "{0}/cutoffs".format(out_cov_dir)
    out_pd_dir = "{0}/purge_dups".format(out_dir)

    rtn = 1
    print("purge duplicates")
    pd_mem = 20000
    pd_queue = "normal"
    if "pd" in config_dict:
        pd_mem = config_dict["pd"]["mem"]
        pd_queue = config_dict["pd"]["queue"]

    if not procs[1].exitcode:
        if not procs[0].exitcode:
            rtn = purge_dups(man, pltfm, in_paf_fn, in_cov_fn, in_cutoffs, 1,
                             pd_mem, pd_queue, out_pd_dir, bin_dir, spid)
        else:
            rtn = purge_dups(man, pltfm, in_paf_fn, "", "", 1, pd_mem,
                             pd_queue, out_pd_dir, bin_dir, spid)
    if not rtn:
        gs_mem = 10000
        gs_onlyend = 1
        if "gs" in config_dict:
            gs_mem = config_dict["gs"]["mem"]
        if "oe" in config_dict:
            gs_onlyend = config_dict["gs"]["oe"]
        in_dups_fn = "{0}/dups.bed".format(out_pd_dir)
        out_dir = "{}/seqs".format(out_dir)
        rtn = get_seqs(man, pltfm, ref, in_dups_fn, 1, gs_mem, gs_onlyend,
                       out_dir, bin_dir, spid)

    procs = []
    workdir = out_dir
    if "busco" in config_dict and not rtn:
        cur_d = config_dict["busco"]
        fasta = "{}.purged.fa".format(get_rm_prefix(ref))

        p = Process(target=run_busco,
                    args=(man, pltfm, cur_d["skip"], workdir, spid, fasta,
                          cur_d["mem"], cur_d["core"], cur_d["queue"],
                          cur_d["prefix"], cur_d["lineage"], cur_d["tmpdir"]))
        procs.append(p)

    if not rtn:
        purged_ref = "{0}/{1}".format(workdir, fasta)
        out_cov_dir = "{0}/cal_cov".format(out_dir)
        cur_d = config_dict["cc"]

        if cur_d["ispb"] == 1:
            p = Process(target=cal_cov,
                        args=(man, pltfm, purged_ref, cur_d["ispb"],
                              cur_d["isdip"], cur_d["fofn"], cur_d["core"],
                              cur_d["mem"], cur_d["queue"], cur_d["mnmp_opt"],
                              cur_d["bwa_opt"], cur_d["skip"], out_cov_dir,
                              bin_dir, spid, 1))
            procs.append(p)

    if not rtn and "kcp" in config_dict:
        purged_ref = "{0}/{1}".format(workdir, fasta)
        cur_d = config_dict["kcp"]
        p = Process(target=run_kcm,
                    args=(man, pltfm, cur_d["skip"], spid, purged_ref,
                          cur_d["mem"], cur_d["core"], 21, cur_d["fofn"],
                          cur_d["prefix"], cur_d["tmpdir"]))
        procs.append(p)

    for p in procs:
        p.start()
    for p in procs:
        p.join()
    return rtn