Working with Annotations
COPASI and SBML files can be annotated with MIRIAM annotations. These annotations describe what the model and its constituents actually represent. In basico you can ask for these annotations using the get_miriam_annotation
function, simmilarly, you can set them using the set_miriam_annotation
commands.
So lets start as usual, loading basico:
[1]:
import sys
if '../..' not in sys.path:
sys.path.append('../..')
from basico import *
from ipywidgets import HTML
%matplotlib inline
Resource Lists / Updating
For the resolving of MIRIAM entries to work, occasionally COPASI needs to update the list of MIRIAM resources. This will be necessary on systems, where the graphical user interface to COAPSI has not been installed. To see whether it is necessary, you can call:
[2]:
have_miriam_resources()
[2]:
True
Should that call return false, simply update the resources using:
[3]:
update_miriam_resources()
To see the list of terms currently known by COPASI you can use the function:
[4]:
get_miriam_resources().head()
[4]:
is_citation | uri | |
---|---|---|
resource | ||
2D-PAGE protein | False | http://identifiers.org/2d-page.protein |
3DMET | False | http://identifiers.org/3dmet |
ABS | False | http://identifiers.org/abs |
AFTOL | False | http://identifiers.org/aftol.taxonomy |
AGD | False | http://identifiers.org/agd |
and of course you can filter elements as usual, for example here to see the resources suitable for citations:
[5]:
resources = get_miriam_resources()
resources[resources.is_citation == True]
[5]:
is_citation | uri | |
---|---|---|
resource | ||
DOI | True | http://identifiers.org/doi |
ISBN | True | http://identifiers.org/isbn |
PubMed | True | http://identifiers.org/pubmed |
arXiv | True | http://identifiers.org/arxiv |
Displaying Annotations:
Now we load a fully annotated model, to display its annotations:
[6]:
load_biomodel(64);
Then we can display the Notes of the model:
[7]:
display(HTML(get_notes()))
Similarly, we could get to all annotations. As with the get_notes
call, if no element is specified, the annotations of the model element will be displayed:
[8]:
get_miriam_annotation()
[8]:
{'creators': [{'first_name': 'Harish',
'last_name': 'Dharuri',
'email': 'hdharuri@cds.caltech.edu',
'organization': 'California Institute of Technology'},
{'first_name': 'Jacky L',
'last_name': 'Snoep',
'email': 'jls@sun.ac.za',
'organization': 'Stellenbosh University'},
{'first_name': 'Lukas',
'last_name': 'Endler',
'email': 'lukas@ebi.ac.uk',
'organization': 'EMBL-EBI'}],
'references': [{'id': '10951190',
'uri': 'http://identifiers.org/pubmed/10951190',
'resource': 'PubMed',
'description': ''}],
'descriptions': [{'id': 'sce00010',
'qualifier': 'is',
'uri': 'http://identifiers.org/kegg.pathway/sce00010',
'resource': 'KEGG Pathway'},
{'id': 'BIOMD0000000064',
'qualifier': 'is',
'uri': 'http://identifiers.org/biomodels.db/BIOMD0000000064',
'resource': 'BioModels Database'},
{'id': 'GO:0006096',
'qualifier': 'is',
'uri': 'http://identifiers.org/go/GO:0006096',
'resource': 'Gene Ontology'},
{'id': 'MODEL6623915522',
'qualifier': 'is',
'uri': 'http://identifiers.org/biomodels.db/MODEL6623915522',
'resource': 'BioModels Database'},
{'id': 'REACT_723',
'qualifier': 'is homolog to',
'uri': 'http://identifiers.org/reactome/REACT_723',
'resource': 'Reactome'},
{'id': '4932',
'qualifier': 'has taxon',
'uri': 'http://identifiers.org/taxonomy/4932',
'resource': 'Taxonomy'}],
'modifications': [datetime.datetime(2012, 7, 19, 18, 26, 7, tzinfo=tzutc())],
'created': datetime.datetime(2008, 9, 16, 14, 0, 6, tzinfo=tzutc())}
To display the annotations of a specific species, or reaction just enter its name as the element to get the information for. Here we do this for NADH
to return the dictionary of descriptions as given:
[9]:
get_miriam_annotation(name='NADH')
[9]:
{'descriptions': [{'id': 'C00004',
'qualifier': 'is',
'uri': 'http://identifiers.org/kegg.compound/C00004',
'resource': 'KEGG Compound'},
{'id': 'CHEBI:16908',
'qualifier': 'is',
'uri': 'http://identifiers.org/chebi/CHEBI:16908',
'resource': 'ChEBI'}]}
Setting annotations
Lets start over with a new model, and annotate it as we go along:
[10]:
new_model(name='simple model', notes='A simple decay model');
The set_miriam_annotation
accepts the following arguments:
creators
: a list of creator dictionary entries with:first_name
,last_name
,email
andorganization
references
: a list of reference dictionary entries with:id
,uri
,resource
anddescription
descriptions
: a list of description dictionary entries with:qualifier
,resource
andid
modifications
: a list of DateTime objects representing the modification datescreated
: a DateTime object representing the creation datereplace
: a boolean indicating, whether the current annotation entries should be replaced (‘True’ default), or if new entries should be added to the existing ones (‘False’)
[11]:
set_miriam_annotation(creators=[
{
'first_name': 'Frank',
'last_name': 'Bergmann',
'email':'fbergman@caltech.edu',
'organization':'Heidelberg University'
}], replace=True)
[12]:
get_miriam_annotation()
[12]:
{'creators': [{'first_name': 'Frank',
'last_name': 'Bergmann',
'email': 'fbergman@caltech.edu',
'organization': 'Heidelberg University'}],
'created': datetime.datetime(2021, 5, 11, 10, 20, 12, tzinfo=tzutc())}
[13]:
set_miriam_annotation(descriptions=[
{
'qualifier': 'is',
'resource': 'BioModels Database',
'id': 'MODEL6623915522',
}
])
[14]:
get_miriam_annotation()
[14]:
{'creators': [{'first_name': 'Frank',
'last_name': 'Bergmann',
'email': 'fbergman@caltech.edu',
'organization': 'Heidelberg University'}],
'descriptions': [{'id': 'MODEL6623915522',
'qualifier': 'is',
'uri': 'http://identifiers.org/biomodels.db/MODEL6623915522',
'resource': 'BioModels Database'}],
'created': datetime.datetime(2021, 5, 11, 10, 20, 12, tzinfo=tzutc())}
[15]:
set_miriam_annotation(references=[
{
'id': '10951190',
'resource': 'PubMed',
}
])
[16]:
get_miriam_annotation()
[16]:
{'creators': [{'first_name': 'Frank',
'last_name': 'Bergmann',
'email': 'fbergman@caltech.edu',
'organization': 'Heidelberg University'}],
'references': [{'id': '10951190',
'uri': 'http://identifiers.org/pubmed/10951190',
'resource': 'PubMed',
'description': ''}],
'descriptions': [{'id': 'MODEL6623915522',
'qualifier': 'is',
'uri': 'http://identifiers.org/biomodels.db/MODEL6623915522',
'resource': 'BioModels Database'}],
'created': datetime.datetime(2021, 5, 11, 10, 20, 12, tzinfo=tzutc())}
[17]:
set_miriam_annotation(modifications=[datetime.datetime.now(datetime.timezone.utc)], replace=True)
[18]:
get_miriam_annotation()
[18]:
{'creators': [{'first_name': 'Frank',
'last_name': 'Bergmann',
'email': 'fbergman@caltech.edu',
'organization': 'Heidelberg University'}],
'references': [{'id': '10951190',
'uri': 'http://identifiers.org/pubmed/10951190',
'resource': 'PubMed',
'description': ''}],
'descriptions': [{'id': 'MODEL6623915522',
'qualifier': 'is',
'uri': 'http://identifiers.org/biomodels.db/MODEL6623915522',
'resource': 'BioModels Database'}],
'modifications': [datetime.datetime(2021, 5, 11, 10, 20, 12, 853419, tzinfo=tzutc())],
'created': datetime.datetime(2021, 5, 11, 10, 20, 12, tzinfo=tzutc())}