Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while copying model using model.copy() #72

Open
cdiener opened this issue Mar 16, 2022 Discussed in #69 · 2 comments
Open

Error while copying model using model.copy() #72

cdiener opened this issue Mar 16, 2022 Discussed in #69 · 2 comments

Comments

@cdiener
Copy link
Collaborator

cdiener commented Mar 16, 2022

Discussed in #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

@cdiener
Copy link
Collaborator Author

cdiener commented Mar 16, 2022

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

@anubhavdas0907
Copy link

Hello Christian,

Thanks for suggesting that solution. I will try that.

Regards
Anubhav

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants