euba / BacArena

agent based modelling
GNU General Public License v3.0
25 stars 10 forks source link

Organisms will not utilize substrates #183

Open wtscott31 opened 1 year ago

wtscott31 commented 1 year ago

Hi all,

I have been experiencing a peculiar problem with my genome-scale reconstructions being unable to take up any substrates/metabolites or excrete any products/metabolites. I provide a mineral medium plus glucose, yet nothing seems to work to get my model microorganisms to use the supplied metabolites. Therefore, the microbes die after a few iterations. Has anyone else experienced this using BacArena? How can I solve this issue?

maringos commented 1 year ago

Hi,

may I ask for providing us with a minimal example? Are you sure that the exchange reactions and not the names of the metabolites are used in the addSubs function?

Best, Yorgos

mixiaoluo88 commented 2 months ago

Hi, I've been in a simmilar situation.

I want to simulate the metabolic model of multiple strains to determine how competitive these bacteria are.

here is my script, with the substance used LB medium. (I put the file in the attachment): LB_medium.txt

simulateMultiGrowth <- function(modelPaths,allmodels, simulationTime, n, m, substances){
  library(BacArena)
  library(sybil)
  SYBIL_SETTINGS("SOLVER","cplexAPI") 

  arena <- Arena(n=n, m=m)

  for (models in allmodels) {
    sbml_model <- readRDS(file.path(modelPaths,models))  
    bac <- Bac(sbml_model)   
    arena <- addOrg(arena, bac, amount=5) 
  }

  # add substances
  for (sub in substances) {
    arena <- addSubs(arena, smax=1, mediac=paste0('EX_',sub,'_e0'), unit="mM")
  }
  # addSubs(arena, smax=100, mediac=c("EX_pi(e)", "EX_h2o(e)", "EX_o2(e)", "EX_nh4(e)"), unit="mM")

  # start sim
  eval <- simEnv(arena, time=simulationTime)

  growthPlot <- plotCurves2(eval, legendpos="right")
  # plot 
  pdf('spatial_time_curve.pdf')
  par(mfrow=c(2,2))
  evalArena(eval, show_legend = TRUE, time=seq(1,10,2))
  dev.off()

  png(paste(bac@type, "GrowthCurve.png", sep="_"), width=800, height=600)
  print(growthPlot)
  dev.off()

  return(list(results,plots=c("GrowthCurve.png", "SubstrateConsumption.png")))
}

No matter how many times I run it, the results always tell me: Rplots.pdf

[1] "All organisms died!"
[1] "All substances have variance of zero."
$rect
$rect$w
[1] 2.824062

$rect$h
[1] 1.75814

$rect$left
[1] 8.575938

$rect$top
[1] 3.37907

$text
$text$x
 [1] 9.127188 9.127188 9.127188 9.127188 9.127188 9.127188 9.127188 9.127188
 [9] 9.127188 9.127188 9.127188

$text$y
 [1] 3.232558 3.086047 2.939535 2.793023 2.646512 2.500000 2.353488 2.206977
 [9] 2.060465 1.913953 1.767442

I look forward to hearing from you, hongyang lvy