j=1
know2={}
path={}
for line in fp_path:
	lines= line.strip("\n").split("\t")
	know2[j] = lines[0]
	path[j] = lines[2]
	j = j+1
path_test =[]
path_sort = path.values()
for x,k in know2.items():
	if k in kg_uniq:
		path_test.append(path[x])
path_test.sort()
path_sort.sort()
test_path_dict = kongdeju.list2dict(path_test)
kegg_path_dict = kongdeju.list2dict(path_sort)
kegg_path_list = kegg_path_dict.keys()
kegg_path_list.sort()
outcome={}
outcome_short = {}
##########fisher exact test start##########
fisher_n = len(kg_uniq)
fisher_N = len(set(know2.values()))
for item in kegg_path_list:
	kegg_M = kegg_path_dict[item]
	if item in test_path_dict.keys():
		test_k = test_path_dict[item]
	else:
		test_k = 0
	p = fisher.pvalue(test_k,kegg_M,fisher_n-test_k,fisher_N-kegg_M).right_tail
예제 #2
0
	for item in type_list:
		if item in Ti:
			Ti_num = Ti_num +1
		else:
			Tv_num = Tv_num +1
	try:
		ratio = float(Ti_num)/float(Tv_num)
	except:
		ratio = 0
	return ratio
fp = open(sys.argv[1],'r')
lines = fp.readlines()
dict_out = table2dict(lines)
#####This is for chrome picture#####
chrome_list =  dict_out['Chr']
chrome_dict = kongdeju.list2dict(chrome_list)
####This is for genomic Ti/Tv#######
refs = dict_out['Ref']
vars = dict_out['Alt']
exotic_type = dict_out['Func.refGene']
genome_type_list = []
exotic_type_list = []
for ref,var,exo in zip(refs,vars,exotic_type):
	type = ref + var
	if not '-' in type:
		genome_type_list.append(type)
		if exo == 'exonic':
			exotic_type_list.append(type)

genome_ti_tv = round(Ti_Tv(genome_type_list),2)
exotic_ti_tv = round(Ti_Tv(exotic_type_list),2)
예제 #3
0
            Ti_num = Ti_num + 1
        else:
            Tv_num = Tv_num + 1
    try:
        ratio = float(Ti_num) / float(Tv_num)
    except:
        ratio = 0
    return ratio


fp = open(sys.argv[1], 'r')
lines = fp.readlines()
dict_out = table2dict(lines)
#####This is for chrome picture#####
chrome_list = dict_out['Chr']
chrome_dict = kongdeju.list2dict(chrome_list)
####This is for genomic Ti/Tv#######
refs = dict_out['Ref']
vars = dict_out['Alt']
exotic_type = dict_out['Func.refGene']
genome_type_list = []
exotic_type_list = []
for ref, var, exo in zip(refs, vars, exotic_type):
    type = ref + var
    if not '-' in type:
        genome_type_list.append(type)
        if exo == 'exonic':
            exotic_type_list.append(type)

genome_ti_tv = round(Ti_Tv(genome_type_list), 2)
exotic_ti_tv = round(Ti_Tv(exotic_type_list), 2)
예제 #4
0
        else:
            if line:
                new_genes.append(line)
    return new_genes


fp = open(sys.argv[1], 'r')
sample_no = sys.argv[2]
lines = fp.readlines()
dict_out = table2dict(lines)
genes = dict_out['Gene.refGene']
genes = real_gene(genes)
exo_type = dict_out['Func.refGene']
###sample_vairant_num######
genome_variant_num = len(exo_type)
exo_dict = kongdeju.list2dict(exo_type)
try:
    exo_variant_num = exo_dict['exonic']
except:
    exo_variant_num = 0
genes_num = len((set(genes)))
genes = list(set(genes))
#############get from mysql###################
conn = MySQLdb.connect(host='rdsikqm8sr3rugdu1muh3.mysql.rds.aliyuncs.com',
                       user='******',
                       passwd='btlc123',
                       db='clinic')
cursor = conn.cursor()
try:
    pathway_dict = gene2pathway.gene2pathway(genes)
    paths = []
예제 #5
0
				new_genes.append(gene)
		else:
			if line:
				new_genes.append(line)
	return new_genes

fp = open(sys.argv[1],'r')
sample_no = sys.argv[2]
lines = fp.readlines()
dict_out = table2dict(lines)
genes = dict_out['Gene.refGene']
genes = real_gene(genes)
exo_type = dict_out['Func.refGene']
###sample_vairant_num######
genome_variant_num = len(exo_type)
exo_dict = kongdeju.list2dict(exo_type)
try:
	exo_variant_num = exo_dict['exonic']
except:
	exo_variant_num = 0
genes_num = len((set(genes)))
genes=list(set(genes))
#############get from mysql###################
conn = MySQLdb.connect(host='rdsikqm8sr3rugdu1muh3.mysql.rds.aliyuncs.com',user='******',passwd='btlc123',db='clinic')
cursor = conn.cursor()
try:
	pathway_dict = gene2pathway.gene2pathway(genes)
	paths=[]
	for a,aitems in pathway_dict.items():
		for b ,bitems in aitems.items():
			paths.extend(bitems.keys())