Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optlang error in optimization #21

Open
jotech opened this issue Mar 29, 2019 · 5 comments
Open

optlang error in optimization #21

jotech opened this issue Mar 29, 2019 · 5 comments

Comments

@jotech
Copy link

jotech commented Mar 29, 2019

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

@jotech
Copy link
Author

jotech commented Apr 10, 2019

@arabidopsis @Midnighter sorry for pushing this again but I really can't get it run. I tried different python versions (2.7,3.6,3.7), solvers (gurobi,cplex) and systems (debian, centos) and I'm stuck...
Could you maybe just have a look if my code above makes sense or do you have another minimal example which is working for you?
This would be amazing! I really appreciate any help :)

@Midnighter
Copy link
Member

I'm a bit hesitant to step in here because we're not officially supporting this package yet. There's a lot of work to do, we haven't released anything yet, so it's a mixed bag of really old code and some newer code that hasn't been glued together.

@jotech
Copy link
Author

jotech commented Apr 14, 2019

hi @Midnighter thanks for your answer! But are there plans to continue this project? Would be really great to have some python code for creating tissue-specific models!

@Midnighter
Copy link
Member

Yes, we do want to pick up work on this again. For starters we will focus on diversifying data types, i.e., better support for fluxomics, metabolomics. Even though tissue-specific models are not our speciality, we do want to make transcriptomics and proteomics more useful so there will naturally be some overlap in methods. Timeline-wise you might see something appearing as soon as July.

@Midnighter
Copy link
Member

Btw, you should also look around at https://opencobra.github.io/cobrapy/packages/ you might find a fit for your use-case there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants