SBRG / bigg_models

The BiGG Models website server
http://bigg.ucsd.edu
Other
75 stars 18 forks source link

List of GPRs for the universal_model.json and won't load into cobrapy #404

Closed bananabenana closed 2 years ago

bananabenana commented 2 years ago

Hi,

I was hoping to access the genes and GPRs for the universal_model, but there isn't any associated? Is there a list of these accessible via API?

Also I am having issues reading the universal_model.json into cobrapy.

cobra.io.load_json_model('universal_model.json')

which produces the following error:

~/miniconda3/lib/python3.8/site-packages/cobra/io/json.py in load_json_model(filename)
    140     if isinstance(filename, string_types):
    141         with open(filename, "r") as file_handle:
--> 142             return model_from_dict(json.load(file_handle))
    143     else:
    144         return model_from_dict(json.load(filename))

~/miniconda3/lib/python3.8/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"]])

~/miniconda3/lib/python3.8/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"]])

~/miniconda3/lib/python3.8/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 

~/miniconda3/lib/python3.8/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

Thanks

Schmoho commented 2 years ago

I have just tested this; I can reproduce the error with python version 3.9 and cobra 0.25.0.

However, with python version 3.8 and cobra version 0.14.2 I was able to load the universal model.

Could you provide the versions you are using?

bananabenana commented 2 years ago

Ah sorry about leaving this issue open! The amazing @cdiener has updated the universal model for recent COBRA versions here