fasta文件加标签

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"
#print(line_2)
f_rewrite.write(line_2)
all_genome.write(line_2)
else:
f_rewrite.write(line)
all_genome.write(line)

#print(line.strip()) # 把末尾的'\n'删掉
f_rewrite.close()
all_genome.close()

💌lixiang117423@foxmail.com
💌lixiang117423@gmail.com


fasta文件加标签
https://lixiang117423.github.io/article/fastalab/
作者
小蓝哥
发布于
2021年12月10日
许可协议