Commit 053cf9a3 authored by Hanna  JULIENNE's avatar Hanna JULIENNE

add filtering of badly imputed SNPs

parent 46dc0800
......@@ -7,8 +7,10 @@
ld_matrix
stat_models
windows
filter_format_output
"""
import raiss.ld_matrix as LD
import raiss.stat_models as model
import raiss.windows
import raiss.filter_format_output
from raiss.imputation_launcher import ImputationLauncher
"""
Module to filter SNPs on imputation quality
and format output for JASS
"""
def filter_output(zscores, fout, R2_threshold = 0.8):
"""
procedure that format output for JASS
Args:
zscores (pandas dataframe): imputed zscore
(as outputed from imputation_launcher.chromosome_imputation)
fout (filename): filename where to save the formatted and filtered output
R2_threshold (float): R square threshold bellow which SNPs are filtered from the output
"""
zscores.reset_index(inplace = True)
chr_fo = zscores[['index', 'pos', 'A0', 'A1', 'Z', 'Var', "ld_score"]]
chr_fo.columns = ['snp_ids', 'position', 'Ref_allele', 'Alt_allele','z_score', 'Var', "ld_score"]
chr_fo.loc[chr_fo.Var < (1-R2_threshold)].to_csv(fout, sep="\t", index=False)
......@@ -68,7 +68,6 @@ class ImputationLauncher(object):
zscore_results = realigned_zfiles_on_panel(ref_panel, zscore_results)
return zscore_results
def genome_imputation(self, gwas_tag, ref_panel_folder, ld_folder, zscore_folder, folder_output):
"""
Launch imputation on all chromosome for one trait by calling
......
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