使用生物SeqIO写单行FASTA

2024-03-28 17:12:46 发布

您现在位置:Python中文网/ 问答频道 /正文

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拆分一个序列。 我可以写我自己的作家来写那些“单行线”的fasta——但我的问题是,我是否错过了让SeqIO这样做的方法。在


Tags: 文件theformathereiswithlinefasta
1条回答
网友
1楼 · 发布于 2024-03-28 17:12:46

BioPython的SeqIO模块使用FastaIO子模块以FASTA格式读写。在

FastaIO.FastaWriter类可以每行输出不同数量的字符,但接口的这一部分不会通过SeqIO公开。您需要直接使用FastaIO。在

所以不要使用:

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

使用:

^{pr2}$

或者

for record in data:
    fasta_out.write_record(record)

相关问题 更多 >