16
16
from matplotlib import pyplot as plt
17
17
from matplotlib .pyplot import figure
18
18
import numpy as np
19
- import os
19
+ import os
20
20
from utils .argmanager import *
21
21
22
22
def geo_mean_overflow (iterable ,axis = 0 ):
@@ -30,22 +30,22 @@ def main():
30
30
output_prefix = args .out_prefix
31
31
genes = args .genes
32
32
variant_table_list = args .score_list
33
-
33
+
34
34
score_dict = {}
35
35
for i in range (len (variant_table_list )):
36
36
var_score = variant_table_list [i ]
37
37
assert os .path .isfile (variant_score_path + var_score )
38
38
var_score = pd .read_table (variant_score_path + var_score )
39
- score_dict [i ] = var_score
40
-
41
- snp_scores = score_dict [0 ][["chr" , "pos" , "allele1" , "allele2" ,"rsid" ]].copy ()
39
+ score_dict [i ] = var_score
40
+
41
+ snp_scores = score_dict [0 ][["chr" , "pos" , "allele1" , "allele2" , "rsid" ]].copy ()
42
42
43
43
44
44
for score in ["logfc" ]:
45
45
if score in score_dict [0 ]:
46
46
snp_scores .loc [:, (score + '.mean' )] = np .mean (np .array ([score_dict [fold ][score ].tolist ()
47
47
for fold in score_dict ]), axis = 0 )
48
- for score in ["abs_logfc" , "jsd" , "abs_logfc_x_jsd" , "abs_logfc_x_jsd_x_max_percentile" ]:
48
+ for score in ["abs_logfc" , "jsd" , "abs_logfc_x_jsd" , "abs_logfc_x_max_percentile" , "jsd_x_max_percentile" , " abs_logfc_x_jsd_x_max_percentile" ]:
49
49
if score in score_dict [0 ]:
50
50
snp_scores .loc [:, (score + '.mean' )] = np .mean (np .array ([score_dict [fold ][score ].tolist ()
51
51
for fold in score_dict ]), axis = 0 )
@@ -113,8 +113,8 @@ def main():
113
113
snp_scores = snp_scores .merge (closest_gene_df ,on = 'rsid' , how = 'inner' )
114
114
out_file = output_prefix + ".average_across_folds.variant_scores.tsv"
115
115
snp_scores .to_csv (out_file ,\
116
- sep = "\t " ,\
117
- index = False )
116
+ sep = "\t " ,\
117
+ index = False )
118
118
119
119
print ("DONE" )
120
120
0 commit comments