danielriosgarza / mambo Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
Is the input file an sbml file? Should multiple sbml files be merged into one file? I opened the modelsaa file given by MAMBO and found it was garbled.
Hello, I encountered this problem in operation. How should I solve it?
“File "3_6YB_SSL.py", line 23, in
bte.single_MCMC_run(np.random.random_integers(0, len(metabs)), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i)
File "bottom_up_ecology.pyx", line 104, in bottom_up_ecology.single_MCMC_run (bottom_up_ecology.c:2898)
cdef str target_metabolite = list_of_metabolites[rdn]
IndexError: list index out of range”
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "bottom_up_ecology.pyx", line 104, in bottom_up_ecology.single_MCMC_run
IndexError: list index out of range
Have you run into this before? I am trying to run the following:
for i in xrange(100000):
print(i)
bte.single_MCMC_run(numpy.random.random_integers(0, len(metabs)), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i)
I found that the value from
list_of_models[i].optimize().objective_value
sometimes changed, when re-evaluating the model after restoring the previous growth media with
set_growth_media(list_of_models[i], current_value)
If I add some code to re-compute it and compare (by subtraction) with z_on_current_media[i]
in the single_MCMC_run() method of bottom_up_ecology.pyx, sometimes I see a difference as much as 0.02. Although most of the time the difference is either zero or around 1e-15. When there is a change, it can throw off the re-computed Pearson correlation coefficient.
Have you run into this before? Could this be because the optimize() method doesn't always return the same value? I'm currently setting model.solver to "glpk", and I am considering switching to CPLEX. Also I'm using cobrapy 0.14.1.
Thanks.
import os
import cobra
import numpy
import bottom_up_ecology as bte
#####read 1500 models from models provided by MAMBO
n=1500
models=[cobra.io.read_sbml_model('models' + '/' + os.listdir('models')[i]) for i in range(n)]
for i in range(n):
models[i].solver='glpk'
evolution_of_exchange_reactions = {}
initial_environment = bte.starting_environment(models)
metabs = initial_environment.keys()
abundance=numpy.random.random(n)
relative_abundance=numpy.divide(abundance,abundance.sum())
for i in xrange(10):
print(i)
bte.single_MCMC_run(numpy.random.random_integers(0, len(metabs)), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i)
0
No solution!!!
1
No solution!!!
2
No solution!!!
3
No solution!!!
4
No solution!!!
5
No solution!!!
6
No solution!!!
7
No solution!!!
8
No solution!!!
9
No solution!!!
Is it normal? Thanks.
Traceback (most recent call last):
File "python.py", line 15, in
initial_environment = pyx.starting_environment(models)
File "bottom_up_ecology.pyx", line 26, in bottom_up_ecology.pyx.starting_environment
if (e in reacts and ex in reacts): #identify exchange reactions (if you removed reactions by setting fluxes to zero, then you should add this condition here)
TypeError: argument of type 'Reaction' is not iterable
if (e in reacts and ex in reacts):
should change to if (e in reacts.id and ex in reacts.id):
Traceback (most recent call last):
File "python.py", line 31, in
pyx.single_MCMC_run(numpy.random.random_integers(0, len(metabs)-1), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i)
File "bottom_up_ecology.pyx", line 112, in bottom_up_ecology.pyx.single_MCMC_run
new_value = (target_metabolite, current_media[target_metabolite]+numpy.random.uniform(low=-2, high=2)) #small random value change to the reaction.
TypeError: can only concatenate tuple (not "float") to tuple
starting_reaction_dic[reacts]= (1000.0, -1*numpy.random.uniform ())
. When I change it to starting_reaction_dic[reacts]= -1*numpy.random.uniform ()
, it works. But I don't know should I change it ??Traceback (most recent call last):
File "python.py", line 31, in
pyx.single_MCMC_run(numpy.random.random_integers(0, len(metabs)-1), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i)
File "bottom_up_ecology.pyx", line 115, in bottom_up_ecology.pyx.single_MCMC_run
z_on_current_media[i] = list_of_models[i].solution.f #collating the array with current objective values.
AttributeError: 'Model' object has no attribute 'solution'
bte.single_MCMC_run(numpy.random.random_integers(0, len(metabs), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i)
has problem, it should be changed to bte.single_MCMC_run(numpy.random.random_integers(0, len(metabs)-1), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i)
.I'd like to link the MAMBO models to their "nearest" SILVA database entries. I've started looking at the models using the python version of libsbml and reading the id field, using getId(). I get back values like "kb_g_2146_fbamdl2" for Prevotella_33.xml. Ideally, I could get back SILVA accession numbers. What do you think is the best way to map back to SILVA database entries?
Thanks in advance!
import os
import cobra
import numpy
import bottom_up_ecology as bte
n=10
models = [cobra.io.read_sbml_model('models' + '/' + os.listdir('models')[i]) for i in range(n)]
for i in range(n):
models[i].solver = 'glpk'
initial_environment = bte.starting_environment(models)
if(e in reacts and ex in reacts): #identify exchange reactions (if you removed reactions by setting fluxes to zero, then you should add this condition here)
TypeError: argument of type 'Reaction' is not iterable
I am not sure what I've done wrong here, anyone know the fix?
Hello, I got Pearson correlation after running MAMBO algorithm. How can I predict the metabolite concentration according to Pearson correlation?
I encountered such an error in the process of operation. Why?
”File "bottom_up_ecology.pyx", line 26, in bottom_up_ecology.starting_environment
if (e in reacts and ex in reacts): #identify exchange reactions (if you removed reactions by setting fluxes to zero, then you should add this condition here)
TypeError: argument of type 'Reaction' is not iterable“
Hello, I made the following mistakes in operation. How should I solve them? I have 17 models and 17 groups of corresponding relative abundance.
“File "/public1/home/scb2742/.conda/envs/mambo27/lib/python2.7/site-packages/scipy/stats/stats.py", line 2973, in pearsonr
r_num = np.add.reduce(xm * ym)
ValueError: operands could not be broadcast together with shapes (17,) (16,32) ”
python setup_bte_functions.py build_ext --inplace
running build_ext
skipping 'bottom_up_ecology.c' Cython extension (up-to-date)
building 'bottom_up_ecology.pyx' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/yejunbin/python2.7/local/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c bottom_up_ecology.c -o build/temp.linux-x86_64-2.7/bottom_up_ecology.o
In file included from /home/yejunbin/python2.7/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1777:0,
from /home/yejunbin/python2.7/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /home/yejunbin/python2.7/local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from bottom_up_ecology.c:566:
/home/yejunbin/python2.7/local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
creating /home/yejunbin/software/MAMBO/bottom_up_ecology
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/bottom_up_ecology.o -o /home/yejunbin/software/MAMBO/bottom_up_ecology/pyx.so
Cannot import bottom_up_ecology
Can I use these data in my mouse data?
If not, how to generate mouse-associated bacteria?
Many thanks
I git clone MAMBO and install it through " python setup_bte_functions.py install", here is the log info:
running install
running build
running build_ext
skipping 'bottom_up_ecology.c' Cython extension (up-to-date)
running install_lib
creating /home/ye/python2.7/lib/python2.7/site-packages/bottom_up_ecology
copying build/lib.linux-x86_64-2.7/bottom_up_ecology/pyx.so -> /home/yejunbin/python2.7/lib/python2.7/site-packages/bottom_up_ecology
running install_egg_info
Removing /home/ye/python2.7/lib/python2.7/site-packages/UNKNOWN-0.0.0-py2.7.egg-info
Writing /home/ye/python2.7/lib/python2.7/site-packages/UNKNOWN-0.0.0-py2.7.egg-info
import bottom_up_ecology
ImportError: No module named bottom_up_ecology
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.