Commit 098c9076 authored by Hanna  JULIENNE's avatar Hanna JULIENNE

filter R2

parent 2f740525
import argparse
import pandas as pd
from raiss.filter_format_output import filter_output
from raiss.imputation_launcher import ImputationLauncher
......@@ -15,7 +16,7 @@ def launch_chromosome_imputation(args):
print("Imputation of {0} gwas for chromosome {1}".format(args.gwas, args.chrom))
# Imputer settings
imputer = ImputationLauncher( window_size=int(args.window_size), buf=int(args.buffer_size),
lamb= float(args.l2_regularization), pinv_rcond = float(args.eigen_treshold))
lamb= float(args.l2_regularization), pinv_rcond = float(args.eigen_threshold))
# Reading of inputs
z_file = "{0}/z_{1}_{2}.txt".format(args.zscore_folder, args.gwas, args.chrom)
......@@ -27,9 +28,10 @@ def launch_chromosome_imputation(args):
imputed_zscore = imputer.chromosome_imputation(args.chrom, zscore, ref_panel, args.ld_folder)
print("Imputation DONE")
# Saving results
#Formatting and filtering
# and Saving results
z_fo = "{0}/z_{1}_{2}.txt".format(args.output_folder, args.gwas, args.chrom)
imputed_zscore.to_csv(z_fo, sep='\t')
filter_output(imputed_zscore, z_fo, args.R2_threshold)
print("Save imputation done at {0}".format(z_fo))
def add_chromosome_imputation_argument():
......@@ -46,7 +48,10 @@ def add_chromosome_imputation_argument():
parser.add_argument('--window-size', help= "Size of the non overlapping window", default = 500000)
parser.add_argument('--buffer-size', help= "Size of the buffer around the imputation window", default = 125000)
parser.add_argument('--l2-regularization', help= "Size of the buffer around the imputation window", default = 0.1)
parser.add_argument('--eigen-treshold', help= "treshold under which eigen vectors are removed for the computation of the pseudo inverse", default = 0.1)
parser.add_argument('--eigen-threshold', help= "threshold under which eigen vectors are removed for the computation of the pseudo inverse", default = 0.1)
parser.add_argument('--R2-threshold', help= "R square (imputation quality) threshold bellow which SNPs are filtered from the output", default = 0.8)
parser.set_defaults(func=launch_chromosome_imputation)
return(parser)
......
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