Example #1
0
def make_ref_dict(yank_loc):
    ref_dict = dict()
    with open(yank_loc, mode="r") as yank:
        line1 = True
        
        for line in yank:
            line_list = line.strip().split()
            if line1:
                yank_indices = pc_toolbox.read_yank_titles(line)
                line1 = False
            else:
                ref_dict[line_list[yank_indices["id"]]] = (line_list[yank_indices["lz"]],line_list[yank_indices["im"]])
    return ref_dict
Example #2
0
def get_snp_list(meta_yank_loc):
    line1 = True
    snp_list = list()
    counter = 0
    with open(meta_yank_loc, mode = "r") as meta:
        for line in meta:
            if line1:
                yank_indices = pc_toolbox.read_yank_titles(line)
                line1 = False
            else:
                line_list = line.strip().split()
                snp_list.append(line_list[yank_indices['lz']])
                counter = counter + 1
    print("I find {0} SNPs in the meta_yank list.".format(counter))
    return snp_list
def read_yank(yank_loc):
    line1 = True
    with open(yank_loc, mode="r") as yank:
        yank_lines = list()
        for line in yank:
            if line1:
                index_dict = pc_toolbox.read_yank_titles(line)
                line1 = False
            else:
                lsplit = line.strip().split()
                if not lsplit == []:
                    yank_info = YankInfo(start=lsplit[index_dict['start']],
                                         end=lsplit[index_dict['end']],
                                         chro=lsplit[index_dict['chr']],
                                         lz=lsplit[index_dict['lz']],
                                         ID=lsplit[index_dict['id']],
                                         pos=lsplit[index_dict['pos']],
                                         p=lsplit[index_dict['p']])
                    yank_lines.append(yank_info)
    return yank_lines