cdanielmachado / carveme

CarveMe: genome-scale metabolic model reconstruction
Other
151 stars 52 forks source link

Problems gapfilling with CPLEX and Gurobi #185

Closed Brunokemon closed 1 year ago

Brunokemon commented 1 year ago

Hi! Wonderful tool you guys created. Really nice!

I just had this recent problem when I tried gapfilling the AGORA2 sbml models for the medium M9.

I tried running the following command

$ carve  bacteria.faa --gapfill M9 --mediadb media.tsv --universe-file bacteria.xml

Traceback (most recent call last): File ".local/bin/carve", line 8, in sys.exit(main()) File ".local/bin/carveme/cli/carve.py", line 357, in main maincall( File ".local/bin/carveme/cli/carve.py", line 204, in maincall model = carve_model(universe_model, scores, inplace=(not gapfill), default_score=default_score, File ".local/bin/carveme/reconstruction/carving.py", line 231, in carve_model sol = minmax_reduction(model, scores, default_score=default_score, uptake_score=uptake_score, soft_score=soft_score, File ".local/bin/carveme/reconstruction/carving.py", line 121, in minmax_reduction solver.update() File ".local/bin/reframed/solvers/cplex_solver.py", line 216, in update self.add_constraints(constr_ids, lhs, senses, rhs) File ".local/bin/reframed/solvers/cplex_solver.py", line 141, in add_constraints self.problem.linear_constraints.add(lin_expr=exprs, File "/CPLEX/cplex/python/3.10/x86-64_linux/cplex/_internal/_subinterfaces.py", line 1273, in add return self._add_iter(self.get_num, self._add, File "/CPLEX/cplex/python/3.10/x86-64_linux/cplex/_internal/_baseinterface.py", line 41, in _add_iter addfun(*args, **kwargs) File "/CPLEX/cplex/python/3.10/x86-64_linux/cplex/_internal/_subinterfaces.py", line 1199, in _add with CPX_PROC.chbmatrix(lin_expr, self._cplex._env_lp_ptr, File "/usr/lib64/python3.10/contextlib.py", line 135, in enter return next(self.gen) File "/CPLEX/cplex/python/3.10/x86-64_linux/cplex/_internal/_procedural.py", line 168, in chbmatrix mat = Pylolmat_to_CHBmat(lolmat, env_lp_ptr, r_c) File "/CPLEX/cplex/python/3.10/x86-64_linux/cplex/_internal/_procedural.py", line 177, in Pylolmat_to_CHBmat return CR.Pylolmat_to_CHBmat(lolmat, env_lp_ptr, r_c) File "/CPLEX/cplex/python/3.10/x86-64_linux/cplex/_internal/_pycplex.py", line 1632, in Pylolmat_to_CHBmat return _pycplex_platform.Pylolmat_to_CHBmat(lolmat, env_lp_ptr, py_row_col) ValueError: 1210: Invalid name -- 'R_ATPM'

This error seems to be this one in CPLEX but I'm not sure how to solve it.

So I tried switching from CPLEX to Gurobi adding --solver gurobi to see if works.

$ carve  bacteria.faa --solver gurobi --gapfill M9 --mediadb media.tsv --universe-file bacteria.xml

Traceback (most recent call last): File ".local/bin/carve", line 8, in sys.exit(main()) File ".local/bin/carveme/cli/carve.py", line 349, in main set_default_solver(args.solver) File ".local/bin/reframed/solvers/init.py", line 82, in set_default_solver raise RuntimeError(f"Solver {solvername} not available.") RuntimeError: Solver gurobi not available.

I tried doing as suggested in issue 181 to no avail, then I tried updating the reframed solvers folder from the github repo but to no avail too. I checked and Gurobi and gurobipy are working fine.

So I'm not sure what to try now, which is the reason for me to be seeking your help now with this. Thanks in advance.

cdanielmachado commented 1 year ago

Why are you adding this option: --universe-file bacteria.xml ?

Brunokemon commented 1 year ago

That is the AGORA2 sbml model. I thought that would set the model as basis for the gapfilling. Is it wrong? Should it be done in another way?

cdanielmachado commented 1 year ago

Yep. For gapfilling you should use the gapfill command instead 🙂

Brunokemon commented 1 year ago

Strangely enough the first time I tried using gapfill it didn't work, but now I tried again and it worked. Must've been something I did wrong the first time :sweat:. Thank you for your help! :grin: