qiime请求这个(here)关于它作为输入接收的fasta文件:
The file is a FASTA file, with sequences in the single line format. That is, sequences are not broken up into multiple lines of a particular length, but instead the entire sequence occupies a single line.
Bio.SeqIO.write当然遵循format recommendations,每80 bps分割一次序列。
我可以写我自己的作家写那些“单行”快-但我的问题是,如果有一种方法,我错过了让SeqIO做。

最佳答案

biopython的SeqIO模块使用FastaIO子模块以fasta格式读写。
FastaIO.FastaWriter类可以每行输出不同数量的字符,但接口的这一部分不会通过SeqIO公开。您需要直接使用FastaIO
所以不要使用:

from Bio import SeqIO
SeqIO.write(data, handle, format)

使用:
from Bio.SeqIO import FastaIO
fasta_out = FastaIO.FastaWriter(handle, wrap=None)
fasta_out.write_file(data)


for record in data:
    fasta_out.write_record(record)

09-28 09:17