Skip to content

Commit 0b44173

Browse files
committed
update for pip
1 parent 00ee962 commit 0b44173

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

grim/conf/minimal-configuration.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"gamma": 1e-7,
1212
"delta": 0.4999999
1313
},
14+
"UNK_priors": "SR",
1415
"FULL_LOCI": "ABCQR",
1516
"loci_map": {
1617
"A": 1,
@@ -19,6 +20,7 @@
1920
"DQB1": 4,
2021
"DRB1": 5
2122
},
23+
2224
"factor_missing_data": 0.0001,
2325
"Plan_B_Matrix": [
2426
[[1, 2, 3, 4, 5]],

grim/imputation/imputegl/impute.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def __init__(self, net=None,config=None, count_by_prob=None, verbose=False):
110110
self.populations = config["pops"]
111111
self.netGraph = net
112112
self.priorMatrix = np.ones((len(self.populations), len(self.populations)))
113+
self.unk_priors = config["UNK_priors"]
113114

114115
# For plan b
115116
#self.full_loci = config["full_loci"]
@@ -1419,7 +1420,11 @@ def call_comp_phase_prob(self, epsilon, n, phases, chr, MUUG_output, planb):
14191420
# no plan b
14201421
for level in range(2):
14211422
if level == 1:
1422-
self.priorMatrix = np.ones((len(self.populations), len(self.populations))) ####
1423+
if self.unk_priors == "MR":
1424+
self.priorMatrix = np.ones((len(self.populations), len(self.populations)))
1425+
else:
1426+
self.priorMatrix = np.identity(len(self.populations))
1427+
#self.priorMatrix = np.ones((len(self.populations), len(self.populations))) ####
14231428
if planb and len(res['Haps']) == 0:
14241429
self.plan = 'b'
14251430
epsilon = 1e-14
@@ -1615,7 +1620,10 @@ def update_prob_by_priority(self, res, race1, race2, priority):
16151620

16161621
def impute_one(self, subject_id, gl, binary, race1, race2, priority, epsilon, n, MUUG_output, haps_output, planb, em):#em
16171622
clean_gl = clean_up_gl(gl)
1618-
self.priorMatrix = np.ones((len(self.populations), len(self.populations)))
1623+
if self.unk_priors == "MR":
1624+
self.priorMatrix = np.ones((len(self.populations), len(self.populations)))
1625+
else:
1626+
self.priorMatrix = np.identity(len(self.populations))
16191627
to_calc_prior_matrix = False
16201628
if race1 or race2:
16211629
race1 = race1.split(';')

grim/validation/runfile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def run_impute(conf_file = "../conf/minimal-configuration.json", project_dir_gra
6767
"max_haplotypes_number_in_phase": json_conf.get("max_haplotypes_number_in_phase",100 ),
6868
"bin_imputation_input_file": project_dir_in_file + json_conf.get("bin_imputation_in_file", "None"),
6969
"nodes_for_plan_A": json_conf.get("Plan_A_Matrix", []),
70-
"save_mode": json_conf.get("save_space_mode", False)
70+
"save_mode": json_conf.get("save_space_mode", False),
71+
"UNK_priors" : json_conf.get("UNK_priors", "MR")
7172

7273
}
7374

@@ -76,6 +77,7 @@ def run_impute(conf_file = "../conf/minimal-configuration.json", project_dir_gra
7677
print("Performing imputation based on:")
7778
print("\tPopulation: {}".format(config["pops"]))
7879
print("\tPriority: {}".format(config["priority"]))
80+
print("\tPriority: {}".format(config["UNK_priors"]))
7981
print("\tEpsilon: {}".format(config["epsilon"]))
8082
print("\tPlan B: {}".format(config["planb"]))
8183
print("\tNumber of Results: {}".format(config["number_of_results"]))

0 commit comments

Comments
 (0)