【问题标题】:Bcbio-gff File creation issueBcbio-gff 文件创建问题
【发布时间】:2020-04-24 22:13:06
【问题描述】:

当使用 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 的一部分,链接:https://biopython.org/wiki/GFF_Parsing

【问题讨论】:

  • 一个可重现的例子会很好:) 在那之前很难知道什么可能是错的。 github.com/biocore-ntnu/pyranges 也可以读/写 GFF,不知道能不能解决你的问题。
  • 我做了什么:从 GFF 文件中提取信息(使用 GFF.parse() 和 limit_info 是一些基因),然后将其直接发送到 GFF.write() 以创建一个新文件只有选定的基因
  • 这个问题可能会在生物信息学stackexchange网站得到更多答案:bioinformatics.stackexchange.com

标签: python bioinformatics biopython gff


【解决方案1】:

对于你的第一个问题——“它为什么会在那里?”

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

你的下一个问题——“我怎样才能避免它?”

  • 很遗憾没有关闭开关。对我来说,解决方案是从导出的序列中删除任何注释。 (即在调用 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 ....

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-23
    • 2018-10-22
    • 2011-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-16
    • 1970-01-01
    相关资源
    最近更新 更多