opencobra / driven Goto Github PK
View Code? Open in Web Editor NEWData-Driven Constraint-based analysis
Home Page: http://biosustain.github.io/driven/
License: Apache License 2.0
Data-Driven Constraint-based analysis
Home Page: http://biosustain.github.io/driven/
License: Apache License 2.0
I'm getting an error when trying to compute a condition-specific model by driven.imat
.
It seems to be an issue with optlang:
AssertionError Traceback (most recent call last)
/usr/lib/python3/dist-packages/optlang/expression_parsing.py in _parse_quadratic_expression(expression, expanded)
128 term = 1.0 * term
--> 129 assert term.is_Mul, "What is this? {}".format(type(term))
130 factors = term.args
AssertionError: What is this? <class 'optlang.gurobi_interface.Variable'>
A small example with random expression data to reproduce the problem:
import cobra.test
from numpy.random import random
from numpy import array
from numpy import percentile
import driven
model = cobra.test.create_test_model("textbook")
identifiers = [g.id for g in model.genes]
conditions = ["test"]
expression = array([random(len(identifiers)) * 100]).transpose()
expression.shape == (len(identifiers), len(conditions))
exprof = driven.ExpressionProfile(identifiers, conditions, expression)
low_cutoff = percentile(expression, 25)
high_cutoff = percentile(expression, 75)
model.solver = "gurobi" # cplex
model_cond = driven.imat(model, exprof, (low_cutoff, high_cutoff), condition="test")
Although this error occurs with gurobi and cplex set as solver, it works fine with glpk (in reasonable time only for smaller models).
I tried python 2 and 3. The optlang package is the latest version (1.4.4)
I am trying to integrate both transcriptomic and metabolomic data into an E.coli model (Escherichia coli str. K-12 substr. MG1655, model iML1515). However, when using gim3e function, the solver becomes infeasible after the first slim_optimize, the one to obtain the penalty_bound_constraint.
I have changed the solver to cplex and the error that i get is:
cplex.exceptions.errors.CplexSolverError: CPLEX Error 1225: Numeric entry is not a double precision number (NaN).
This error comes from this line (144 if not mistaken):
model.objective = objective
However the origin of the error comes from:
# Penalty bound constraint
penalty_obj = model.slim_optimize()
When trying to optimize the model after resetting the objective function, the solver status changes to infeasible, making variable penalty_obj equal to nan and so the constraint that is built after gets this value as an upper_bound.
My inputs are the ones requested:
I have already tried a less complex model, expression profile and fewer metabolites.
I uploaded a zip with 3 files:
Notes: Cplex solver was used but if the attempt to reproduce is done with glpk the infeasible error still happens. The python version was 3.8.5.
from driven import ExpressionProfile
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name ExpressionProfile
Got the same thing in both python 2.7 and 3.5.3
is there any alternative to load expression data without ExpressionProfile
?
I tried to install driven but I see the current version of its dependencies and the changes that came along with them broke the installation.
The error I am getting is related to cameo dependency:
Traceback (most recent call last):
File "d:\Coding\Repositories\Rejuvenatebiomed\Jupyter\cobrapy\iMAT.py", line 1, in <module>
from driven.flux_analysis.transcriptomics import gimme, imat
File "C:\Python39\lib\site-packages\driven\flux_analysis\transcriptomics.py", line 22, in <module>
from cameo.core.solver_based_model import SolverBasedModel
ModuleNotFoundError: No module named 'cameo.core.solver_based_model'
This is because, in the current release of cameo, there's no such thing as cameo.core.solver_based,
Since this could represent an issue with other dependencies as well, could you provide all the right / tested version of the dependencies with which you tested driven (a list with the versions or, ideally, a docker image)
Thank you,
Roland
I encountered an error when calling the imat function:
imat(recon, exprof, (0, 30), condition="cond1")
[...]
TypeError: Call constructor takes at most 3 positional arguments
I can track it down to a sympy call by parse_expr
:
./driven/data_sets/expression_profile.py in _map_gene_to_rxn(self, reaction, gene_values, by)
333 rule = reaction.gene_reaction_rule.replace("and", "*").replace("or",
334 "+")
--> 335 expression = parse_expr(rule, local_dict)
336 if by == "or2max_and2min":
337 expression = expression.replace(Mul, Min).replace(Add, Max)
A minimal example to reproduce the error would be:
from sympy import Symbol
from sympy.parsing.ast_parser import parse_expr
local_dict = {'5161.0': 5161.0,
'1738.0': 1738.0,
'5160.0': 5160.0,
'1737.0': 1737.0,
'5162.0': 5162.0,
'8050.0': 8050.0}
rule = '(1738.0 * 8050.0) * (5161.0 * 5162.0) * (1737.0) + (1738.0 * 8050.0) * (5160.0 * 5162.0) * (1737.0)'
expression = parse_expr(rule, local_dict)
[...]
TypeError: Call constructor takes at most 3 positional arguments
Do you have any clue what's going on here?
extended log file
python 3.7.2+
sympy 1.3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.