如何在SBML中向基因添加注释? [英] How to add annotation to a gene in SBML?
问题描述
我有一个基因组规模的化学计量代谢模型iMM904.xml
,当我在文本编辑器中打开它时,我可以看到某些基因已经添加了注释,例如
I have a genome-scale stoichiometric metabolic model iMM904.xml
and when I open it in a text editor I can see that certain genes have annotation added to them, e.g.
<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>
如何访问和更改此注释?当我尝试
How can I access and alter this annotation? When I try
import cbmpy as cbm
cmod = cbm.CBRead.readSBML3FBC('iMM904.xml')
gene = cmod.getGene('G_YLR189C')
print gene.getAnnotations()
我只看到一个空字典.
此外,如何向其中添加last modified by
之类的注释和实际注释?
In addition, how could I add annotations like last modified by
and actual notes to it?
推荐答案
在CBMPy中,您可以通过三种不同的方式将注释添加到SBML文件中:
In CBMPy, you have three different options of adding annotation to a SBML file:
1)MIRIAM批注
1) MIRIAM annotation,
2)任意键值对和
3)易读的笔记
应涵盖您在问题中提到的所有要点.我演示了如何将它们用于基因输入,但是可以使用相同的命令来注释物种(代谢物)和反应.
which should cover all points you have mentioned in your question. I demonstrate how to use them for the gene entry, but the same commands can be used to annotate species (metabolites) and reactions.
1. MIRIAM批注
要访问现有的MIRIAM批注-您在问题中显示的批注-您可以使用:
To access the existing MIRIAM annotation - the one you show in your question - you can use:
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文件中看到的条目.
As you can see, it contains the entries you saw in the SBML file.
如果您现在要添加MIRIAM注释,则可以使用两种方法:
If you now want to add MIRIAM annotation, you can use two approaches:
A),让CBMPy为您创建网址:
A) let CBMPy create the url for you:
gene.addMIRIAMannotation('is', 'UniProt Knowledgebase', 'Q06321')
B)输入您自己的网址:
# made up protein!
gene.addMIRIAMuri('is', 'http://identifiers.org/uniprot/P12345')
如果您现在选中gene.getMIRIAMannotations()
,您将看到(我删除了一些空白条目):
If you now check gene.getMIRIAMannotations()
, you will see (I cut off a few empty entries):
'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
条目仅用于演示,请勿在实际模型中使用它!)
So, both of your entries have been added (again: the P12345
entry is just for demonstration, don't use it in your actual model!).
如果您不知道正确的数据库标识符,CBMPy也会在其中帮助您,例如如果您尝试:
If you do not know the correct database identifier, CBMPy will also help you there, e.g. if you try:
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
.以您的示例为例,
Not everything can be annotated using the MIRIAM annotation scheme but you can easily create your own key-value-pairs
. Using your example,
gene.setAnnotation('last_modified_by', 'Vinz')
键和值是完全任意的,
gene.setAnnotation('arbitrary key', 'arbitrary value')
如果您现在拨打电话
gene.getAnnotations()
您收到
{'arbitrary key': 'arbitrary value', 'last_modified_by': 'Vinz'}
如果要访问某个密钥,可以使用
If you want to access a certain key, you can use
gene.getAnnotation('last_modified_by')
产生
'Vinz'
3.添加笔记
如果您想写实际的注释,前两个选项都不适合,但是您可以使用:
If you want to write actual comments neither of the first two options are appropriate but you can use:
gene.setNotes('This is my favorite gene')
您可以使用
gene.getNotes()
如果您现在使用导出模型(请确保使用FBCV2!):
If you now export the model using (make sure to use FBCV2!):
cbm.CBWrite.writeSBML3FBCV2(mod, 'iMM904_edited.xml')
并在文本编辑器中打开模型,您将看到所有注释都已添加到:
and open the model in your text editor, you will see that all the annotation has been added in:
<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>
这篇关于如何在SBML中向基因添加注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!