Kor*_*rem 3 python bioinformatics fasta biopython python-2.7
QIIME请求这里(这里)关于它作为输入接收的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
当然遵循格式建议,并每隔80个bps拆分序列.我可以写自己的作家来写那些"单行"的快速 - 但我的问题是,如果有一种方法,我错过了SeqIO
这样做.
BioPython的SeqIO
模块使用FastaIO
子模块以FASTA格式读写.
的FastaIO.FastaWriter
类可以输出不同数量的每行的字符但界面的这部分不是通过暴露SeqIO
.您需要FastaIO
直接使用.
所以不要使用:
from Bio import SeqIO
SeqIO.write(data, handle, format)
Run Code Online (Sandbox Code Playgroud)
使用:
from Bio.SeqIO import FastaIO
fasta_out = FastaIO.FastaWriter(handle, wrap=None)
fasta_out.write_file(data)
Run Code Online (Sandbox Code Playgroud)
要么
for record in data:
fasta_out.write_record(record)
Run Code Online (Sandbox Code Playgroud)