如何在 SBML 中为基因添加注释?

How to add annotation to a gene in SBML?

我有一个基因组规模的化学计量代谢模型iMM904.xml,当我在文本编辑器中打开它时,我可以看到某些基因添加了注释,例如

<fbc:geneProduct fbc:id="G_YLR189C" fbc:label="YLR189C" metaid="G_YLR189C">
<annotation>
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/">
    <rdf:Description rdf:about="#G_YLR189C">
      <bqbiol:isEncodedBy>
        <rdf:Bag>
          <rdf:li rdf:resource="http://identifiers.org/ncbigene/850886" />
          <rdf:li rdf:resource="http://identifiers.org/sgd/S000004179" />
        </rdf:Bag>
      </bqbiol:isEncodedBy>
    </rdf:Description>
  </rdf:RDF>
</annotation>
</fbc:geneProduct>

如何访问和更改此注释?当我尝试

import cbmpy as cbm

cmod = cbm.CBRead.readSBML3FBC('iMM904.xml')

gene = cmod.getGene('G_YLR189C')

print gene.getAnnotations()

我只看到一个空字典。

此外,如何添加注释,如 last modified by 和实际注释?

在 CBMPy 中,您可以通过三种不同的方式向 SBML 文件添加注释:

1) MIRIAM 注释,

2) 任意键值对和

3) 人类可读的注释

这应该涵盖您在问题中提到的所有要点。我演示了如何将它们用于基因输入,但可以使用相同的命令来注释物种(代谢物)和反应。

1. MIRIAM 注释

要访问现有的 MIRIAM 注释 - 您在问题中显示的注释 - 您可以使用:

import cbmpy as cbm

mod = cbm.CBRead.readSBML3FBC('iMM904.xml.gz')

# access gene directly by its locus tag which avoids dealing with the "G_" in the ID
gene = mod.getGeneByLabel('YLR189C')

gene.getMIRIAMannotations()

这将给出:

{'encodes': (),
 'hasPart': (),
 'hasProperty': (),
 'hasTaxon': (),
 'hasVersion': (),
 'is': (),
 'isDerivedFrom': (),
 'isDescribedBy': (),
 'isEncodedBy': ('http://identifiers.org/ncbigene/850886',
  'http://identifiers.org/sgd/S000004179'),
 'isHomologTo': (),
 'isPartOf': (),
 'isPropertyOf': (),
 'isVersionOf': (),
 'occursIn': ()}

如您所见,它包含您在 SBML 文件中看到的条目。

如果您现在想要添加 MIRIAM 注释,您可以使用两种方法:

A) 让 CBMPy 为您创建 url:

gene.addMIRIAMannotation('is', 'UniProt Knowledgebase', 'Q06321')

B)输入url你自己:

# made up protein!
gene.addMIRIAMuri('is', 'http://identifiers.org/uniprot/P12345')

如果你现在查看 gene.getMIRIAMannotations(),你会看到(我删掉了一些空条目):

'is': ('http://identifiers.org/uniprot/Q06321',
  'http://identifiers.org/uniprot/P12345'),
 'isDerivedFrom': (),
 'isDescribedBy': (),
 'isEncodedBy': ('http://identifiers.org/ncbigene/850886',
  'http://identifiers.org/sgd/S000004179'),

因此,您的两个条目都已添加(再次强调:P12345 条目仅用于演示,请勿在您的实际模型中使用它!)。

如果您不知道正确的数据库标识符,CBMPy 也可以帮助您,例如如果你尝试:

gene.addMIRIAMannotation('is', 'uniprot', 'Q06321')

它将打印

"uniprot" is not a valid entity were you looking for one of these:

    UNII
    UniGene
    UniParc
    UniPathway Compound
    UniPathway Reaction
    UniProt Isoform
    UniProt Knowledgebase
    UniSTS
    Unimod
    Unipathway
    Unit Ontology
    Unite
INFO: Invalid entity: "uniprot" MIRIAM entity NOT set

其中包含我们上面使用的 'UniProt Knowledgebase'

2。添加任意键值对。

并非所有内容都可以使用 MIRIAM 注释方案进行注释,但您可以轻松创建自己的 key-value-pairs。使用您的示例,

gene.setAnnotation('last_modified_by', 'Vinz')

键和值是完全任意的,

gene.setAnnotation('arbitrary key', 'arbitrary value')

如果你现在打电话

gene.getAnnotations()

你收到

{'arbitrary key': 'arbitrary value', 'last_modified_by': 'Vinz'}

如果要访问某个键,可以使用

gene.getAnnotation('last_modified_by')

产生

'Vinz'

3。添加注释

如果你想写真正的评论,前两个选项都不合适,但你可以使用:

gene.setNotes('This is my favorite gene')

您可以使用

访问它们
gene.getNotes()

如果您现在导出模型使用(确保使用 FBCV2!):

cbm.CBWrite.writeSBML3FBCV2(mod, 'iMM904_edited.xml')

并在文本编辑器中打开模型,您会看到所有注释都已添加到:

<fbc:geneProduct metaid="meta_G_YLR189C" fbc:id="G_YLR189C" fbc:label="YLR189C">
  <notes>
    <html:body>This is my favorite gene</html:body>
  </notes>
  <annotation>
    <listOfKeyValueData xmlns="http://pysces.sourceforge.net/KeyValueData">
      <data id="arbitrary key" value="arbitrary value"/>
      <data id="last_modified_by" value="Vinz"/>
    </listOfKeyValueData>
    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:vCard4="http://www.w3.org/2006/vcard/ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
      <rdf:Description rdf:about="#meta_G_YLR189C">
        <bqbiol:is>
          <rdf:Bag>
            <rdf:li rdf:resource="http://identifiers.org/uniprot/Q06321"/>
            <rdf:li rdf:resource="http://identifiers.org/uniprot/P12345"/>
          </rdf:Bag>
        </bqbiol:is>
        <bqbiol:isEncodedBy>
          <rdf:Bag>
            <rdf:li rdf:resource="http://identifiers.org/ncbigene/850886"/>
            <rdf:li rdf:resource="http://identifiers.org/sgd/S000004179"/>
          </rdf:Bag>
        </bqbiol:isEncodedBy>
      </rdf:Description>
    </rdf:RDF>
  </annotation>
</fbc:geneProduct>