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 when trying to update BOF step 1 (1.8) #30

Open
Christiansj83 opened this issue Oct 30, 2018 · 3 comments
Open

Error when trying to update BOF step 1 (1.8) #30

Christiansj83 opened this issue Oct 30, 2018 · 3 comments

Comments

@Christiansj83
Copy link

AttributeError Traceback (most recent call last)
in ()
----> 1 bofdat_step1 = update.make_new_BOF(model_so,False,True,dna_coefficients,rna_coefficients,protein_coefficients,)

~/.local/lib/python3.6/site-packages/BOFdat-0.1.7-py3.6.egg/BOFdat/util/update.py in make_new_BOF(model, update_model, update_NGAM, *args, **kwargs)
159 ppi_coeff, h2o_coeff, atp_coeff = [], [], []
160 remove_keys = []
--> 161 for k, v in base_biomass.iteritems():
162 if k.id == 'ppi_c':
163 ppi_coeff.append(v)

AttributeError: 'dict' object has no attribute 'iteritems'

@EBosi
Copy link
Contributor

EBosi commented Nov 13, 2018

Hi, the issue here is that python 3 has dictionaries with an efficient .items() method which is equivalent to .iteritems() of python 2 (i.e. using a generator).
To make it compatible for both python version you should replace all instances of dict.iteritems with

from future.utils import iteritems

for (k, v) in iteritems(dict):

@jclachance
Copy link
Owner

Christian did raise some interesting concerns:
1- Compatibility with Python3 has to be reviewed for most of the code
2- What do we want to do with the Update module of BOFdat. I think it is useful for users to have such functionality but ad hoc functions can easily be generated that will better suit their needs also.

Any thoughts?

@EBosi
Copy link
Contributor

EBosi commented Dec 18, 2018

Hi JC,
1- yes, it's kinda boring but it should be done. The module future helps a lot, here are some idioms which should work for both versions (http://python-future.org/compatible_idioms.html), but I think you should look at futurize (http://python-future.org/automatic_conversion.html)
2- that's the thing, I see it as a cozy wrapper function which does what I could do, but in a snap

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

3 participants