Error when reading model downloaded from Kbase

65 views
Skip to first unread message

Rachel Kohn

unread,
Aug 11, 2020, 12:54:12 PM8/11/20
to cobra pie
Hello everyone,

I am new to working with cobrapy and was hoping to gain some insight. I have generated a metabolic model in Kbase. There are options to download the model in SBML or JSON format, which should both work in cobra. However, I get an error code that states the object has no reactions attribute when trying to import a .json file (Note: this is from an output in pycharm):

C:\Users\Rachel\PycharmProjects\cobrapytest\venv\Scripts\python.exe C:/Users/Rachel/PycharmProjects/cobrapytest/Gen_test.py
Traceback (most recent call last):
  File "C:/Users/Rachel/PycharmProjects/cobrapytest/Gen_test.py", line 13, in <module>
    cobra.io.load_json_model(data_dir)
  File "C:\Users\Rachel\PycharmProjects\cobrapytest\venv\lib\site-packages\cobra\io\json.py", line 136, in load_json_model
    return model_from_dict(json.load(file_handle))
  File "C:\Users\Rachel\PycharmProjects\cobrapytest\venv\lib\site-packages\cobra\io\dict.py", line 211, in model_from_dict
    raise ValueError('Object has no reactions attribute. Cannot load.')
ValueError: Object has no reactions attribute. Cannot load.

Process finished with exit code 1


or this error when I try to import the SBML file from Kbase:

C:\Users\Rachel\PycharmProjects\cobrapytest\venv\Scripts\python.exe C:/Users/Rachel/PycharmProjects/cobrapytest/Gen_test.py
'' is not a valid SBML 'SId'.

Process finished with exit code 0



Can anyone help me fix this issue so I can read my model in cobra?

Thank you!

moritz...@gmail.com

unread,
Aug 11, 2020, 1:16:31 PM8/11/20
to cobr...@googlegroups.com
Hello Rachel,

Is there any chance that you could provide the model? Feel free to send it to me personally if you don't want to pass it to the whole list.
Best,
Moritz
--
You received this message because you are subscribed to the Google Groups "cobra pie" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-pie+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-pie/bb38c318-3772-48b1-9e19-e31144c45572o%40googlegroups.com.

Rachel

unread,
Aug 11, 2020, 1:26:25 PM8/11/20
to cobra pie
Hi Moritz,

thank you so much for the offer, but I cannot share the model as the genome has not yet been published! Any tips on what I should try?

Rachel
To unsubscribe from this group and stop receiving emails from it, send an email to cobr...@googlegroups.com.

moritz...@gmail.com

unread,
Aug 11, 2020, 1:57:16 PM8/11/20
to cobr...@googlegroups.com
I'm not sure that the KBase JSON format is actually compatible. They used to have a different one. Are you sure that it now is compatible?

For the SBML it looks like the model is missing an ID on some component (I cannot tell which kind of model component from what you posted here). You could manually inspect the SBML file and search for empty identifier attributes (id="").

Rachel

unread,
Aug 11, 2020, 2:44:55 PM8/11/20
to cobra pie
Thank you Moritz for the idea! I ran my file through SBMLs validator on their website (see attached). It looks like it is not valid SBML. Any tips on how I could fix this? or would I be better off trying something like ModelSeed?
InvalidSBML.JPG

moritz...@gmail.com

unread,
Aug 11, 2020, 4:41:14 PM8/11/20
to cobr...@googlegroups.com
Since you generated the SBML file on KBase. Please contact the KBase staff for assistance. They're usually very helpful.
--
You received this message because you are subscribed to the Google Groups "cobra pie" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-pie+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-pie/72bc74a0-c3ef-4031-a277-0ce5b6b8e4c3o%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages