Code Monkey home page Code Monkey logo

driven's People

Contributors

hredestig avatar sgalkina avatar the-code-magician avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

driven's Issues

Solver status turning infeasible when trying to optimize

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:

  1. a cobra model;
  2. an expression profile obtained from the class ExpressionProfile with the model gene names as lines and conditions as columns;
  3. a dictionary of medium metabolites. Metabolites names' matches the ones in the model.

I have already tried a less complex model, expression profile and fewer metabolites.

I uploaded a zip with 3 files:

  • info : a pickle file that contains 3 variables, the metabolomic data, and two expression profiles (the first one is the complete data and the second matches the first 200 entries);
  • iML1515: the model;
  • test.py : a simple python script that allows to reproduce the error. The model and info files should be in the directory. Pickle and cobra should be python packages in the environment aswell as the latest driven version (matched the devel branch on github).

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.

integrating_omics.zip

TypeError in expression_profile.py

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

Can't import ExpressionProfile

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 ?

optlang error in optimization

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)

Complete error log

as per 2021 driven setup is not working

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.