Commit b11049c0 authored by Hanna  JULIENNE's avatar Hanna JULIENNE

fix typo + concatenation of results

parent 8c2374aa
......@@ -103,11 +103,11 @@ def compute_window_and_size(start_ld_block, end_ld_block, window_size):
else:
Nwindows = 1
window_resize = np.ceil(int(end_ld_block) - (int(start_ld_block)))
return Nwindows, window_resize
def format_result_df(imp, ref_panel, known, unknowns):
result_dict = {
'pos': ref_panel.loc[unknowns, 'pos'],
'A0': ref_panel.loc[unknowns, "Ref_all"],
......@@ -119,7 +119,7 @@ def format_result_df(imp, ref_panel, known, unknowns):
"correct_inversion":imp["correct_inversion"],
"Nsnp_to_impute" : len(known)
}
column_order = ['pos','A0',"A1","Z","Var", "ld_score", "condition_number", "correct_inversion", "Nsnp_to_impute"]
column_order = ['pos','A0',"A1","Z","Var", "ld_score", "condition_number", "correct_inversion", "Nsnp_to_impute"]
batch_df = pd.DataFrame(result_dict, columns = column_order)
return batch_df
......@@ -171,14 +171,14 @@ def impg_like_imputation(ld_file, ref_panel, zscore, window_size, buffer, lamb,
if(len(known) > 0):
imp = impg_model(zt, sig_t, sig_i_t, lamb=lamb, rcond=rcond, batch=True)
batch_df = format_result_df(imp, ref_panel, known, unknowns):
batch_df = format_result_df(imp, ref_panel, known, unknowns)
# keep only snp in the core window (and not in the buffer)
start_core_window = int(start_ld_block) + i*window_resize
end_core_window = int(start_ld_block) + (i+1)*window_resize
in_core_window = in_region(batch_df.pos, start_core_window, end_core_window)
zscore_results = pd.concat([zscore_results, batch_df.loc[in_core_window]])
zscore_results = pd.concat([zscore_results, batch_df.loc[in_core_window, zscore_results.columns]])
i = i+1
print_progression(i, Nwindows)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment