77
88sys .path .insert (0 , os .path .join (".." ))
99
10- from imputation .imputegl import Imputation
11- from imputation .imputegl .networkx_graph import Graph
10+ from .. imputation .imputegl import Imputation
11+ from .. imputation .imputegl .networkx_graph import Graph
1212
1313# Profiler start
1414#pr = cProfile.Profile()
1515#pr.enable()
1616
17- def run_impute (conf_file = "../conf/minimal-configuration.json" ):
17+ def run_impute (conf_file = "../conf/minimal-configuration.json" , project_dir_graph = "" , project_dir_in_file = "" ):
1818
1919 configuration_file = conf_file
2020
21- project_dir = "" # "../"
22- output_dir = "output/"
21+ #project_dir = ""# "../"
22+ #output_dir = "output/"
23+
2324
2425 # Read configuration file and load properties
2526 with open (configuration_file ) as f :
2627 json_conf = json .load (f )
2728
29+ graph_files_path = json_conf .get ("graph_files_path" )
30+ if graph_files_path [- 1 ] != '/' :
31+ graph_files_path += '/'
32+ output_dir = json_conf .get ("imuptation_out_path" , "output" )
33+ if output_dir [- 1 ] != '/' :
34+ output_dir += '/'
2835 config = {
2936 "planb" : json_conf .get ('planb' , True ),
3037 "pops" : json_conf .get ('populations' ),
@@ -34,10 +41,10 @@ def run_impute(conf_file = "../conf/minimal-configuration.json"):
3441 "number_of_pop_results" : json_conf .get ('number_of_pop_results' , 100 ),
3542 "output_MUUG" : json_conf .get ("output_MUUG" , True ),
3643 "output_haplotypes" : json_conf .get ("output_haplotypes" , False ),
37- "node_file" : project_dir + json_conf .get ("node_csv_file" ),
38- "top_links_file" : project_dir + json_conf .get ("top_links_csv_file" ),
39- "edges_file" : project_dir + json_conf .get ("edges_csv_file" ),
40- "imputation_input_file" : project_dir + json_conf .get ("imputation_in_file" ),
44+ "node_file" : project_dir_graph + graph_files_path + json_conf .get ("node_csv_file" ),
45+ "top_links_file" : project_dir_graph + graph_files_path + json_conf .get ("top_links_csv_file" ),
46+ "edges_file" : project_dir_graph + graph_files_path + json_conf .get ("edges_csv_file" ),
47+ "imputation_input_file" : project_dir_in_file + json_conf .get ("imputation_in_file" ),
4148 "imputation_out_umug_freq_file" : output_dir + json_conf .get ("imputation_out_umug_freq_filename" ),
4249 "imputation_out_umug_pops_file" : output_dir + json_conf .get ("imputation_out_umug_pops_filename" ),
4350 "imputation_out_hap_freq_file" : output_dir + json_conf .get ("imputation_out_hap_freq_filename" ),
@@ -54,11 +61,11 @@ def run_impute(conf_file = "../conf/minimal-configuration.json"):
5461 [[1 ], [2 , 3 ], [4 ], [5 ]],
5562 [[1 ], [2 ], [3 ], [4 ], [5 ]]
5663 ]),
57- "pops_count_file" : project_dir + json_conf .get ("pops_count_file" ,'' ),
64+ "pops_count_file" : project_dir_graph + json_conf .get ("pops_count_file" ,'' ),
5865 "use_pops_count_file" : json_conf .get ("pops_count_file" ,False ),
5966 "number_of_options_threshold" : json_conf .get ("number_of_options_threshold" , 100000 ),
6067 "max_haplotypes_number_in_phase" : json_conf .get ("max_haplotypes_number_in_phase" ,100 ),
61- "bin_imputation_input_file" : project_dir + json_conf .get ("bin_imputation_in_file" , "None" ),
68+ "bin_imputation_input_file" : project_dir_in_file + json_conf .get ("bin_imputation_in_file" , "None" ),
6269 "nodes_for_plan_A" : json_conf .get ("Plan_A_Matrix" , []),
6370 "save_mode" : json_conf .get ("save_space_mode" , False )
6471
0 commit comments