micom
micom copied to clipboard
Error while copying model using model.copy()
Discussed in https://github.com/micom-dev/micom/discussions/69
Originally posted by anubhavdas0907 March 8, 2022 Hello Christian,
I was trying to copy a community model to a different variable, but I get an error. I want to manipulate a model, without changing the original one.
Following are the details.
from micom import load_pickle
model = load_pickle("ERR1883210.pickle")
model_1 = model.copy()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/data/Conda_base/envs/MyConda/lib/python3.7/site-packages/cobra/core/model.py", line 321, in copy
new = self.__class__()
TypeError: __init__() missing 1 required positional argument: 'taxonomy'
Can you please suggest, what's wrong in this code, and what can be the solution?
Regards Anubhav
Sorry about that I haven't overwritten the copy function yet. For now you can just read the model again and that should have the same effect, like:
from micom import load_pickle
model = load_pickle("ERR1883210.pickle")
model_1 = load_pickle("ERR1883210.pickle") # that's basically a copy
Hello Christian,
Thanks for suggesting that solution. I will try that.
Regards Anubhav