我想要做的是在基因组文件中将GenBank记录的所有非假定序列都用小写字母表示。
到目前为止,我设法获得了gbk中蛋白质的起始和结束位置。在此基础上,我执行以下操作:
start = feature.location.nofuzzy_start
end = feature.location.nofuzzy_end
gb_record.seq[start:end]现在我有了基因组中序列的开始和结束位置。但是我如何修改基因组文件呢?gb_record.seq[start:end].lower()或类似的东西不能做到这一点。
当我分配gb_record.seq = gb_record.seq[start:end].lower时,当我替换基因组文件时,它显然会出错。有什么想法吗?
发布于 2012-04-02 06:08:40
Bio.Seq.Seq对象有一个lower()方法,它将执行您正在寻找的操作。
完成你的代码,你会得到:
seq_lower = gb_record.seq.lower()然后,您应该能够使用SeqIO模块将小写序列写到文件中。
from Bio import SeqIO
with open("example.fasta", 'w') as handle:
    SeqIO.write(lower_records, handle, 'fasta')https://stackoverflow.com/questions/9664963
复制相似问题