imputation_launcher.py 924 Bytes
Newer Older
Hanna  JULIENNE's avatar
Hanna JULIENNE committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Function set to launch imputation on a complete chromosome or
on the genome
"""
import glob
from .windows import Ld_region_centered_window_imputation

class imputation_launcher:

    def __init__(self, window_size=10000):
        self.imputation_style = "online"
        self.window_size = window_size

    def chromosome_imputation(self, chrom, Zscores, ref_panel, ld_folder):
        """

        """

        ref_panel_file = "/mnt/atlas/PCMA/1._DATA/ImpG_refpanel/{0}.eur.1pct.bim".format(chrom)
        #ref_panel = pd.read_csv(ref_panel_file, sep="\t", names=['chr', "nothing", 'pos', 'Ref_all', 'alt_all'], index_col = 1)

        pattern = "{0}/{1}*.ld".format(ld_folder, chrom)
        for LD_file in glob.glob(pattern):
            print("processing Region: {0}".format(LD_file))

            Zscores = Ld_region_centered_window_imputation(LD_file, ref_panel, Zscores, self.window_size)
        return Zscores