Bcbio-gff 文件创建问题

Bcbio-gff File creation issue

使用 GFF.write() 创建文件时,我得到一个以 "annotation remark" 作为源的新行,然后是序列区域的 ASCII 编码:

##gff-version 3
##sequence-region NC_011594.1 1 16779
NC_011594.1 annotation  remark  1   16779   .   .   .   gff-version=3;sequence-region=%28%27NC_011594.1%27%2C 0%2C 16971%29,%28%27NC_042493.1%27%2C 0%2C 132544852%29, (continues on and on)
NC_011594.1 RefSeq  gene    1   1531    .   +   .   Dbxref=GeneID:7055888;ID=gene-COX1;Name=COX1;gbkey=Gene;gene=COX1;gene_biotype=protein_coding

知道它为什么在这里、它有什么用以及我如何避免它?我担心在第三方软件中使用它可能会成为问题。

我只导入了 bcbio-gff 包,但我相信它是 Biopython 的一部分,link:https://biopython.org/wiki/GFF_Parsing

第一个问题 - "Why it is there?"

  • 我只是假设,默认情况下包作者希望导出尽可能多的信息。

你的下一个问题 - "How can I avoid it?"

  • 遗憾的是没有关闭开关。对我来说,解决方案是从导出的序列中删除所有注释。 (即在调用 GFF.write().
  • 之前将 annotations 属性设置为空字典

示例:

from Bio import SeqIO
from BCBio import GFF

g = SeqIO.read('NC_003888.3.gb','gb')

g.annotations = {}

with open('t2.gff', 'w') as f:
    GFF.write([g], f)

输出文件头 - 无 # annotation remark

head t2.gff 
##gff-version 3
##sequence-region NC_003888.3 1 8667507
NC_003888.3 feature source  1   8667507 ... removed for clarity ....