Skip to content

Commit

Permalink
Fix linter issues (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbashyal-nmdp authored Jan 8, 2025
1 parent db3ce14 commit 75bc2b9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
8 changes: 4 additions & 4 deletions grim/grim.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ def graph_freqs(conf_file="", for_em=False, em_pop=None):
)


def impute(conf_file="", hap_pop_pair = False, graph = None):

def impute(conf_file="", hap_pop_pair=False, graph=None):
project_dir_in_file, project_dir_graph = "", ""
if conf_file == "":

conf_file = (
os.path.dirname(os.path.realpath(__file__)).replace("/grim", "")
+ "/conf/minimal-configuration.json"
Expand All @@ -70,7 +68,9 @@ def impute(conf_file="", hap_pop_pair = False, graph = None):
project_dir_in_file = (
os.path.dirname(os.path.realpath(__file__)).replace("/grim", "") + "/"
)
graph = run_impute(conf_file, project_dir_graph, project_dir_in_file, hap_pop_pair, graph)
graph = run_impute(
conf_file, project_dir_graph, project_dir_in_file, hap_pop_pair, graph
)
return graph


Expand Down
31 changes: 21 additions & 10 deletions grim/run_impute_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ def run_impute(
conf_file="../conf/minimal-configuration.json",
project_dir_graph="",
project_dir_in_file="",
hap_pop_pair = False,
graph = None
hap_pop_pair=False,
graph=None,
):

configuration_file = conf_file

# project_dir = ""# "../"
Expand Down Expand Up @@ -81,12 +80,24 @@ def run_impute(
+ json_conf.get("edges_csv_file"),
"imputation_input_file": project_dir_in_file
+ json_conf.get("imputation_in_file"),
"imputation_out_umug_freq_file": full_path(output_dir, json_conf.get("imputation_out_umug_freq_filename")),
"imputation_out_umug_pops_file": full_path(output_dir, json_conf.get("imputation_out_umug_pops_filename")),
"imputation_out_hap_freq_file": full_path(output_dir, json_conf.get("imputation_out_hap_freq_filename")),
"imputation_out_hap_pops_file": full_path(output_dir, json_conf.get("imputation_out_hap_pops_filename")),
"imputation_out_miss_file": full_path(output_dir, json_conf.get("imputation_out_miss_filename")),
"imputation_out_problem_file": full_path(output_dir, json_conf.get("imputation_out_problem_filename")),
"imputation_out_umug_freq_file": full_path(
output_dir, json_conf.get("imputation_out_umug_freq_filename")
),
"imputation_out_umug_pops_file": full_path(
output_dir, json_conf.get("imputation_out_umug_pops_filename")
),
"imputation_out_hap_freq_file": full_path(
output_dir, json_conf.get("imputation_out_hap_freq_filename")
),
"imputation_out_hap_pops_file": full_path(
output_dir, json_conf.get("imputation_out_hap_pops_filename")
),
"imputation_out_miss_file": full_path(
output_dir, json_conf.get("imputation_out_miss_filename")
),
"imputation_out_problem_file": full_path(
output_dir, json_conf.get("imputation_out_problem_filename")
),
"factor_missing_data": json_conf.get("factor_missing_data", 0.01),
"loci_map": json_conf.get(
"loci_map", {"A": 1, "B": 3, "C": 2, "DQB1": 4, "DRB1": 5}
Expand Down Expand Up @@ -180,7 +191,7 @@ def run_impute(

config["full_loci"] = "".join(sorted(all_loci_set))
# Perform imputation
if graph==None:
if graph == None:
graph = Graph(config)
graph.build_graph(
config["node_file"], config["top_links_file"], config["edges_file"]
Expand Down

0 comments on commit 75bc2b9

Please sign in to comment.