def make_ML_condor_file(outpath, ml_tool,ds_name,ml, outgroup):
    conf = twophase_conf.get("ML",ml)
    ver = "*"
    if conf.startswith("@"):
        ver = conf[1:]
        conf =""
    ml_tool_path = get_tool_path(ml_tool,ver)    
    condor_temp = (open(os.path.join(condor_templates_path, "condor.%s" % ml_tool)).read() 
                   if os.path.exists(os.path.join(condor_templates_path, "condor.%s" % ml_tool)) 
                   else condor_temp_def)
    if outgroup is not None and outgroup != "":
        outg = "-o %s" %outgroup
    else:
        outg = ""
    condor_ml = condor_temp.format(exe=ml_tool_path,
                                   input="aligned.phylip",
                                   output="ml",
                                   home=HOME,
                                   options=outpath,
                                   name="ml",
                                   model= get_model_string(ml_tool, ds_name), 
                                   outgroup=outg)
    out = open(os.path.join(outpath, "condor.ml"), "w")
    out.write(condor_ml)
    out.close()
예제 #2
0
def make_alignment_condor_file(outpath, alg_tool, ds_name, alg):
    conf = twophase_conf.get("alignment", alg)
    ver = "*"
    if conf.startswith("@"):
        ver = conf[1:]
        conf = ""
    alg_tool_path = get_tool_path(alg_tool, ver)

    if conf is not None and conf != "":
        config_temp = (open(os.path.join(config_path, conf)).read().format(
            ftmodel=get_model_string("fasttree", ds_name),
            rxmodel=get_model_string("raxml", ds_name, g="CAT")))
        out = open(os.path.join(outpath, conf), "w")
        out.write(config_temp)
        out.close()

    condor_temp = (open(
        os.path.join(condor_templates_path, "condor.%s" %
                     alg_tool)).read() if os.path.exists(
                         os.path.join(condor_templates_path, "condor.%s" %
                                      alg_tool)) else condor_temp_def)
    condor_alg = condor_temp.format(exe=alg_tool_path,
                                    input=INPUT,
                                    output=ALIGNED,
                                    home=HOME,
                                    options=conf,
                                    name="alg")
    out = open(os.path.join(outpath, "condor.align"), "w")
    out.write(condor_alg)
    out.close()
예제 #3
0
def make_alignment_condor_file(outpath, alg_tool, ds_name, alg):
    conf = twophase_conf.get("alignment", alg)
    ver = "*"
    if conf.startswith("@"):
        ver = conf[1:]
        conf = ""
    alg_tool_path = get_tool_path(alg_tool, ver)

    if conf is not None and conf != "":
        config_temp = (open(os.path.join(config_path, conf)).read().format(
            ftmodel=get_model_string("fasttree", ds_name),
            rxmodel=get_model_string("raxml", ds_name, g="CAT")))
        out = open(os.path.join(outpath, conf), "w")
        out.write(config_temp)
        out.close()

    condor_temp = (open(
        os.path.join(condor_templates_path, "condor.%s" % alg_tool)).read()
                   if os.path.exists(
                       os.path.join(condor_templates_path, "condor.%s" %
                                    alg_tool)) else condor_temp_def)
    condor_alg = condor_temp.format(
        exe=alg_tool_path,
        input=INPUT,
        output=ALIGNED,
        home=HOME,
        options=conf,
        name="alg")
    out = open(os.path.join(outpath, "condor.align"), "w")
    out.write(condor_alg)
    out.close()
예제 #4
0
def make_spfn_condor_file(outpath):
    conv_tool_path = get_tool_path("spfn")    
    condor_st = condor_temp_def.format(exe=conv_tool_path,
                                         input="-e %s -r reference.fasta" %ALIGNED,
                                         output="-o %s" %SPFN_STAT,
                                         home=HOME,
                                         name="spfn",
                                         options="")
    out = open(os.path.join(outpath, "condor.spfn"), "w")
    out.write(condor_st)
    out.close()
예제 #5
0
def make_conversion_condor_file(outpath, alg):
    conv_tool_path = get_tool_path("readseq")    
    condor_conv = condor_temp_def.format(exe=conv_tool_path,
                                         options="-f12",
                                         input=INPUT if is_alignment_available(alg) else ALIGNED,
                                         output="-o aligned.phylip",
                                         home=HOME,
                                         name="readseq")
    out = open(os.path.join(outpath, "condor.convert"), "w")
    out.write(condor_conv)
    out.close()
예제 #6
0
def make_distance_condor_file(outpath):
    conv_tool_path = get_tool_path("distance")    
    condor_st = condor_temp_def.format(exe=conv_tool_path,
                                         input= ALIGNED,
                                         output="distance.stat",
                                         home=HOME,
                                         name="distance",
                                         options="")
    out = open(os.path.join(outpath, "condor.distance"), "w")
    out.write(condor_st)
    out.close()
예제 #7
0
def make_standardize_condor_file(outpath, alg):
    conv_tool_path = get_tool_path("standardizeseqnames")    
    condor_conv = condor_temp_def.format(exe=conv_tool_path,
                                         options="",
                                         input=INPUT if is_alignment_available(alg) else ALIGNED,
                                         output="aligned.mapped namemap",
                                         home=HOME,
                                         name="standardize")
    out = open(os.path.join(outpath, "condor.std"), "w")
    out.write(condor_conv)
    out.close()
예제 #8
0
def make_distance_condor_file(outpath):
    conv_tool_path = get_tool_path("distance")
    condor_st = condor_temp_def.format(exe=conv_tool_path,
                                       input=ALIGNED,
                                       output="distance.stat",
                                       home=HOME,
                                       name="distance",
                                       options="")
    out = open(os.path.join(outpath, "condor.distance"), "w")
    out.write(condor_st)
    out.close()
def make_BS_condor(outpath, num, indir):
    tool_path = get_tool_path("multilocus_bootstrap")    
    condor_conv = condor_temp_def.format(exe=tool_path,
                                         options=num,
                                         input=indir,
                                         output="BS",
                                         home=HOME,
                                         name="rep")
    out = open(os.path.join(outpath, "condor.rep"), "w")
    out.write(condor_conv)
    out.close()       
예제 #10
0
def make_standardize_condor_file(outpath, alg):
    conv_tool_path = get_tool_path("standardizeseqnames")
    condor_conv = condor_temp_def.format(
        exe=conv_tool_path,
        options="",
        input=INPUT if is_alignment_available(alg) else ALIGNED,
        output="aligned.mapped namemap",
        home=HOME,
        name="standardize")
    out = open(os.path.join(outpath, "condor.std"), "w")
    out.write(condor_conv)
    out.close()
예제 #11
0
def make_spfn_condor_file(outpath):
    conv_tool_path = get_tool_path("spfn")
    condor_st = condor_temp_def.format(exe=conv_tool_path,
                                       input="-e %s -r reference.fasta" %
                                       ALIGNED,
                                       output="-o %s" % SPFN_STAT,
                                       home=HOME,
                                       name="spfn",
                                       options="")
    out = open(os.path.join(outpath, "condor.spfn"), "w")
    out.write(condor_st)
    out.close()
예제 #12
0
def make_map_condor_file(outpath, ml):    
    conv_tool_path = get_tool_path("mapsequence")
    input = 'ml' if not ml.startswith('raxml') else "raxml/RAxML_bipartitions.ml" if ml=="raxmlboot" else 'raxml/RAxML_bestTree.ml'     
    condor_conv = condor_temp_def.format(exe=conv_tool_path,
                                         options="",
                                         input="%s namemap" %input,
                                         output="ml.mapped -rev",
                                         home=HOME,
                                         name="map")
    out = open(os.path.join(outpath, "condor.map"), "w")
    out.write(condor_conv)
    out.close()    
예제 #13
0
def make_conversion_condor_file(outpath, alg):
    conv_tool_path = get_tool_path("readseq")
    condor_conv = condor_temp_def.format(
        exe=conv_tool_path,
        options="-f12",
        input=INPUT if is_alignment_available(alg) else ALIGNED,
        output="-o aligned.phylip",
        home=HOME,
        name="readseq")
    out = open(os.path.join(outpath, "condor.convert"), "w")
    out.write(condor_conv)
    out.close()
예제 #14
0
def make_mbrate_condor_file(outpath,ml):
    tool_path = get_tool_path("missingbranch")
    input = 'ml'
    if ml == 'raxml':
        input = 'raxml/RAxML_bestTree.ml'    
    condor_st = condor_temp_def.format(exe=tool_path,
                                         input="reference.tre %s"%input,
                                         output="mb.stat",
                                         home=HOME,
                                         name="mb",
                                         options="")
    out = open(os.path.join(outpath, "condor.mb"), "w")
    out.write(condor_st)
    out.close()
예제 #15
0
def make_mbrate_condor_file(outpath, ml):
    tool_path = get_tool_path("missingbranch")
    input = 'ml'
    if ml.startswith('raxml'):
        input = 'raxml/RAxML_bestTree.ml'
    condor_st = condor_temp_def.format(exe=tool_path,
                                       input="reference.tre %s" % input,
                                       output="mb.stat",
                                       home=HOME,
                                       name="mb",
                                       options="")
    out = open(os.path.join(outpath, "condor.mb"), "w")
    out.write(condor_st)
    out.close()
예제 #16
0
def make_map_condor_file(outpath, ml):
    conv_tool_path = get_tool_path("mapsequence")
    input = 'ml' if not ml.startswith(
        'raxml'
    ) else "raxml/RAxML_bipartitions.ml" if ml == "raxmlboot" else 'raxml/RAxML_bestTree.ml'
    condor_conv = condor_temp_def.format(exe=conv_tool_path,
                                         options="",
                                         input="%s namemap" % input,
                                         output="ml.mapped -rev",
                                         home=HOME,
                                         name="map")
    out = open(os.path.join(outpath, "condor.map"), "w")
    out.write(condor_conv)
    out.close()
예제 #17
0
def make_time_condor_files(outpath):
    tool_path = get_tool_path("readcondorlog")    
    condor_st = condor_temp_def.format(exe=tool_path,
                                         input="logs/alg_condor_log",
                                         output= (ALG_STAT if not use_initial else
                                                  "%s %s" %(ALG_STAT,"initial_%s"%ALG_STAT)),
                                         home=HOME,
                                         name="rcl",
                                         options="")
    out = open(os.path.join(outpath, "condor.read.alg"), "w")
    out.write(condor_st)
    out.close()
    condor_st = condor_temp_def.format(exe=tool_path,
                                         input="logs/ml_condor_log",
                                         output="ml.stat",
                                         home=HOME,
                                         name="rclml",
                                         options="")
    out = open(os.path.join(outpath, "condor.read.ml"), "w")
    out.write(condor_st)
    out.close()
def make_ST_condor(outpath, st_tool,ds_name,st,num):
    conf = twophase_conf.get("ST",st)
    ver = "*"
    if conf.startswith("@"):
        ver = conf[1:]
        conf =""
    tool_path = get_tool_path(st_tool,ver)    
    condor_temp = open(os.path.join(condor_templates_path, "condor.%s" % st_tool)).read()
    main = condor_temp[0:-95]
    main = main.format(name="MLBS", 
                exe=tool_path)                   
    args = condor_temp[-95:-1]
    a = []  
    for bs in range(1,num+1):
        a.append( args.format(options="BS/BS.%d"%bs,
                            input="allele.table",
                            name="BS.%d" %bs))
    condor_temp =  main + "\n".join(a)
    
    out = open(os.path.join(outpath, "condor.st"), "w")
    out.write(condor_temp)
    out.close()        
예제 #19
0
def make_time_condor_files(outpath):
    tool_path = get_tool_path("readcondorlog")
    condor_st = condor_temp_def.format(
        exe=tool_path,
        input="logs/alg_condor_log",
        output=(ALG_STAT if not use_initial else "%s %s" %
                (ALG_STAT, "initial_%s" % ALG_STAT)),
        home=HOME,
        name="rcl",
        options="")
    out = open(os.path.join(outpath, "condor.read.alg"), "w")
    out.write(condor_st)
    out.close()
    condor_st = condor_temp_def.format(exe=tool_path,
                                       input="logs/ml_condor_log",
                                       output="ml.stat",
                                       home=HOME,
                                       name="rclml",
                                       options="")
    out = open(os.path.join(outpath, "condor.read.ml"), "w")
    out.write(condor_st)
    out.close()
예제 #20
0
            for rep in replicas:
                out_rep_path = os.path.join(out_ds_path, "R%d" % rep)
                print out_rep_path
                require_dir(out_rep_path)
                for ml in mltools:
                    ml_tool = ml.split(".")[0]
                    for alg in algtools:
                        out_path = os.path.join(out_rep_path,
                                                "%s_%s" % (ml, alg))
                        require_dir(out_path)

                        require_dir(os.path.join(out_path, "logs"))

                        alg_tool = alg.split(".")[0]

                        tool_path = get_tool_path("distance")
                        input = ALIGNED
                        condor_st = condor_temp_def.format(
                            exe=tool_path,
                            input=input,
                            output="distance.stat",
                            home=HOME,
                            name="distance",
                            options="")
                        out = open(
                            os.path.join(out_path, "condor.distance"), "w")
                        out.write(condor_st)
                        out.close()
#                        copy_files_for_replica(ds_path, out_path, rep, names, alg, ds_name)
#
#                        if not is_alignment_available(alg):
예제 #21
0
            for rep in replicas:
                out_rep_path = os.path.join(out_ds_path, "R%d" % rep)
                print out_rep_path
                require_dir(out_rep_path)
                for ml in mltools:
                    ml_tool = ml.split(".")[0]
                    for alg in algtools:
                        out_path = os.path.join(out_rep_path,
                                                "%s_%s" % (ml, alg))
                        require_dir(out_path)

                        require_dir(os.path.join(out_path, "logs"))

                        alg_tool = alg.split(".")[0]

                        tool_path = get_tool_path("distance")
                        input = ALIGNED
                        condor_st = condor_temp_def.format(
                            exe=tool_path,
                            input=input,
                            output="distance.stat",
                            home=HOME,
                            name="distance",
                            options="")
                        out = open(os.path.join(out_path, "condor.distance"),
                                   "w")
                        out.write(condor_st)
                        out.close()
#                        copy_files_for_replica(ds_path, out_path, rep, names, alg, ds_name)
#
#                        if not is_alignment_available(alg):