def store_line(line, table_indices, assoc, annot_dict): ## print('Now storing info.') if assoc: line_info = pc_toolbox.assoc_tuple(line, table_indices) else: line_info = meta_toolbox.meta_tuple(line, table_indices,annot_dict) return line_info
def filter_result(result_file, snpstar): line1 = True with open(result_file, mode="r") as result: for line in result: if line1: index_dict = pc_toolbox.read_assoc_titles(line, .95, 'logistic') line1 = False else: lsplit = line.strip().split() if lsplit[index_dict['snp']] == snpstar: #print('$$$ '+ line.strip()) info_tuple = pc_toolbox.assoc_tuple(line, index_dict) #print info_tuple return info_tuple
def read_assoc(assoc_loc, SNP_loc,c_interval,plink_test, exp): global p_bound, index_dict, firstloop tuple_list = [] with open(assoc_loc, mode = 'r') as assoc_file: line1_check = True for assoc_line in assoc_file: #open the assoc file to be read ## assoc_list = assoc_line.split() if line1_check: if firstloop: index_dict = pc_toolbox.read_assoc_titles(assoc_line, c_interval, plink_test) ## index_dict = identify_cols(assoc_list, c_interval, plink_test) firstloop = False if loopcount == 0: if os.path.exists(SNP_loc): clear = open(SNP_loc, mode='w') clear.close() line1_check = False else: tuplet = pc_toolbox.assoc_tuple(assoc_line, index_dict) ## tuplet = get_tuple(assoc_list, index_dict) if is_number(tuplet.p) and tuplet.p < float(p_bound)* math.pow(10,exp): tuple_list.append(tuplet) return tuple_list