geomscale / dingo Goto Github PK
View Code? Open in Web Editor NEWA python library for metabolic networks sampling and analysis
License: GNU Lesser General Public License v3.0
A python library for metabolic networks sampling and analysis
License: GNU Lesser General Public License v3.0
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
This a feature request for how dingo is handling and solving LPs. Now it is using lp-solve library by default and Gurobi solver optionally.
The interface can be more modern and modular if a package like optlang is used. Many different solvers can be then used through optlang's interface (such as cplex, gurobipy, scipy).
We tried to install dingo on MacBook Pro with M1 Max processor, running macOS Ventura 13.5.
Python version 3.11.4
We followed the installation steps adapted for the Mac.
brew install suite-sparse
poetry installation was successful.
curl -sSL https://install.python-poetry.org | python3 -
The errors were from the step poetry install
.
Describe the bug
The following piece of code
import unittest
import os
import scipy
import numpy as np
from dingo import MetabolicNetwork, PolytopeSampler
from dingo.gurobi_based_implementations import fast_inner_ball
current_directory = os.getcwd()
input_file_json = current_directory + "/ext_data/iAB_RBC_283.json"
model = MetabolicNetwork.from_json(input_file_json)
model.set_fast_mode()
sampler = PolytopeSampler(model)
sampler.set_fast_mode()
steady_states = sampler.generate_steady_states()
returns
File "tests/parallel.py", line 20, in <module>
model = MetabolicNetwork.from_json(input_file_json)
File "/home/workspace/dingo/dingo/MetabolicNetwork.py", line 74, in from_json
return cls(tuple_args)
File "/home/workspace/dingo/dingo/MetabolicNetwork.py", line 56, in __init__
or (self._biomass_index < 0)
TypeError: '<' not supported between instances of 'NoneType' and 'int'
iAB_RBC_283.json
is downloaded from http://bigg.ucsd.edu/
Desktop (please complete the following information):
Google Colab currently uses Python 3.10
, while the dingo
project requires Python 3.8
, making it difficult to install dingo
on Google Colab.
Dependence and installation:
dingo/tutorials/dingo_tutorial.ipynb
Lines 462 to 467 in e89128c
dingo/tutorials/dingo_tutorial.ipynb
Line 573 in e89128c
poetry
.Lines 60 to 62 in e89128c
Ignored lpsolve Library:
Lines 44 to 49 in e89128c
Metabolic models is common to be available in .mat
format.
At the moment dingo
is able to read a .mat
model once someone
run the matlab_model_wrapper.m
.
That makes MATLAB a pre-requisite for a number of cases.
It would benefit the dingo
library to support .mat
files without this step.
Should we rename this to objective function
?
This way when we are not using the biomass function as objective we will not have misunderstandings.
Make ellipsoid walks such as Dikin, John, Vaidya available to dingo
. Those methods are implemented in volesti
.
To address the challenges that come along with the metabolic network reconstruction process,
the metabolic modeling community has adopted the Systems Biology Markup Language (SBML)
to a great extent.
Therefore, most metabolic models are in a .xml
format and this is the reason that supporting
this format would benefit dingo
the most.
To this end, dingo
could make use of the libsbml
library via its Python interface.
I encountered difficulties setting up the Dingo project completely for the first time and discussed the issues on Gitter. After repeatedly configuring the entire project over the past few weeks, particularly while addressing issue #83, I am convinced that making minor modifications to the README file can greatly streamline the setup process, ultimately saving considerable time and effort for new users
Challenges Faced:
Proposed Change in instructions:
curl -sSL https://install.python-poetry.org | python3 - --version 1.3.2
sudo apt-get update -y
sudo apt-get install -y libsuitesparse-dev
Proposal for trial
For a quick and hassle-free Dingo project trial, consider using GitHub Codespaces. It provides an instant cloud-based development environment with limited free usage every month. Regardless of your operating system, you can set up and run experiments in under 10 minutes(depends on internet speed), thanks to its streamlined installation process. Additionally, consider utilizing another tab to include screenshots with installation steps and examples, which are mostly done.
model = dingo.MetabolicNetwork.from_json("ext_data/e_coli_core.json")
model.set_opt_percentage(90)
sampler = dingo.PolytopeSampler(model)
sampler.generate_steady_states()
model.set_opt_percentage(20)
sampler = dingo.PolytopeSampler(model)
sampler.generate_steady_states()
would return:
phase 1: number of correlated samples = 500, effective sample size = 3, ratio of the maximum singilar value over the minimum singular value = 4548.22
phase 2: number of correlated samples = 500, effective sample size = 123, ratio of the maximum singilar value over the minimum singular value = 3.07681
phase 3: number of correlated samples = 500, effective sample size = 148, ratio of the maximum singilar value over the minimum singular value = 2.8596
phase 4: number of correlated samples = 1900, effective sample size = 754
[5]total ess 1028: number of correlated samples = 3400
[5]maximum marginal PSRF: 1.03027
UnboundLocalError Traceback (most recent call last)
[/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/dev.ipynb](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/dev.ipynb) Cell 26 line 8
[6](vscode-notebook-cell:/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/dev.ipynb#X36sZmlsZQ%3D%3D?line=5) model.set_opt_percentage(20)
[7](vscode-notebook-cell:/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/dev.ipynb#X36sZmlsZQ%3D%3D?line=6) sampler = dingo.PolytopeSampler(model)
----> [8](vscode-notebook-cell:/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/dev.ipynb#X36sZmlsZQ%3D%3D?line=7) sampler.generate_steady_states()
File [~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:161](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:161), in PolytopeSampler.generate_steady_states(self, ess, psrf, parallel_mmcs, num_threads)
[149](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:149) def generate_steady_states(
[150](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:150) self, ess=1000, psrf=False, parallel_mmcs=False, num_threads=1
[151](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:151) ):
[152](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:152) """A member function to sample steady states.
[153](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:153)
[154](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:154) Keyword arguments:
(...)
[158](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:158) num_threads -- the number of threads to use for parallel mmcs
[159](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:159) """
--> [161](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:161) self.get_polytope()
[163](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:163) P = HPolytope(self._A, self._b)
[165](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:165) if self._parameters["fast_computations"]:
File [~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:82](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:82), in PolytopeSampler.get_polytope(self)
[66](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:66) """A member function to derive the corresponding full dimensional polytope
[67](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:67) and a isometric linear transformation that maps the latter to the initial space.
[68](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:68) """
[70](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:70) if (
[71](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:71) self._A == []
[72](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:72) or self._b == []
(...)
[76](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:76) or self._T_shift == []
[77](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:77) ):
[79](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:79) (
[80](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:80) max_biomass_flux_vector,
[81](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:81) max_biomass_objective,
---> [82](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:82) ) = self._metabolic_network.fba()
[84](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:84) if (
[85](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:85) self._parameters["fast_computations"]
[86](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:86) and self._parameters["remove_redundant_facets"]
[87](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:87) ):
[89](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:89) A, b, Aeq, beq = fast_remove_redundant_facets(
[90](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:90) self._metabolic_network.lb,
[91](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:91) self._metabolic_network.ub,
(...)
[94](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:94) self._parameters["opt_percentage"],
[95](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/PolytopeSampler.py:95) )
File [~/github_repos/GeomScale/dingo/dingo/MetabolicNetwork.py:117](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/MetabolicNetwork.py:117), in MetabolicNetwork.fba(self)
[114](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/MetabolicNetwork.py:114) """A member function to apply the FBA method on the metabolic network."""
[116](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/MetabolicNetwork.py:116) if self._parameters["fast_computations"]:
--> [117](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/MetabolicNetwork.py:117) return fast_fba(self._lb, self._ub, self._S, self._biomass_function)
[118](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/MetabolicNetwork.py:118) else:
[119](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/MetabolicNetwork.py:119) return slow_fba(self._lb, self._ub, self._S, self._biomass_function)
File [~/github_repos/GeomScale/dingo/dingo/gurobi_based_implementations.py:112](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/gurobi_based_implementations.py:112), in fast_fba(lb, ub, S, c)
[109](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/gurobi_based_implementations.py:109) v = model.getVars()
[111](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/gurobi_based_implementations.py:111) for i in range(n):
--> [112](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/gurobi_based_implementations.py:112) optimum_sol.append(v[i].x)
[114](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/gurobi_based_implementations.py:114) optimum_sol = np.asarray(optimum_sol)
[116](https://file+.vscode-resource.vscode-cdn.net/home/luna.kuleuven.be/u0156635/github_repos/GeomScale/dingo/~/github_repos/GeomScale/dingo/dingo/gurobi_based_implementations.py:116) return optimum_sol, optimum_value
UnboundLocalError: local variable 'v' referenced before assignment
It seems the error is related to the https://github.com/GeomScale/dingo/blob/aaae4ae63f432da45eb0f4363a92767ba537a074/dingo/gurobi_based_implementations.py#L109
and the status == GRB.OPTIMAL
that is not the case in the second edit.
where the status is INF_OR_UNBD
for some reason (https://www.gurobi.com/documentation/current/refman/optimization_status_codes.html)
Is your feature request related to a problem? Please describe.
I am slicing a polytope into orthants and need to approximate the volume of each orthant to correct a likelihood computed for flux samples drawn from each orthant.
Describe the solution you'd like
It would be massively helpful if dingo would include volume computation
The following piece of code
import unittest
import os
import scipy
import numpy as np
from dingo import MetabolicNetwork, PolytopeSampler
from dingo.gurobi_based_implementations import fast_inner_ball
current_directory = os.getcwd()
input_file_json = current_directory + "/ext_data/iAB_RBC_283.json"
model = MetabolicNetwork.from_json(input_file_json)
model.set_fast_mode()
sampler = PolytopeSampler(model)
sampler.set_fast_mode()
steady_states = sampler.generate_steady_states()
returns
File "tests/parallel.py", line 20, in <module>
model = MetabolicNetwork.from_json(input_file_json)
File "/home/workspace/dingo/dingo/MetabolicNetwork.py", line 74, in from_json
return cls(tuple_args)
File "/home/workspace/dingo/dingo/MetabolicNetwork.py", line 56, in __init__
or (self._biomass_index < 0)
TypeError: '<' not supported between instances of 'NoneType' and 'int'
iAB_RBC_283.json is downloaded from http://bigg.ucsd.edu/
Desktop:
OS: Ubuntu 20.04.2 LTS
python: Python 3.8.5 [GCC 9.3.0]
For a A
and b
numpy objects, the sample_from_polytope
function of dingo's PolytopeSampler
class
returns a NameError: name 'self' is not defined
.
Here is an example case that will lead you to this error:
from dingo import PolytopeSampler
import numpy as np
# Build a random A matrix and a b vecrtor to use them to build a polytope
A = np.random.random([32,21])
b = np.random.random([32,])
# Now, try to sample using the sample_from_polytope method of the PolytopeSampler class
samples = PolytopeSampler.sample_from_polytope(A,b)
And here is the full error message returned:
173 P = HPolytope(A, b)
174
--> 175 if self._parameters["fast_computations"]:
176 A, b, Tr, Tr_shift, samples = P.fast_mmcs(
177 ess, psrf, parallel_mmcs, num_threads
We probably need to add a check for gurobi as in line 52.
Describe the bug
When running the cell provided in the README of the "https://github.com/GeomScale/dingo" project on Google Colab, an error message appears stating that the name 'MetabolicNetwork' cannot be imported from 'dingo' at an unknown location.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The code should be able to import the MetabolicNetwork class from the dingo package without any errors.
Screenshots
N/A
Desktop (please complete the following information):
Additional context
I am working on task 1 for applying to GSoC on this project and I need assistance in resolving this issue so that I can complete my task.
The following code
import dingo
dingo_model = dingo.MetabolicNetwork.from_sbml("ext_data/e_coli_core.xml")
sampler = dingo.PolytopeSampler(dingo_model)
samples = sampler.generate_steady_states()
fva_output = dingo_model.fva()
returns an error
Traceback (most recent call last):
File "workspace/dingo_vfisikop/script.py", line 16, in <module>
fva_output = dingo_model.fva()
File "workspace/dingo_vfisikop/dingo/MetabolicNetwork.py", line 111, in fva
return fast_fva(
File "workspace/dingo_vfisikop/dingo/gurobi_based_implementations.py", line 162, in fast_fva
max_biomass_flux_vector, max_biomass_objective = fast_fba(lb, ub, S, c)
File "workspace/dingo_vfisikop/dingo/gurobi_based_implementations.py", line 112, in fast_fba
optimum_sol.append(v[i].x)
UnboundLocalError: local variable 'v' referenced before assignment
This is a feature request for volume computation (implemented in volesti) to be included in dingo.
Apart from being a fundamental computation there is resent motivation from the area of metabolic networks [1] where they compute the volume of a V-polytope (a polytope given as the convex hull of its vertices). There are also computations of the intersection and union of V-polytopes.
[1] Régimbeau et al. - Contribution of genome-scale metabolic modelling to niche theory
In some cases, when asking for a rather low ESS, (<10) dingo
returns segmentation fault.
Modify both MetabolicNetwork and PolytopeSampler classes to change the bounds of the medium reactions
Starting from here https://github.com/GeomScale/dingo/blob/develop/dingo/MetabolicNetwork.py#L226 it seems that there is a number of methods that are not used anywhere in the code:
Is this intentional? Should we remove them or they are going to be used in the future?
Up to now, dingo
supports sampling using the uniform, the
multivariate exponential and the multivariate Gaussian distributions.
A quite interesting addition from the biologist-point-of-view would be
to enable sampling using the maximum entropy probability distribution.
You may see more about why this would be the case under this study.
"In addition to accounting for fluctuations, the maximum entropy construction provides a principled interpolation between two extremal regimes of metabolic network function. In the “uniform” (no-optimization) limit, no control is exerted over metabolic fluxes: they are selected at random as long as they are permitted by stoichiometry, resulting in broad yet non-trivial flux distributions that support a small, non-zero growth rate. In
the FBA limit, fluxes are controlled precisely to maximize the growth rate, with zero fluctuations. "
For more about max entropy distribution:
https://journals.aps.org/pr/abstract/10.1103/PhysRev.106.620
Add code coverage for dingo
.
One could use codecov https://about.codecov.io
dingo
currently has a limited number of examples of use, mainly in tests
.
Create an example
directory and add analysis for networks from public datasets e.g. http://bigg.ucsd.edu
Other use cases using FVA, FBA or sampling for metabolic models are welcome to be added there too.
Proposed roadmap (from @hariszaf in #18):
Some models might have a suffix of .sbml
and not .xml
Add this option in the read_sbml_model()
function.
Add a detailed description of how other developers can contribute to dingo
.
Example: https://github.com/GeomScale/volume_approximation/blob/develop/CONTRIBUTING.md
In dynamic FBA (dFBA) [doi: 10.1016/S0006-3495(02)73903-9] we have an issue when going from a step to the next regarding the non uniqueness of the FBA solutions. In the DFBAlab approach they address this challenge using lexicographic LP [doi: 10.1186/s12859-014-0409-8].
In dingo
we could give it a shot for a dFBA module where the non-uniqueness challenge would be addressed by sampling at each cycle and select/pick the sample that is closest to the flux distribution of the previous one.
The boundaries and the biomass are then updated as in all the dFBA implementations.
For the first cycle, we could get the mean of the flux samples.
You may also have a look at the COMETS papers for applications and alternative implementations of the dFBA
Describe the bug
The following code:
import unittest
import os
import scipy
import numpy as np
from dingo import MetabolicNetwork, PolytopeSampler
from dingo.gurobi_based_implementations import fast_inner_ball
current_directory = os.getcwd()
input_file_json = current_directory + "/ext_data/iSB619.json"
model = MetabolicNetwork.from_json(input_file_json)
model.set_fast_mode()
sampler = PolytopeSampler(model)
sampler.set_fast_mode()
steady_states = sampler.generate_steady_states()
returns
The radius calculated has negative value. The polytope is infeasible or something went wrong with the solver
Traceback (most recent call last):
File "tests/parallel.py", line 27, in <module>
steady_states = sampler.generate_steady_states()
File "/home/vissarion/workspace/dingo/dingo/PolytopeSampler.py", line 136, in generate_steady_states
self._A, self._b, Tr, Tr_shift, samples = P.fast_mmcs(
File "dingo/volestipy.pyx", line 219, in volestipy.HPolytope.fast_mmcs
temp_center, radius = fast_inner_ball(self._A, self._b)
TypeError: 'NoneType' object is not iterable
Desktop:
OS: Ubuntu 20.04.2 LTS
python: Python 3.8.5 [GCC 9.3.0]
The following piece of code
import unittest
import os
import scipy
import numpy as np
from dingo import MetabolicNetwork, PolytopeSampler
from dingo.gurobi_based_implementations import fast_inner_ball
current_directory = os.getcwd()
input_file_json = current_directory + "/ext_data/iLJ478.json"
model = MetabolicNetwork.from_json(input_file_json)
model.set_fast_mode()
sampler = PolytopeSampler(model)
sampler.set_fast_mode()
steady_states = sampler.generate_steady_states()
returns
phase 1: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 4470.89
phase 2: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 2341.2
phase 3: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 2240.94
phase 4: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 738.163
phase 5: number of correlated samples = 1200, effective sample size = 9, ratio of the maximum singilar value over the minimum singular value = 30.622
phase 6: number of correlated samples = 1200, effective sample size = 38, ratio of the maximum singilar value over the minimum singular value = 17.2763
phase 7: number of correlated samples = 1200, effective sample size = 277, ratio of the maximum singilar value over the minimum singular value = 3.276
phase 8: number of correlated samples = 1200, effective sample size = 7, ratio of the maximum singilar value over the minimum singular value = 27.1693
phase 9: number of correlated samples = 1200, effective sample size = 9, ratio of the maximum singilar value over the minimum singular value = 612.636
phase 10: number of correlated samples = 1200, effective sample size = 9, ratio of the maximum singilar value over the minimum singular value = 8242.79
phase 11: number of correlated samples = 1200, effective sample size = 9, ratio of the maximum singilar value over the minimum singular value = 3117.12
phase 12: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 28234.6
phase 13: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 6980.29
Segmentation fault (core dumped)
iLJ478.json is downloaded from http://bigg.ucsd.edu/
Desktop:
OS: Ubuntu 20.04.2 LTS
python: Python 3.8.5 [GCC 9.3.0]
The test file sampling.py
is not included in the github actions.
However, when I added it fails.
To model a community, we will need to track down the reactions and their corresponding metabolites, that
take place in the extracellular space.
It is my belief that it would benefit our efforts the most, to use models in the Systems Biology Markup Language (SBML)
format to this end.
This means both to implement a function for reading such files (the libSBML library will probably be of help for this, but also
to add an attribute in our model, e.g. model.extracellular
to keep track of these metabolites.
@TolisChal @vissarion what 's your thoughts?
The mmcs (sampling + rounding) algorithm is mainly implemented in the bindings of dingo (mainly in https://github.com/GeomScale/dingo/blob/develop/dingo/bindings/bindings.cpp#L207)
A more natural way it to be implemented in volesti and imported in dingo with a binding function. Alternatively it could be another sampling method that can be called by apply_sampling
https://github.com/GeomScale/dingo/blob/develop/dingo/bindings/bindings.cpp#L86
One might need to sample using not a fixed value for the objective function but asking its value to be at least or at the most
It would be really useful for the flux sampling function to provide this option.
Thermodynamics constraints are rather important in metabolic modeling.
If not considered, they would lead to thermodynamically infeasible/implausible flux loops within flux sample.
Loopless space though is a non-convex one.
Approaches such as the LooplessFluxSampler
could be used for more valid sampling from the biological point of view.
Further literature:
To avoid installation issues among operating issues, consider coming up with a Docker image for dingo
.
There is a Docker Image of gurobi that could probably be used as the base-image.
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.