Commit 0d4d343d authored by Hanna  JULIENNE's avatar Hanna JULIENNE

fixed plink R2 filter

parent 57d09a93
......@@ -34,8 +34,16 @@ def launch_plink_ld(startpos, endpos, chr, reffile, folder):
fo = "{0}/chr{1}_{2}_{3}".format(folder, chr, startpos, endpos)
cmd = "plink --bfile {0} --r --ld-snp-list ./snp_list.txt --ld-window 50 --ld-window-kb 3000 --ld-window-r2 0.4 --chr {1} --out {2}".format(reffile, chr, fo)
sub.check_output(cmd, shell=True)
cmd = "plink --bfile {0} --r --ld-snp-list ./snp_list.txt --ld-window 50 --ld-window-kb 3000 --chr {1} --out {2}".format(reffile, chr, fo)
print(cmd)
try:
sub.check_output(cmd, stderr=sub.STDOUT, shell=True)
except sub.CalledProcessError as e:
print(e.output)
ld_results = pd.read_csv('{0}.ld'.format(fo), delim_whitespace=True)
ld_results.loc[ld_results.R**2 > 0.4].to_csv('{0}.ld'.format(fo), index=False, sep="\t")
def generate_sparse_matrix(plink_ld, ref_chr_df):
......
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