Commit 10fc46e5 authored by hjulienne's avatar hjulienne

add index intesection

parent 596c3425
Pipeline #43949 failed with stage
in 1 minute
......@@ -4,7 +4,7 @@
"""
def filter_output(zscores, fout, R2_threshold = 0.8):
def filter_output(zscores, fout, R2_threshold = 0.6):
"""
procedure that format output for JASS
......
......@@ -53,7 +53,9 @@ def compute_var(sig_i_t, sig_t_inv, lamb, batch=True):
return var, ld_score
def check_inversion(sig_t, sig_t_inv):
return np.allclose(sig_t, np.dot(sig_t, np.dot(sig_t_inv, sig_t)))
print(sig_t)
print(sig_t_inv)
return np.allclose(sig_t, np.dot(sig_t, np.dot(sig_t_inv, sig_t)))
def var_in_boundaries(var,lamb):
"""
......
......@@ -32,7 +32,9 @@ def realigned_zfiles_on_panel(ref_panel, zscore):
- ref_panel (pd.dataframe) : snp of reference on the imputed chromosome
- zscore (pd.dataframe):
"""
sub_ref_panel = ref_panel.loc[zscore.index]
inter_id = zscore.index.intersection(ref_panel.index)
zscore = zscore.loc[inter_id]
sub_ref_panel = ref_panel.loc[inter_id]
allele_inverted = (sub_ref_panel['Ref_all'] != zscore.A0)
zscore.loc[allele_inverted, "A0"] = sub_ref_panel.loc[allele_inverted].Ref_all
......@@ -53,11 +55,12 @@ def prepare_zscore_for_imputation(ref_panel, zscore):
known snp (give an idea if the we have enough information to compute a
precise z estimate)
"""
zscore = realigned_zfiles_on_panel(ref_panel, zscore)
zscore['Var'] = -1.0
zscore['Nsnp_to_impute'] = -1
zscore['ld_score'] = -1.0
zscore = zscore.loc[zscore.index.intersection(ref_panel.index)]
#zscore = zscore.loc[zscore.index.intersection(ref_panel.index)]
return zscore
def in_region(pos_vector, start, end):
......
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