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

发布于 2021-01-29 15:05:20

我有一个基因组规模的化学计量代谢模型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向其中添加注释和实际注释?

关注者
0
被浏览
109
1 个回答
  • 面试哥
    面试哥 2021-01-29
    为面试而生,有面试问题,就找面试哥。

    在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为您创建网址:

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

    B) 输入您自己的网址:

    # 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>
    


知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看