我正在尝试运行脚本(见下文)以读取 fasta 文件并输出分类文件(仅打印不带“>”字符的序列标题)但我不断收到无法解决的语法错误. 结果,该脚本创建了 cleanseqs.tax 文件,但该文件为空白。有人可以帮忙吗?
谢谢!
>>> Fasta = open("testseqs.fasta", "r")
>>> Tax = open("cleanseqs.tax", "w")
>>> while 1:
... SequenceHeader= Fasta.readline()
... Sequence= Fasta.readline()
... if SequenceHeader == '':
... break
... Tax.write(SequenceHeader.replace('>', ''))
... Fasta.close()
File "<stdin>", line 7
Fasta.close()
^
SyntaxError: invalid syntax
>>> Tax.close()