mrivas / pheflux

2 stars 0 forks source link

Error in pheflux.getFluxes from tutorial.ipynb #1

Open wshao1 opened 7 months ago

wshao1 commented 7 months ago

When running section 3 of the Tutorial notebook (pheflux.getFluxes(inputFile,resultsDir,prefix_log_file,verbosity)), I receive the following error:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_15380\559937113.py in <module>
----> 1 pheflux.getFluxes(inputFile,resultsDir,prefix_log_file,verbosity)

~\Downloads\mrivas-pheflux-368c01e\examples\pheflux.py in getFluxes(inputFileName, processDir, prefix_log, verbosity)
    413             print(atime, "Running pheflux...")
    414         k = 1000
--> 415         fluxes,optimization_time,total_time,status,success,lbx,ubx = optPheFlux(model,fpkmDic,k,init_time)
    416 
    417         ##############################################################

~\Downloads\mrivas-pheflux-368c01e\examples\pheflux.py in optPheFlux(model, fpkmDic, k, init_time)
    287     v,v_dic,lbx,ubx,f = setVariables(model,fpkmDic)
    288     sumVi = getSumV(v)
--> 289     ubg,lbg,g = createConstraints(model,k,v_dic,sumVi)
    290     print('')
    291     ##############################################################

~\Downloads\mrivas-pheflux-368c01e\examples\pheflux.py in createConstraints(model, k, v_dic, sumVi)
    261             print(i, field)
    262             if i == 0:
--> 263                 tmp_constraint = eval(field)
    264                 # tmp_constraint = field
    265             else:

~\Downloads\mrivas-pheflux-368c01e\examples\pheflux.py in <module>

NameError: name 'DRBK' is not defined

I then removed the eval function so that tmp_constraint=field, but this resulted in another error:

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_16960\559937113.py in <module>
----> 1 pheflux.getFluxes(inputFile,resultsDir,prefix_log_file,verbosity)

~\Downloads\mrivas-pheflux-368c01e\examples\pheflux.py in getFluxes(inputFileName, processDir, prefix_log, verbosity)
    413             print(atime, "Running pheflux...")
    414         k = 1000
--> 415         fluxes,optimization_time,total_time,status,success,lbx,ubx = optPheFlux(model,fpkmDic,k,init_time)
    416 
    417         ##############################################################

~\Downloads\mrivas-pheflux-368c01e\examples\pheflux.py in optPheFlux(model, fpkmDic, k, init_time)
    287     v,v_dic,lbx,ubx,f = setVariables(model,fpkmDic)
    288     sumVi = getSumV(v)
--> 289     ubg,lbg,g = createConstraints(model,k,v_dic,sumVi)
    290     print('')
    291     ##############################################################

~\Downloads\mrivas-pheflux-368c01e\examples\pheflux.py in createConstraints(model, k, v_dic, sumVi)
    269         ##########################################################
    270         ## Adds constraint to CasADI
--> 271         g = vertcat(g,tmp_constraint)
    272         lbg.append(0)
    273         ubg.append(0)

~\anaconda3\lib\site-packages\casadi\casadi.py in vertcat(*args)
    515     except:
    516         pass
--> 517     return _vertcat(args)
    518 def horzcat(*args):
    519     try:

~\anaconda3\lib\site-packages\casadi\casadi.py in _vertcat(*args)
  33771 
  33772     """
> 33773     return _casadi._vertcat(*args)
  33774 
  33775 def horzsplit(*args) -> "std::vector< casadi::Matrix< casadi::SXElem >,std::allocator< casadi::Matrix< casadi::SXElem > > >":

NotImplementedError: Wrong number or type of arguments for overloaded function '_vertcat'.
  Possible prototypes are:
    _vertcat([Sparsity])
    _vertcat([DM])
    _vertcat([SX])
    _vertcat([MX])
  You have: '((DM,str))'

This is probably due to my attempted fix, so I would appreciate any help in resolving this issue!

mrivas commented 5 months ago

Did the error occur using the tutorial data? If yes, could you please let me know the cobra version that you are using.