1. Basic Usage#
We can retrieve any database entity, either by BiGG ID (str) or internal ID (int). For example, information on the E. coli model iML1515 can be obtained using the following command:
[1]:
from biggr import objects as bo
[2]:
model = bo.get("model", "iML1515")
print(model.organism)
Escherichia coli str. K-12 substr. MG1655
From this object, we can directly observe which properties and relations can be accessed.
[3]:
print("\n".join(x for x in dir(model) if not x.startswith("_")))
base_filename
bigg_id
collection
collection_id
date_modified
escher_maps
from_dict
genome
genome_id
id
memote_results
model_compartmentalized_components
model_count
model_genes
model_reactions
organism
publication_models
published_filename
taxon
taxon_id
If we would like to obtain taxonomic information associated with the model, we could use the taxon_id property to obtain a new object:
[4]:
taxon = bo.get("taxon", model.taxon_id)
print(taxon.name)
Escherichia coli str. K-12 substr. MG1655
However, the taxon relation can also be directly accessed from the model object. Accessing the taxon attribute causes a new API call to be made to obtain the associated entity. This manner of lazy-loading enables easy navigation of the database, without users having to bother with the API too much.
[5]:
print(model.taxon.name)
Escherichia coli str. K-12 substr. MG1655
This enables more complex relations to be navigated seamlessly.
[6]:
node = model.taxon
while node.rank.name.lower() != "family":
if node.id == node.parent.id:
node = None
break
node = node.parent
print(f"{node.name} ({node.rank.name})")
Enterobacteriaceae (family)