跳至内容
售后
用户工具
登录
站点工具
搜索
工具
显示页面
修订记录
反向链接
最近更改
媒体管理器
网站地图
登录
>
最近更改
媒体管理器
网站地图
您的足迹:
无参结果文件生成all_compare.xls表格
编辑本页后请点击“保存”。请参阅
syntax
了解维基语法。只有在您能
改进
该页面的前提下才编辑它。如果您想尝试一些东西,请先到
playground
热身。
媒体文件
=====无参结果文件生成all_compare.xls表格===== 无参结果填加差异结果,类似有参的all_compare.xls <code> import sys import glob deg = [] deg.extend(sorted(glob.glob(sys.argv[1]+"/"+"*.Differential_analysis_results.xls"))) compares = [] for each in deg: deg_ = each.split("/")[-1].strip(".Differential_analysis_results.xls") compares.append(deg_) print(deg_ + "_" + deg_.split("vs")[0] + "\t" + deg_ + "_" + deg_.split("vs")[1] + "\t" + deg_ + "_log2FoldChange" + "\t" + deg_ + "_pvalue" + "\t" + deg_ + "_padj") deg_result = {} all_annot = open(sys.argv[2]).readlines() header = all_annot[0].strip().split("\t")[0:66] print("\t".join(header)) for each in deg: compare = each.split("/")[-1].strip(".Differential_analysis_results.xls") deg_file = open(each).readlines() headers = deg_file[0].strip().split("\t") compare_control = compare + "_" + compare.split("vs")[0] compare_treat = compare + "_" + compare.split("vs")[1] compare_log2fc = compare + "_log2FoldChange" compare_pvalue = compare + "_pvalue" compare_padj = compare + "_padj" for each_lines in deg_file[1:]: each_value = each_lines.strip().split("\t") gene_id = each_value[0] if gene_id not in deg_result.keys(): deg_result[gene_id] = {} else: next deg_result[gene_id][compare_control] = each_value[1] deg_result[gene_id][compare_treat] = each_value[2] deg_result[gene_id][compare_log2fc] = each_value[3] deg_result[gene_id][compare_pvalue] = each_value[4] deg_result[gene_id][compare_padj] = each_value[5] #all_annot = open(sys.argv[2]).readlines() #header = all_annot[0].strip().split("\t")[0:66] #print("\t".join(header)) for each in all_annot[1:]: each_lines = each.strip().split("\t") befor = "\t".join(each_lines[0:66]) after_list = [] for each_c in compares: compare_control = each_c + "_" + each_c.split("vs")[0] compare_treat = each_c + "_" + each_c.split("vs")[1] compare_log2fc = each_c + "_log2FoldChange" compare_pvalue = each_c + "_pvalue" compare_padj = each_c + "_padj" after_list.append(deg_result[each_lines[0]][compare_control]) after_list.append(deg_result[each_lines[0]][compare_treat]) after_list.append(deg_result[each_lines[0]][compare_log2fc]) after_list.append(deg_result[each_lines[0]][compare_pvalue]) after_list.append(deg_result[each_lines[0]][compare_padj]) after = "\t".join(after_list) print(befor+"\t"+after) </code>
保存
预览
取消
编辑摘要
当您选择开始编辑本页,即寓示你同意将你贡献的内容按下列许可协议发布:
CC Attribution-Share Alike 4.0 International
无参结果文件生成all_compare.xls表格.txt
· 最后更改: 2023/01/05 06:37 由
fengjie
页面工具
显示页面
修订记录
反向链接
回到顶部