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
| import os
files = os.listdir("G:\\33Pan_download\\下载数据\\unzip\\")
all_genome = open("G:\\33Pan_download\\下载数据\\all_genome.fa","w")
for i in files: print(i) file_genome = "G:\\33Pan_download\\下载数据\\unzip\\" + str(i) + "\\" + str(i) + ".genome" new_genome = file_genome + ".fa" f_rewrite = open(new_genome, "w") f = open(file_genome,"r") for line in f.readlines(): if line[0] == ">": line_2 = line.replace("\n","") + "_" + i + "\n" f_rewrite.write(line_2) all_genome.write(line_2) else: f_rewrite.write(line) all_genome.write(line) f_rewrite.close() all_genome.close()
|
💌lixiang117423@foxmail.com
💌lixiang117423@gmail.com