Hello,
I'm trying to use COBRApy to get samples of steady-state fluxes for a metabolic model. I've been using the most simple model I could come up with to try to understand how this works, so I've decided to reproduce the flux split found on figure 1A of this article:
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1304643/ (I'm attaching it here as well).
The code I'm using is as follows:
from cobra import Model, Reaction, Metabolite
model=Model('flux_split')
reaction1 = Reaction('V1')
reaction2 = Reaction('V2')
reaction3 = Reaction('V3')
reaction1.lower_bound = 0
reaction2.lower_bound = 0
reaction3.lower_bound = 0
reaction1.upper_bound = 6
reaction2.upper_bound = 8
reaction3.upper_bound = 10
A=Metabolite('A')
reaction1.add_metabolites({A:-1})
reaction2.add_metabolites({A:-1})
reaction3.add_metabolites({A:1})
model.add_reactions([reaction1])
model.add_reactions([reaction2])
model.add_reactions([reaction3])
Then, I've tried using the sampling commands in COBRApy, however I don't get the results I expected (many of the sample points I get are not in the null space of my stoichiometric matrix, and plotting the results I don't see the solution space that I'm supposed to get). I've done:
from cobra.flux_analysis import sample
s = sample(model, 100)
And I've also tried doing:
from cobra.flux_analysis.sampling import OptGPSampler, ACHRSampler
optgp = OptGPSampler(model, processes=3, thinning=1000)
optgp_samples = optgp.sample(1000)
optgp_samples = pd.DataFrame(optgp_samples, columns=[r.id for r in model.reactions])
import numpy as np
b=np.asmatrix(optgp_samples)
I'm attaching the plot I get from this last one here, so you can see the samples I get don't make sense (they should be evenly distributed and in only one plane, and also they don't match the solution space described in the paper).
I'll appreciate any help you can give me. I assume the way I'm building my model is probably wrong, but I've tried to do this in the simplest way possible and I just can't see what's wrong.
Thank you,
Pablo