help= "please set method Dissimilarity index, partial match to manhattan euclidean \ canberra bray kulczynski jaccard gower altGower morisita horn\ mountford raup binomial chao cao mahalanobis") args = parser.parse_args() params = vars(args) return params if __name__ == '__main__': reload(sys) sys.setdefaultencoding('utf8') params = read_params(sys.argv) tool_default_dir = const.tool_default_dir mkdir(params['out_dir']) use_method = params["method"] pdf_file = params['out_dir'] + "/" + use_method + '_adonis_pcoa.pdf' png_file = params['out_dir'] + "/" + use_method + '_adonis_pcoa.png' env = Environment(loader=FileSystemLoader(tool_default_dir), autoescape=False) template = env.get_template("t12_adonis_pcoa.R") Rtxt = template.render(tool_default_dir = tool_default_dir,\ profile_table =params['profile_table'],\ group_file =params['group_file'],\ pdf_file = pdf_file,\ method = use_method) with open("%s/adonis_pcoa.R" % params["out_dir"], "w") as fqout: fqout.write(Rtxt) Rrun("%s/adonis_pcoa.R" % params["out_dir"]) image_trans(pdf_file, png_file)
args = parser.parse_args() params = vars(args) return params if __name__ == '__main__': reload(sys) sys.setdefaultencoding('utf8') params = read_params(sys.argv) tool_default_dir = const.tool_default_dir profile_table = params["profile_table"] group_file = params["group_file"] out_dir = params["out_dir"] top = params["top"] pdf_file = "%s/heatmap.pdf"%out_dir png_file = "%s/heatmap.png"%out_dir mkdir(out_dir) env = Environment(loader=FileSystemLoader(tool_default_dir), autoescape=False) template = env.get_template("t06_heatmap.R") Rtxt = template.render(tool_default_dir = tool_default_dir,\ out_dir = out_dir,\ profile_table = profile_table,\ group_file=group_file,\ pdf_file = pdf_file,\ top=top) with open("%s/heatmap.R"%(params["out_dir"]),"w") as fqout: fqout.write(Rtxt) Rrun("%s/heatmap.R"%(params["out_dir"])) image_trans(pdf_file,png_file)
params = vars(args) return params if __name__ == '__main__': reload(sys) sys.setdefaultencoding('utf8') params = read_params(sys.argv) tool_default_dir = const.tool_default_dir profile_table = params["profile_table"] out_dir = params["out_dir"] out_dir = "%s/%s/"%(out_dir,params["level"]) mkdir(out_dir) group_file = params["group_file"] _,_,_,group_num = parse_group(group_file) pdf_file = "%s/venn.png"%out_dir png_file = "%s/venn.png"%out_dir if group_num<6 and group_num>=2: env = Environment(loader=FileSystemLoader(tool_default_dir),autoescape=False) template = env.get_template("t07_venn_flower.R") Rtext = template.render(tool_default_dir = tool_default_dir,\ png_file=png_file,\ group_file = group_file,\ profile_table = profile_table) with open(out_dir + 'venn_flower.R', 'w') as fp: fp.write(Rtext) Rrun("%s/venn_flower.R"%out_dir) # image_trans(300,pdf_file,png_file) else: pass
help="set profile table file") parser.add_argument('-o', '--out_dir', dest='out_dir', metavar='out_dir', type=str, required=True, help="set out put dir") parser.add_argument('-g','--group_file',dest='group_file',metavar='group',type=str,required=True, help='set group file') args = parser.parse_args() params = vars(args) return params if __name__ == '__main__': params = read_params(sys.argv) bin_default_dir = const.bin_default_dir out_dir = params['out_dir'] profile_table = params['profile_table'] pdf_file = out_dir+"top.pdf" png_file = out_dir+"top.png" group_file = params['group_file'] vars = {'group_file': group_file, 'pdf_file':pdf_file, "profile_table":profile_table } env = Environment(loader=FileSystemLoader("%s/02.taxonomy/"%bin_default_dir),autoescape=False) template = env.get_template("207_top.R") Rtext = template.render(tool_default_dir=const.tool_default_dir,\ group_file=group_file,\ pdf_file = pdf_file,\ profile_table = profile_table) with open(out_dir + '207_top.R', 'w') as fp: fp.write(Rtext) Rrun("%s/207_top.R"%out_dir) # os.system("convert -density 300 %s %s"%(pdfoutput,pngoutput))
help="please set method Dissimilarity index, partial match to manhattan euclidean \ canberra bray kulczynski jaccard gower altGower morisita horn\ mountford raup binomial chao cao mahalanobis") args = parser.parse_args() params = vars(args) return params if __name__ == '__main__': reload(sys) sys.setdefaultencoding('utf8') params = read_params(sys.argv) tool_default_dir = const.tool_default_dir mkdir(params['out_dir']) use_method = params["method"] pdf_file = params['out_dir'] +"/"+use_method+ '_anosim.pdf' png_file = params['out_dir'] +"/"+use_method+ '_anosim.png' txt_file = params['out_dir'] +"/"+use_method+ '_anosim.txt' env = Environment(loader=FileSystemLoader(tool_default_dir),autoescape=False) template = env.get_template("t04_anosim.R") Rtxt = template.render(tool_default_dir = tool_default_dir,\ profile_table =params['profile_table'],\ group_file =params['group_file'],\ pdf_file = pdf_file,\ method = use_method,\ txt_file=txt_file) with open("%s/anosim.R"%params["out_dir"],"w") as fqout: fqout.write(Rtxt) Rrun("%s/anosim.R"%params["out_dir"]) image_trans(pdf_file,png_file)
help="set the top number") parser.add_argument('-o', '--out_dir', dest='out_dir', metavar='DIR', type=str, required=True, help="set the output dir") args = parser.parse_args() params = vars(args) return params if __name__ == '__main__': reload(sys) sys.setdefaultencoding('utf8') params = read_params(sys.argv) tool_default_dir = const.tool_default_dir p_file = params["p_file"] mkdir(params['out_dir']) pdf_file = params['out_dir'] + '/diff_boxplot.pdf' png_file = params['out_dir'] + '/diff_boxplot.png' env = Environment(loader=FileSystemLoader(tool_default_dir), autoescape=False) template = env.get_template("t09_diff_boxplot.R") Rtxt = template.render(tool_default_dir=tool_default_dir, \ profile_table=params['profile_table'], \ group_file=params['group_file'], \ p_file=p_file,\ pdf_file = pdf_file,\ top = params["top"]) with open("%s/diff_boxplot.R" % (params["out_dir"]), "w") as fqout: fqout.write(Rtxt) Rrun("%s/diff_boxplot.R" % params["out_dir"], ) image_trans( pdf_file, png_file)
if __name__ == '__main__': params = read_params(sys.argv) bin_defdir = '%s/02.taxon' % const.bin_defdir mkdir(params['out_dir']) use_method = params["method"] pdf_file = params['out_dir'] + "/" + use_method + 'pcoa.pdf' png_file = params['out_dir'] + "/" + use_method + 'pcoa.png' env = Environment(loader=FileSystemLoader(bin_defdir), autoescape=False) if params['two_legend']: if params['with_boxplot']: template = env.get_template("g07_pcoa_two.R") else: template = env.get_template("g07_pcoa_two.R") #TODO two_legend and with_boxplot else: if params['with_boxplot']: template = env.get_template("g07_pcoa_with_boxplot.R") else: template = env.get_template("g07_pcoa.R") Rtxt = template.render(tool_default_dir=const.tool_defdir,\ profile_table=params['profile_table'],\ group_file =params['group_file'],\ pdf_file = pdf_file,\ method = use_method) with open("%s/pcoa.R" % (params["out_dir"]), "w") as fqout: fqout.write(Rtxt) Rrun("%s/pcoa.R" % params["out_dir"])
parser.add_argument('-o', '--out_dir', dest='out_dir', metavar='DIR', type=str, required=True, help="set the output dir") parser.add_argument('-c','--class',dest="class",metavar='string', type=str,required=True, help="set phylum or genus or species") args = parser.parse_args() params = vars(args) return params if __name__ == '__main__': reload(sys) sys.setdefaultencoding('utf8') params = read_params(sys.argv) tool_default_dir = const.tool_default_dir mkdir(params['out_dir']) class_ = params["class"] pdf_file = params['out_dir'] +"/"+class_+ '.ternary.pdf' png_file = params['out_dir'] +"/"+class_+ '.ternary.png' env = Environment(loader=FileSystemLoader(tool_default_dir),autoescape=False) template = env.get_template("t13_ternary.R") Rtxt = template.render(tool_default_dir = tool_default_dir,\ profile_table =params['profile_table'],\ group_file =params['group_file'],\ pdf_file = pdf_file,\ class_ = class_) with open("%s/ternary.R" % params["out_dir"],"w") as fqout: fqout.write(Rtxt) Rrun("%s/ternary.R"%params["out_dir"]) image_trans(pdf_file,png_file)
dest='group_file', metavar='FILE', type=str, required=True, help="set the group file") parser.add_argument('-o', '--out_dir', dest='out_dir', metavar='DIR', type=str, required=True, help="set the output dir") args = parser.parse_args() return vars(args) if __name__ == '__main__': params = read_params(sys.argv) bin_defdir = '%s/02.taxon' % const.bin_defdir mkdir(params['out_dir']) txt_file = params['out_dir'] + "/mrpp.txt" env = Environment(loader=FileSystemLoader(bin_defdir), autoescape=False) template = env.get_template("g10_mrpp.R") Rtxt = template.render(tool_default_dir=const.tool_defdir,\ profile_table=params['profile_table'],\ group_file =params['group_file'],\ txt_file=txt_file) with open("%s/mrpp.R" % params["out_dir"], "w") as fqout: fqout.write(Rtxt) Rrun("%s/mrpp.R" % params["out_dir"])
png_file = params['out_dir'] + '/pca.png' env = Environment(loader=FileSystemLoader(tool_default_dir), autoescape=False) if params["Kmeans_cluster"]: if params["with_boxplot"]: template = env.get_template("1_pca_kmeans_withbox.R") else: template = env.get_template("1_pca_kmeans.R") else: if params['two_legend']: if params['with_boxplot']: template = env.get_template("1_pca_two.R") else: template = env.get_template("1_pca_two.R") else: if params['with_boxplot']: template = env.get_template("1_pca_with_boxplot.R") else: template = env.get_template("1_pca.R") Rtxt = template.render(tool_default_dir=tool_default_dir, \ profile_table=params['profile_table'], \ group_file=params['group_file'], \ pdf_file=pdf_file) with open("%s/pca.R" % (params["out_dir"]), "w") as fqout: fqout.write(Rtxt) Rrun("%s/pca.R" % params["out_dir"], ) image_trans(300, pdf_file, png_file)
return vars(args) if __name__ == '__main__': params = read_params(sys.argv) bin_defdir = '%s/02.taxon' % const.bin_defdir mkdir(params['out_dir']) use_method = params["method"] pdf_file = params['out_dir'] + "/" + use_method + 'nmds.pdf' png_file = params['out_dir'] + "/" + use_method + 'nmds.png' env = Environment(loader=FileSystemLoader(bin_defdir), autoescape=False) if params['two_legend']: if params['with_boxplot']: template = env.get_template("g08_nmds_two.R") else: template = env.get_template("g08_nmds_two.R") else: if params['with_boxplot']: template = env.get_template("g08_nmds_with_boxplot.R") else: template = env.get_template("g08_nmds.R") Rtxt = template.render(tool_default_dir = const.tool_defdir,\ profile_table=params['profile_table'],\ group_file =params['group_file'],\ pdf_file = pdf_file,\ method = use_method) with open("%s/nmds.R" % params["out_dir"], "w") as fqout: fqout.write(Rtxt) Rrun("%s/nmds.R" % params["out_dir"])
parser.set_defaults(paired=False) args = parser.parse_args() params = vars(args) params['paired'] = judge(params['paired']) return params if __name__ == '__main__': reload(sys) sys.setdefaultencoding('utf8') params = read_params(sys.argv) tool_default_dir = const.tool_default_dir out_dir = params["out_dir"] profile_table = params["profile_table"] group_file = params["group_file"] use_mothed = params["test"] mkdir(out_dir) env = Environment(loader=FileSystemLoader(tool_default_dir),autoescape=False) template = env.get_template("t08_diff.R") Rtext = template.render(tool_default_dir = tool_default_dir,\ profile_table=profile_table,\ group_file=group_file,\ out_dir = out_dir,\ mothed=use_mothed,\ p_cutoff=params["cutoff"],\ fdr=params["fdr"],\ paired = params['paired']) with open("%s/diff.R"%out_dir,"w") as fqw: fqw.write(Rtext) Rrun("%s/diff.R"%(out_dir))
help="set the group file") parser.add_argument('-o', '--out_dir', dest='out_dir', metavar='FILE', type=str, required=True, help="set the out dir") parser.add_argument('-f', '--file_name', dest='file_name', metavar='FILE', type=str, required=True, help="set the file name") parser.add_argument('--num', dest='num', metavar='NUM', type=int, required=True, help="set the num * profile") args = parser.parse_args() params = vars(args) return params if __name__ == '__main__': reload(sys) sys.setdefaultencoding('utf8') params = read_params(sys.argv) bin_default_dir = const.bin_default_dir bin_kegg_default_dir = "%s/07.kegg/"%(bin_default_dir) mkdir(params['out_dir']) txt_file = "%s/%s"%(params['out_dir'],params["file_name"]) env = Environment(loader=FileSystemLoader(bin_kegg_default_dir), autoescape=False) template = env.get_template("708_sample2profile.R") Rtxt = template.render(profile_table=params['profile_table'], \ group_file=params['group_file'], \ txt_file=txt_file,\ num=params["num"]) with open("%s/708_sample2profile.R" % (params["out_dir"]), "w") as fqout: fqout.write(Rtxt) Rrun("%s/708_sample2profile.R" % params["out_dir"], ) os.system("sed -i '1s/^/ko_num\t/g' %s"%txt_file)
help='set group file') args = parser.parse_args() params = vars(args) return params if __name__ == '__main__': params = read_params(sys.argv) bin_default_dir = const.bin_default_dir out_dir = params['out_dir'] profile_table = params['profile_table'] pdf_file = out_dir + "top.pdf" png_file = out_dir + "top.png" group_file = params['group_file'] vars = { 'group_file': group_file, 'pdf_file': pdf_file, "profile_table": profile_table } env = Environment(loader=FileSystemLoader("%s/02.taxonomy/" % bin_default_dir), autoescape=False) template = env.get_template("g03_top_boxplot.R") Rtext = template.render(tool_default_dir=const.tool_default_dir,\ group_file=group_file,\ pdf_file = pdf_file,\ profile_table = profile_table) with open(out_dir + 'top_boxplot.R', 'w') as fp: fp.write(Rtext) Rrun("%s/top_boxplot.R" % out_dir)