def onpicture(): #filenameImage='F:/Aotu3DImage/'+str(time.strftime("%Y-%m-%d_%H.%M.%S"))+'.png' #filenameIma='F:/Aotu3DImage/'+str(time.strftime("%Y-%m-%d_%H.%M.%S"))+'.png' width = G.windowWidth height = G.windowHeight width = width - 3 height = height - 3 #log.message(filenameImage) #mh.grabScreen(0,0,width,height,filenameImage) img = grabMyScreen(0, 0, width, height) #log.message(str(imgs)) #img=cv2.imread(filenameImage) height, width = img.shape[:2] #print height,width for i in range(height): for j in range(width): r, b, g = img[i][j] rb = abs(r - b) rg = abs(r - g) bg = abs(b - g) if rb < 10 and rg < 10 and bg < 10: img[i][j] = [0, 0, 0] else: img[i][j] = [255, 255, 255] # cv2.imwrite(filenameIma,img) imsave = normalize.Normalize(img) delt = findcontours.GetDeltValue(imsave, filepicture) return delt
def dayinpicture(): filenameImage='F:/Aotu3DImage/'+str(time.strftime("%Y-%m-%d_%H.%M.%S"))+'.png' filenameIma='F:/Aotu3DImage/'+str(time.strftime("%Y-%m-%d_%H.%M.%S"))+'.png' width = G.windowWidth; height = G.windowHeight; width = width - 3; height = height - 3; #log.message(filenameImage) #mh.grabScreen(0,0,width,height,filenameImage) #img=cv2.imread(filenameImage) img=grabMyScreen(0,0,width,height) height1,width1=img.shape[:2] #print height,width for i in range(height1): for j in range(width1): r,b,g= img[i][j] rb=abs(r-b) rg=abs(r-g) bg=abs(b-g) if rb<10 and rg<10 and bg<10: img[i][j]=[0,0,0] else: img[i][j]=[255,255,255] imsave=normalize.Normalize(img) cv2.imwrite(filenameIma,imsave)
def plotnormalizedplane(self, axis, pos): """ FUNCTION plotsimpleplane Plots a plane defined by axis and pos, where axis is a principal direction INPUT: integer: axis, the direction normal of plane to plot integer: pos, the index of the line/plane intersection """ plane_dim = np.delete(self.f_size, axis) X, Y = np.mgrid[-1:1:complex(0, plane_dim[0]), -1:1:complex(0, plane_dim[1])] if axis == 0: #plt.matshow(self.f_field[pos,:,:], cmap='hot') Z = self.f_field[pos, :, :] if axis == 1: #plt.matshow(self.f_field[:,pos,:], cmap='hot') Z = self.f_field[:, pos, :] if axis == 2: #plt.matshow(self.f_field[:,:,pos], cmap='hot') Z = self.f_field[:, :, pos] pcm = plt.pcolormesh(X, Y, Z, norm=nz.Normalize(midpoint=0.), cmap='RdBu_r') plt.colorbar(pcm, extend='both')
def onClicked(event): width = G.windowWidth; height = G.windowHeight; width = width - 3; height = height - 3; log.message(str(width)) log.message(str(height)) for value in range(5,100,5): chushihua() a5[0]=value-50 bvhanniu() gui3d.app.do(AotuPose1("Change pose", self, self.currentPose, fileout)) #anim = self.loadBvh(fileout, convertFromZUp="auto") filenameImage='F:/Aotu3DImage/'+str(time.strftime("%Y-%m-%d_%H.%M.%S"))+'.png' filenameIma='F:/Aotu3DImage/'+str(time.strftime("%Y-%m-%d_%H.%M.%S"))+'.png' width = G.windowWidth; height = G.windowHeight; width = width - 3; height = height - 3; #log.message(filenameImage) mh.grabScreen(0,0,width,height,filenameImage) img=cv2.imread(filenameImage) height1,width1=img.shape[:2] #print height,width for i in range(height1): for j in range(width1): r,b,g= img[i][j] rb=abs(r-b) rg=abs(r-g) bg=abs(b-g) if rb<10 and rg<10 and bg<10: img[i][j]=[0,0,0] else: img[i][j]=[255,255,255] imsave=normalize.Normalize(img) cv2.imwrite(filenameIma,imsave) cv2.imshow("img",imsave) cv2.waitKey(10) delt5=onpicture() if delt5<=deltvalue5[0]: deltvalue5[0]=delt5 deltva5[0]=value-50 num5=(deltva5[0]+50)/5 result=cv2.imread(fileResult+str(num5)+'.png') cv2.imshow("Result",result) cv2.waitKey(0) log.message(deltvalue5) log.message(num5)
def __init__(self, config, cons): assert config['bit_depth'] >= 1 assert config['pixels_per_cycle'] >= 1 self.bd = config['bit_depth'] self.ps = config['pixels_per_cycle'] self.axi_lite = config['support_axi_lite'] enc_out_bits = min(31, 16 + self.bd) * self.ps #pixels in self.pixels_in = Array( Signal(self.bd, name="pixel_in") for _ in range(self.ps)) #enc out self.enc_out = Signal(enc_out_bits) self.enc_out_ctr = Signal(max=enc_out_bits + 1) # valid in & out self.valid_in = Signal(1) self.valid_out = Signal(1) # end self.end_out = Signal(1) self.fend_out = Signal(1) if self.ps == 4: self.predictor = predictor_p1_c4_px4.PredictorP1C4Px4(config, cons) else: self.predictor = predictor_p1_c4_pix1_2.PredictorP1C4Pix12( config, cons) self.difference = difference.Difference(config, cons) self.normalize = normalize.Normalize(config, cons) self.encode = encode.Encode(config, cons) #create a merge layer only if more than one pixel per cycle if self.ps > 1: self.merge = merge.Merge(config, cons) self.signals = signals.Signals(config, cons) if self.axi_lite: self.core_axi_lite = core_axi_lite.CoreAxiLite(config, cons) else: self.register_file = register_file.RegisterFile() self.force_end = force_end.ForceEnd(config, cons) self.ios = \ [pixel_in for pixel_in in self.pixels_in] + \ [self.enc_out, self.enc_out_ctr] + \ [self.valid_in, self.valid_out] + \ [self.end_out, self.fend_out]
def onClicked(event): log.message('start...') for slider in self.sliders: for valuenum in range(0, 105, 5): valuenums = valuenum / 100.000000 slider.update() #log.message(slider.modifier.getValue()) #if slider.enabledCondition: #log.message(slider) slider.modifier.setValue(valuenums) #log.message(slider.modifier.getValue()) sli = modifierslider.ModifierSlider(slider.modifier) value = slider.modifier.getValue() valuesli = sli.getValue() #sli.onChanging(slider.modifier.getValue()) action = humanmodifier.ModifierAction( slider.modifier, value, valuesli, sli.update) log.message(str(valuesli)) log.message(str(value)) if valuesli != value: G.app.do(action) else: action.do() filenameImage = 'F:/Aotu3DImage/' + str( time.strftime("%Y-%m-%d_%H.%M.%S")) + '.png' filenameIma = 'F:/Aotu3DImage/' + str( time.strftime("%Y-%m-%d_%H.%M.%S")) + '.png' filenameIma1 = 'F:/Aotu3DImage/result' + str( time.strftime("%Y-%m-%d_%H.%M.%S")), '.png' width = G.windowWidth height = G.windowHeight width1 = width - 3 height1 = height - 3 #log.message(filenameImage) mh.grabScreen(0, 0, width, height, filenameImage) img = cv2.imread(filenameImage) height1, width1 = img.shape[:2] #print height,width for i in range(height1): for j in range(width1): r, b, g = img[i][j] rb = abs(r - b) rg = abs(r - g) bg = abs(b - g) if rb < 10 and rg < 10 and bg < 10: img[i][j] = [0, 0, 0] else: img[i][j] = [255, 255, 255] imsave = normalize.Normalize(img) cv2.imwrite(filenameIma, imsave) #cv2.imshow("img",imsave) # cv2.waitKey(10) delt = onpicture() log.message(str(delt)) if delt <= deltvalue[0]: deltvalue[0] = delt deltva[0] = valuenums num = deltva[0] * 20 + 1 result = cv2.imread(fileResult + str(num) + '.png') cv2.imshow("Result", result) cv2.waitKey(0) log.message(deltvalue) log.message(num) slider.modifier.setValue(valuenums) #log.message(slider.modifier.getValue()) sli = modifierslider.ModifierSlider(slider.modifier) value = slider.modifier.getValue() valuesli = sli.getValue() #sli.onChanging(slider.modifier.getValue()) action = humanmodifier.ModifierAction(slider.modifier, value, valuesli, sli.update) G.app.do(action) mh.grabScreen(0, 0, width, height, filenameImage) imgw = cv2.imread(filenameImage) height1, width1 = imgw.shape[:2] #print height,width for i in range(height1): for j in range(width1): r, b, g = imgw[i][j] rb = abs(r - b) rg = abs(r - g) bg = abs(b - g) if rb < 10 and rg < 10 and bg < 10: imgw[i][j] = [0, 0, 0] else: imgw[i][j] = [255, 255, 255] imsavew = normalize.Normalize(imgw) cv2.imwrite(filenameIma1, imsavew)
import gi import utest import normalize import pathway_enrichment #08/22/2018 by Ivan import anova import tnseq_stats methods = {} methods["example"] = example.ExampleAnalysis() methods["gumbel"] = gumbel.GumbelAnalysis() methods["binomial"] = binomial.BinomialAnalysis() methods["griffin"] = griffin.GriffinAnalysis() methods["hmm"] = hmm.HMMAnalysis() methods["resampling"] = resampling.ResamplingAnalysis() methods["tn5gaps"] = tn5gaps.Tn5GapsAnalysis() methods["rankproduct"] = rankproduct.RankProductAnalysis() methods["utest"] = utest.UTestAnalysis() methods["GI"] = gi.GIAnalysis() methods["anova"] = anova.AnovaAnalysis() #methods["mcce"] = mcce.MCCEAnalysis() #methods["mcce2"] = mcce2.MCCE2Analysis() #methods["motifhmm"] = motifhmm.MotifHMMAnalysis() methods["normalize"] = normalize.Normalize() methods["pathway_enrichment"] = pathway_enrichment.GSEAAnalysis() methods["tnseq_stats"] = tnseq_stats.TnseqStats() # EXPORT METHODS import norm export_methods = {} export_methods["norm"] = norm.NormAnalysis()
def onClicked(event): #chushihua() width = G.windowWidth; height = G.windowHeight; width = width - 3; height = height - 3; log.message(str(width)) log.message(str(height)) OrigalIm = cv2.imread(filepicture) #先读目标图像 for value in range(61,71,10): a8[0]=value-50 bvhanniu() gui3d.app.do(AotuPose1("Change pose", self, self.currentPose, fileout)) anim = self.loadBvh(fileout, convertFromZUp="auto") #cv2.waitKey(10) #filenameImage=fileResult+str(time.strftime("%Y-%m-%d_%H.%M.%S"))+'.png' filenameImage=fileResult+str(a8[0])+'DegreeLLeg.png' #filenameIma=fileResult+str(time.strftime("%Y-%m-%d_%H.%M.%S"))+'.png' filenameIma=fileResult+str(a8[0])+'DegreeLLeg.png' width = G.windowWidth; height = G.windowHeight; Xdel=600 #原图为800x600 减除后为200x150 Ydel=450 width = width - Xdel; height = height - Ydel; #log.message(filenameImage) #mh.grabScreen(300,225,width,height,filenameImage) #存盘 mh.grabScreen(Xdel/2,Ydel/2,width,height,filenameImage) #不存盘,全在内在操作,提高速度 log.message("Saved screengrab to %s", filenameImage) img=cv2.imread(filenameImage) #存盘 height1,width1=img.shape[:2] #print height,width for i in range(height1): for j in range(width1): r,b,g= img[i][j] rb=abs(r-b) rg=abs(r-g) bg=abs(b-g) if rb<10 and rg<10 and bg<10: img[i][j]=[0,0,0] else: img[i][j]=[255,255,255] imsave=normalize.Normalize(img) cv2.imwrite(filenameIma,imsave) #cv2.imshow("img",imsave) #cv2.waitKey(10) #delt8=findcontours.GetDeltValue(imsave,OrigalIm) #onpicture() delt8=findcontours.CalDiff(imsave,OrigalIm) log.debug('delt8 (%d Degree): = %f', a8[0], delt8) if delt8<=deltvalue8[0]: deltvalue8[0]=delt8 deltva8[0]=value-50 filenameImaFit=filenameIma bvhanniu(filepicbvh) gui3d.app.do(AotuPose1("Change pose", self, self.currentPose, filepicbvh)) anim = self.loadBvh(filepicbvh, convertFromZUp="auto") imsavefit=imsave gui3d.app.do(AotuPose1("Change pose", self, self.currentPose, filepicbvh)) anim = self.loadBvh(filepicbvh, convertFromZUp="auto") a8[0]= deltva8[0] #需要更新,不然后面姿态重置了 bvhanniu() num1=(deltva8[0]+50)/5 #result=cv2.imread(fileResult+str(num1)+'.png') #result=cv2.imread(filenameImaFit) result =imsavefit result2=cv2.imread(filepicture) cv2.imshow("Result",result) cv2.imshow("Original",result2) #cv2.waitKey(10) log.message(deltvalue8) log.message(num1) imsavefit = None
def pipeline(gse, output='zrb_pipeline_bern_result'): with open(output, "a", encoding='utf-8') as out: # title=['gse','gsm','text','bern_text','cell line','organism','cell type','method','source name','tissue','treatment','disease','bern_zrb_disease','bern_zrb_disease_id','bern_zrb_drug','bern_zrb_drug_id','bern_zrb_gene','bern_zrb_gene_id'] title = [ 'gse', 'gsm', 'text', 'bern_text', 'cell line', 'organism', 'cell type', 'method', 'source name', 'tissue', 'treatment', 'disease', 'library_strategy', 'bern_disease_str', 'bern_disease_id_str', 'normolize_disease_id_name', 'normolize_disease_name', 'bern_drug_str', 'bern_drug_id_str', 'normolize_drug_id_name', 'normolize_drug_name', 'bern_gene_str', 'bern_gene_id_str', 'normolize_gene_id_name', 'normolize_gene_name', 'knock_out/knock_down', 'knock_in', 'knock', 'over_expression', 'cell_line_text_regex', 'cell_line_bern_text_regex', 'gsm_rrid_cell_line', 'gsm_rrid_disease' ] title_line = "\t".join(title) out.write(title_line) out.write('\n') # file_list=[] file_list = [x for x in os.listdir('gse') if x.startswith(gse)] if not file_list: print('+++ no GSE samples') return (None) # print(file_list) for i_file in file_list: file_path = os.path.join(os.path.abspath('.'), 'gse') file_path_need = os.path.join(file_path, i_file) dom = xml.dom.minidom.parse(file_path_need) def move_break(need_list): for i in range(len(need_list)): need_list[i] = re.sub("\n", "", need_list[i]) need_list[i] = re.sub("\s+", " ", need_list[i]) return need_list #单独获取测序方法 Platform = dom.getElementsByTagName("Platform") p_technology_list = [] for i_p in range(Platform.length): try: p_technology = dom.getElementsByTagName( "Platform")[i_p].getElementsByTagName( "Technology")[0].childNodes[0].data p_technology_list.append(p_technology) except: p_technology_list.append("null") p_technology_set = set(p_technology_list) p_technology_list = list(p_technology_set) p_technology_list = move_break(p_technology_list) #print(p_technology_set) #print(p_technology_list) p_technology_all = ",".join(str(x) for x in p_technology_list) #extract sample tags #extract sample tags sample = dom.getElementsByTagName("Sample") #sample_list=[] #sample_data_list=[] sample_char_list = [] #sample_table_list=[] for i_s in range(sample.length): output_list = [] try: s_number = sample[i_s].getAttribute("iid") except: s_number = "null" try: s_title = sample[i_s].getElementsByTagName( "Title")[0].childNodes[0].data except: s_title = sample[i_s] = "null" try: s_channel = sample[i_s].getElementsByTagName( "Channel-Count")[0].childNodes[0].data except: s_channel = "null" try: s_source = sample[i_s].getElementsByTagName( "Source")[0].childNodes[0].data except: s_source = "null" try: s_organism = sample[i_s].getElementsByTagName( "Organism")[0].childNodes[0].data except: s_organism = "null" #会出现换行符 try: s_treatment = sample[i_s].getElementsByTagName( "Treatment-Protocol")[0].childNodes[0].data except: s_treatment = "null" #print(s_title) #会出现换行符 try: s_growth = sample[i_s].getElementsByTagName( "Growth-Protocol")[0].childNodes[0].data except: s_growth = "null" try: s_molecule = sample[i_s].getElementsByTagName( "Molecule")[0].childNodes[0].data except: s_molecule = "null" try: s_extract = sample[i_s].getElementsByTagName( "Extract-Protocol")[0].childNodes[0].data except: s_extract = "null" try: s_label = sample[i_s].getElementsByTagName( "Label")[0].childNodes[0].data except: s_label = "null" #换行符会出现在句字中,用空格代替,再将多个空格替换成一个空格 try: s_data_processing = sample[i_s].getElementsByTagName( "Data-Processing")[0].childNodes[0].data except: s_data_processing = "null" try: s_library_strategy = sample[i_s].getElementsByTagName( "Library-Strategy")[0].childNodes[0].data except: s_library_strategy = "null" try: s_description = sample[i_s].getElementsByTagName( "Description")[0].childNodes[0].data except: s_description = "null" try: s_platform_ref = sample[i_s].getElementsByTagName( "Platform-Ref")[0].childNodes[0].data except: s_platform_ref = "null" try: s_Last_Update_Date = sample[i_s].getElementsByTagName( "Last-Update-Date")[0].childNodes[0].data except: s_Last_Update_Date = "null" try: s_Release_Date = sample[i_s].getElementsByTagName( "Release-Date")[0].childNodes[0].data except: s_Release_Date = "null" #SAGE 特有的 try: s_anchor = sample[i_s].getElementsByTagName( "Anchor")[0].childNodes[0].data s_anchor = "(SAGE_anchor)" + s_anchor except: s_anchor = "(SAGE_anchor)null" try: s_type = sample[i_s].getElementsByTagName( "Type")[0].childNodes[0].data s_type = "(SAGE_type)" + s_type except: s_type = "(SAGE_type)null" try: s_tag_count = sample[i_s].getElementsByTagName( "Tag-Count")[0].childNodes[0].data s_tag_count = "(SAGE_count)" + s_tag_count except: s_tag_count = "(SAGE_count)null" try: s_tag_length = sample[i_s].getElementsByTagName( "Tag-Length")[0].childNodes[0].data s_tag_length = "(SAGE_len)" + s_tag_length except: s_tag_length = "(SAGE_len)null" #把characteristic放在最后,是因为characteristic对每个GSE是不同的 chr_str = '' try: s_char_array = sample[i_s].getElementsByTagName( "Characteristics") for i in range(s_char_array.length): s_char_tag = s_char_array[i].getAttribute("tag") #text里面有换行符 s_char_text = s_char_array[i].childNodes[0].data if not s_char_tag: s_char_tag = 'characteristics' chr_str = chr_str + "'" + s_char_tag + "'" + ":" + "'" + s_char_text + "'" + "," s_char = "[char]({}){}".format(s_char_tag, s_char_text) sample_char_list.append(s_char) s_char_need = "*#*#*#".join(sample_char_list) sample_char_list = [] except: s_char_need = "null" chr_str = re.sub(r'\n', '', chr_str) chr_str = re.sub(r'\s+', ' ', chr_str) output_col_1 = "{" + chr_str + "'organism':" + "'" + s_organism + "'" + ",'source name':" + "'" + s_source + "'" + ", 'title':" + "'" + s_title + "'" + ", 'last update date':" + "'" + s_Last_Update_Date + "'" + ", 'release date': " + "'" + s_Release_Date + "'" + ", 'method': " + "'" + p_technology_all + "'" + "}" output_list.append(gse) output_list.append(s_number) output_list.append(output_col_1) #output_list.append(virus_name) #换行符和多个空格的问题 sample_single = s_number + "*#*#*#" + s_title + "*#*#*#" + s_channel + "*#*#*#" + s_source + "*#*#*#" + s_organism + "*#*#*#" + s_treatment + "*#*#*#" + s_growth + "*#*#*#" + s_molecule + "*#*#*#" + s_extract + "*#*#*#" + s_label + "*#*#*#" + s_data_processing + "*#*#*#" + s_library_strategy + "*#*#*#" + s_description + "*#*#*#" + s_platform_ref + "*#*#*#" + s_Last_Update_Date + "*#*#*#" + s_Release_Date + "*#*#*#" + s_anchor + "*#*#*#" + s_type + "*#*#*#" + s_tag_count + "*#*#*#" + s_tag_length + "*#*#*#" + s_char_need sample_single_list = [sample_single] sample_single_list = move_break(sample_single_list) sample_single = sample_single_list[0] output_list.append(sample_single) #print("sample_single:{}".format(sample_single)) #zrb_bern=query_raw(output_col_1) #print(sample_list_all) hdq_bern = query_raw(sample_single) #extract characteristic alone # line_list=line.split('\t') # line_text=line_list[0] #line_dict={} line_text_list = output_col_1.split(',') line_dict = {} match_list = [ 'cell line', 'organism', 'cell type', 'method', 'source name', 'tissue', 'disease', 'treatment' ] for i in line_text_list: i = re.sub("'", "", i) i = re.sub(r"\{", "", i) i = re.sub(r"\}", "", i) i = re.sub(r'"', "", i) i = i.strip() dcit_list = i.split(':') #line_dict[str(dcit_list[0])]=str(dcit_list[1]) dcit_list[0] = re.sub("'", "", dcit_list[0]) dcit_list[0] = re.sub(r"\{", "", dcit_list[0]) dcit_list[0] = re.sub(r"\}", "", dcit_list[0]) dcit_list[0] = re.sub(r'"', "", dcit_list[0]) dcit_list[0] = str(dcit_list[0]).strip() try: line_dict[str(dcit_list[0])] = str(dcit_list[1]) except: line_dict[str(dcit_list[0])] = 'null' for i in match_list: if i in line_dict.keys(): line_dict[i] = str(line_dict[i]).strip() output_list.append(str(line_dict[i])) else: output_list.append('null') output_list.append(s_library_strategy) #换行符和多个空格的问题 #sample_single=s_number+"*#*#*#"+s_title+"*#*#*#"+s_channel+"*#*#*#"+s_source+"*#*#*#"+s_organism+"*#*#*#"+s_treatment+"*#*#*#"+s_growth+"*#*#*#"+s_molecule+"*#*#*#"+s_extract+"*#*#*#"+s_label+"*#*#*#"+s_data_processing+"*#*#*#"+s_description+"*#*#*#"+s_platform_ref+"*#*#*#"+s_Last_Update_Date+"*#*#*#"+s_Release_Date+"*#*#*#"+s_anchor+"*#*#*#"+s_type+"*#*#*#"+s_tag_count+"*#*#*#"+s_tag_length+"*#*#*#"+s_char_need #zrb_bern=query_raw(output_col_1) #print(sample_list_all) hdq_bern = query_raw(sample_single) #zrb_disease_str,zrb_disease_id_str,zrb_drug_str,zrb_drug_id_str,zrb_gene_str,zrb_gene_id_str=bern_list(zrb_bern) # zrb_bern_list=[zrb_disease_str,zrb_disease_id_str,zrb_drug_str,zrb_drug_id_str,zrb_gene_str,zrb_gene_id_str] # for i in zrb_bern_list: # output_list.append(str(i)) hdq_disease_str, hdq_disease_id_str, hdq_drug_str, hdq_drug_id_str, hdq_gene_str, hdq_gene_id_str = bern_list( hdq_bern) hdq_bern_list = [ hdq_disease_str, hdq_disease_id_str, hdq_drug_str, hdq_drug_id_str, hdq_gene_str, hdq_gene_id_str ] test_disease = normalize.Normalize(hdq_disease_id_str) disease_output_id_disease_name_str, disease_output_disease_name_str = test_disease.disease( ) test_drug = normalize.Normalize(hdq_drug_id_str) drug_output_id_drug_name_str, drug_output_drug_name_str = test_drug.drug( ) test_gene = normalize.Normalize(hdq_gene_id_str) gene_output_id_gene_name_str, gene_output_gene_name_str = test_gene.gene( ) test_knock = normalize.Normalize(sample_single) knock_out_down, knock_in, knock, over = test_knock.knock_out() cell_line_text = normalize.Normalize(output_col_1) cell_line_text_str = cell_line_text.cell_line() cell_line_bern_text = normalize.Normalize(sample_single) cell_line_bern_text_str = cell_line_bern_text.cell_line() gsm_rrid = normalize.Normalize(s_number) gsm_rrid_cell_line, gsm_rrid_disease = gsm_rrid.rrid_gsm() hdq_bern_list = [ hdq_disease_str, hdq_disease_id_str, disease_output_id_disease_name_str, disease_output_disease_name_str, hdq_drug_str, hdq_drug_id_str, drug_output_id_drug_name_str, drug_output_drug_name_str, hdq_gene_str, hdq_gene_id_str, gene_output_id_gene_name_str, gene_output_gene_name_str, knock_out_down, knock_in, knock, over, cell_line_text_str, cell_line_bern_text_str, gsm_rrid_cell_line, gsm_rrid_disease ] for j in hdq_bern_list: output_list.append(str(j)) #for i in output_list : line = '\t'.join(output_list) line = line + '\n' with open(output, "a", encoding='utf-8') as out: out.write(line)