Giter Club home page Giter Club logo

mambo's People

Contributors

danielriosgarza avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

mambo's Issues

IndexError: list index out of range

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”

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)

Objective value from optimizing individual model changed

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.

report "No Solution" using simulation data

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.

Some problems about the script

When I tried to use the script, I met many problems.

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

line 26, I think 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

line 112, I guess this problem may be caused by line 32 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'

When I use the newest "cobra", line 115 shows no 'solution' object. So I change "list_of_models[i].solution.f" to "list_of_models[i].optimize().objective_value". Is it right ??

The example listed 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 don't know how to use the script to compelet a whole anaysis(for example, I have 16s taxa abundance for several samples, but I don't know how to deal with it to be used in the script), would you mind supplying some usage supplement

How can I link the metabolic models to the SILVA ribosomal RNA database?

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!

TypeError: argument of type 'Reaction' is not iterable

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?

TypeError: argument of type 'Reaction' is not iterable

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“

ValueError: operands could not be broadcast together with shapes (17,) (16,32)

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) ”

Install error

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 not install the package

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

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.