Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cannot convert expression to float in build_me_model.ipynb #37

@bigsuicideparty

Description

@bigsuicideparty

I am running into an error with the build_me_model.ipynb:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/Users/bsp/unix/ecolime/ecolime/build_me_model.ipynb Cell 5' in <cell line: 4>()
      2 ijo_directory = join(flat_files.ecoli_files_dir, 'iJO1366.json')
      3 ijo = cobra.io.load_json_model(ijo_directory)
----> 4 me = cobrame.MEModel('iJL1678b-ME')
      6 # ME-models require special OptLang interface if cobrapy version >= 0.6.0
      7 # If cannot import SymbolicParameter, assume using cobrapy
      8 # versions <= 0.5.11
      9 try:

File /opt/homebrew/lib/python3.9/site-packages/cobrame/core/model.py:29, in MEModel.__init__(self, *args)
     27 self._biomass_dilution.add_metabolites({self._biomass: -1})
     28 self.add_reactions([self._biomass_dilution])
---> 29 self._biomass_dilution.upper_bound = mu
     30 self._biomass_dilution.lower_bound = mu
     31 # maintenance energy

File /opt/homebrew/lib/python3.9/site-packages/cobra/util/context.py:111, in wrapper(self, new_value)

File /opt/homebrew/lib/python3.9/site-packages/cobra/core/reaction.py:268, in upper_bound(self, value)
    266 # Rebuild the model with the new independent genes/metabolites
    267 self._metabolites = {}
--> 268 self.add_metabolites(new_metabolites)
    269 self._genes = set()
    270 for k in new_genes:

File /opt/homebrew/lib/python3.9/site-packages/cobra/core/reaction.py:220, in update_variable_bounds(self)
    217         return "system_boundary"
    218     return None
--> 220 @property
    221 def model(self):
    222     """returns the model the reaction is a part of"""
    223     return self._model

File /opt/homebrew/lib/python3.9/site-packages/sympy-1.10.1-py3.9.egg/sympy/core/expr.py:345, in Expr.__float__(self)
    343 if result.is_number and result.as_real_imag()[1]:
    344     raise TypeError("Cannot convert complex to float")
--> 345 raise TypeError("Cannot convert expression to float")

Any idea what might be the source of this error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions