Commit b3826dc8 authored by Hanna  JULIENNE's avatar Hanna JULIENNE

Add a ld_score to ensure that imputed SNPs have been imputed from enough typed SNPs

parent 24b766b9
Pipeline #44654 passed with stages
in 1 minute and 10 seconds
......@@ -88,7 +88,6 @@ Output
======
The raiss package outputs imputed GWAS files in the tabular format:
..TODO suppress complementary columns
+-------------+----------+------------+------------+---------+-------+----------+
| snp_ids | position | Ref_allele | Alt_allele | z_score | Var | ld_score |
......
......@@ -4,7 +4,7 @@
"""
def filter_output(zscores, fout, R2_threshold = 0.6):
def filter_output(zscores, fout, R2_threshold = 0.6, minimum_ld = 20):
"""
procedure that format output for JASS
......@@ -18,6 +18,7 @@ def filter_output(zscores, fout, R2_threshold = 0.6):
zscores.reset_index(inplace = True)
chr_fo = zscores[['index', 'pos', 'A0', 'A1', 'Z', 'Var', "ld_score"]]
chr_fo.columns = ['rsID','pos','A0','A1','Z', 'Var', "ld_score"]
chr_fo["imputation_R2"] = 1-chr_fo["Var"]
chr_fo.columns = ['rsID','pos','A0','A1','Z', 'Var', "ld_score", "imputation_R2"]
chr_fo.loc[chr_fo.Var < (1-R2_threshold)].to_csv(fout, sep="\t", index=False)
chr_fo.loc[(chr_fo.Var < (1-R2_threshold)) & (chr_fo.ld_score > minimum_ld)].to_csv(fout, sep="\t", index=False)
......@@ -41,6 +41,7 @@ def save_chromosome_imputation(gwas, chrom, window_size, buffer_size,
# Formatting and filtering
# and Saving results
minimum_ld = 20
z_fo = "{0}/z_{1}_{2}{3}.txt".format(output_folder, gwas, chrom, tag)
filter_output(imputed_zscore, z_fo, float(R2_threshold))
print("Save imputation done at {0}".format(z_fo))
......@@ -53,8 +53,7 @@ def compute_var(sig_i_t, sig_t_inv, lamb, batch=True):
return var, ld_score
def check_inversion(sig_t, sig_t_inv):
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):
......
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