谢谢
脚本:
from Bio import SeqIO
for index, record in enumerate(SeqIO.parse("file.fasta","fasta")):
seed= record.seq[1:8]
a = (print(">" + record.id + '\n\ + seed)
输出:
>aga-miR-12417-5p
AGUCGUU
>aga-miR-12418-3p
GUUCGAU
>aga-miR-12419-5p
GCUGUUC
答案 0 :(得分:0)
如果只需要写入一个简单的纯文本文件,则可以执行以下操作:
from Bio import SeqIO
with open('output_file', 'w') as output:
for index, record in enumerate(SeqIO.parse("file.fasta","fasta")):
seed= record.seq[1:8]
output.writeline(">" + record.id)
output.writeline(seed)