Commit 45937810 authored by hjulienn's avatar hjulienn
Browse files

re insert filter when saving results

parent 84289edf
......@@ -39,7 +39,7 @@ def add_chromosome_imputation_argument():
parser.add_argument('--R2-threshold', help= "R square (imputation quality) threshold bellow which SNPs are filtered from the output", default = 0.6)
parser.add_argument("--ld-type", help= "Ld can be supplied as plink command --ld-snp-list output files (see raiss.ld_matrix.launch_plink_ld to compute these data using plink) or as a couple of a scipy sparse matrix (.npz )and an .csv containing SNPs index", default="plink")
parser.add_argument('--ref-panel-suffix', help= "end of the suffix for the reference panel files", default = ".bim")
parser.add_argument('--minimum-ld', help = "this parameter ensure that their is enough typed SNPs around the imputed to perform a high accuracy imputation", default = 5)
parser.add_argument('--minimum-ld', help = "this parameter ensure that their is enough typed SNPs around the imputed to perform a high accuracy imputation", default = 4)
parser.set_defaults(func=launch_chromosome_imputation)
return(parser)
......
......@@ -20,5 +20,6 @@ def filter_output(zscores, fout, R2_threshold = 0.6, minimum_ld = 5):
chr_fo = zscores[['index', '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"]
#loc[(chr_fo.Var < (1-R2_threshold)) & (chr_fo.ld_score > minimum_ld)]
chr_fo.to_csv(fout, sep="\t", index=False)
print(chr_fo.shape)
print(chr_fo.loc[(chr_fo.imputation_R2 > R2_threshold) & (chr_fo.ld_score > float(minimum_ld))].shape)
chr_fo.loc[(chr_fo.imputation_R2 > R2_threshold) & (chr_fo.ld_score > float(minimum_ld))].to_csv(fout, sep="\t", index=False)
......@@ -10,7 +10,7 @@ from raiss.imputation_launcher import ImputationLauncher
def save_chromosome_imputation(gwas, chrom, window_size, buffer_size,
l2_regularization, eigen_threshold, zscore_folder,
ref_folder, ld_folder, output_folder, R2_threshold,
tag="", ref_panel_suffix=".eur.1pct.bim", ld_type="plink", minimum_ld=20):
tag="", ref_panel_suffix=".eur.1pct.bim", ld_type="plink", minimum_ld=4):
"""
module to manage the creation of files to save the results of imputation
Args:
......
Supports Markdown
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