I'm trying to gap-fill my model, using the BIGG universal model as reference, but for some reason I can't load it.
I've been using a code from a jupyter notebook I found in the cobrapie group, given by Moritz (which I guess is a part of CobraPy..), called "model_building_with_universal.ipynb".
these are the first lines:
import requests
from cobra import Model
from cobra.io import model_from_dict
resp = requests.get("http://bigg.ucsd.edu/static/namespace/universal_model.json")
resp.raise_for_status()
universal = model_from_dict(resp.json())
Then I get this error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-4230f221b04f> in <module>
----> 1 universal = model_from_dict(resp.json())
~\AppData\Roaming\Python\Python38\site-packages\cobra\io\dict.py in model_from_dict(obj)
250 model = Model()
251 model.add_metabolites(
--> 252 [metabolite_from_dict(metabolite) for metabolite in obj["metabolites"]]
253 )
254 model.genes.extend([gene_from_dict(gene) for gene in obj["genes"]])
~\AppData\Roaming\Python\Python38\site-packages\cobra\io\dict.py in <listcomp>(.0)
250 model = Model()
251 model.add_metabolites(
--> 252 [metabolite_from_dict(metabolite) for metabolite in obj["metabolites"]]
253 )
254 model.genes.extend([gene_from_dict(gene) for gene in obj["genes"]])
~\AppData\Roaming\Python\Python38\site-packages\cobra\io\dict.py in metabolite_from_dict(metabolite)
115 new_metabolite = Metabolite()
116 for k, v in iteritems(metabolite):
--> 117 setattr(new_metabolite, k, v)
118 return new_metabolite
119
~\AppData\Roaming\Python\Python38\site-packages\cobra\core\object.py in annotation(self, annotation)
48 def annotation(self, annotation):
49 if not isinstance(annotation, dict):
---> 50 raise TypeError("Annotation must be a dict")
51 else:
52 self._annotation = annotation
TypeError: Annotation must be a dict
Don't know why this happens. I think this code should be reproducible.
Any help will be highly appreciated, regarding this issue, or another approach I should use for reading a universal model.
Hi,
I'm trying to gap-fill my model, using the BIGG universal model as reference, but for some reason I can't load it.
I've been using a code from a jupyter notebook I found in the cobrapie group, given by Moritz (which I guess is a part of CobraPy..), called "model_building_with_universal.ipynb".
these are the first lines:
Then I get this error:
Don't know why this happens. I think this code should be reproducible.
Any help will be highly appreciated, regarding this issue, or another approach I should use for reading a universal model.
Best, Alon