microPopModel {microPop} | R Documentation |
Runs the microbial population model
Description
creates a system of ordinary differential equations and solves them
Usage
microPopModel(
microbeNames,
times,
resourceSysInfo,
microbeSysInfo,
rateFuncs = rateFuncsDefault,
odeFunc = derivsDefault,
numStrains = 1,
oneStrainRandomParams = FALSE,
pHLimit = FALSE,
pHVal = NA,
plotOptions = list(),
odeOptions = list(),
strainOptions = list(),
checkingOptions = list(),
microbeMolarMass = 113,
bacCutOff = 1e-14,
networkAnalysis = FALSE,
myPars = NULL,
...
)
Arguments
microbeNames |
Vector of strings which contains the names of the microbial groups in the system e.g. c('Bacteroides','Acetogens'). A dataframe for each of the same name must also exist in the workspace. |
times |
Vector of times at which the solution is required, e.g. seq(0,10,0.1) |
resourceSysInfo |
String giving the name of a csv file or a dataframe object, which describes the initial conditions, inflow and outflow (if constant) and molar mass of each resource. See help(resourceSysInfo) for more info. |
microbeSysInfo |
String giving the name of a csv file (e.g. 'systemInfoMicrobes.csv') or a dataframe object, which describes the initial conditions, inflow and outflow (if constant) of each microbial group. See help(microbeSysInfo) for more info. |
rateFuncs |
A list of functions which are used to solve the ODEs in odeFunc. Default is rateFuncsDefault.R (provided in the package). See ?rateFuncs |
odeFunc |
The function the ODE solver will use - the default is derivsDefault provided by the package but if the user wants to make significant changes a new ODE function file can be used. See ?derivsDefault |
numStrains |
Integer (or named vector of integers) stating the number of strains in each microbial group. If this is a single number it is the same for all groups. If it is a vector it must be named using microbeNames. Default is 1. |
oneStrainRandomParams |
Logical to allow randomization of parameters even if there is only one strain. The default is FALSE which means that if numStrains=1 then the group params are used; if numStrains>1 then the parameters are automatically randomised according to info given in strainOptions. If oneStrainRandomParams=TRUE then even if there is only one strain its parameters will be randomised according to info given in strainOptions. |
pHLimit |
TRUE if pH limits microbial growth rates. Default is FALSE. If TRUE then rateFuncs$pHLimFunc is called. |
pHVal |
Scalar. If the pH value is fixed it can be specified here and this is then used in the default rateFuncs$pHFunc function. |
plotOptions |
List containing instructions for plotting: Default is list(plotFig=TRUE, sumOverStrains=FALSE, resourceLegendPosition="topleft", microbeLegendPosition="topleft", saveFig=FALSE, figType='eps', figName='microPopFig', yLabel='Concentration (g/L)', xLabel='Time'). |
odeOptions |
List containing instructions for the ODE solver ('deSolve'). Default: list('atol'=1e-6,'rtol'=1e-6,'method'='lsoda'). See ?ode for more details. |
strainOptions |
List containing instructions for specifying strain parameters. Default: list(randomParams=c('halfSat', 'yield', 'maxGrowthRate', 'pHtrait'), seed=1, distribution='uniform', percentTraitRange=0, maxPHshift=0, applyTradeOffs=FALSE, tradeOffParams=NULL, paramsSpecified=FALSE, paramDataName=NULL).
|
checkingOptions |
(List) Default is list(checkMassConv=FALSE, balanceTol=1e-2, reBalanceStoichiom=FALSE, stoiTol=0.1, checkForNegs=TRUE, negTol=-1e-2).
|
microbeMolarMass |
Scalar. Mass of 1 mole of microbes - default is 113g/mol (Batstone et al., 2002) |
bacCutOff |
Scalar. Amount of bacteria below which the bacteria are considered to have left the system and can't grow, default =1e-14. If this is set to zero then bacteria will always be able to grow again as zero is never reached. |
networkAnalysis |
Logical. If you want to use the network analysis functions on your model results set as TRUE (default is FALSE) |
myPars |
List containing extra parameter values - used if gutModel is TRUE i.e. with microPopGut package |
... |
Add your own input arguments |
Value
The output is a list containing a matrix called 'solution' where rows are points in time and the columns are the state variables, and another list called parms which contains all the information needed to run the model. Within parms there are a number of other lists (e.g. Pmats for parameter values and Smats for system settings etc - try names(out$parms)).
Examples
#simplest example - define one microbial group (Archea) with 4 resources and
#simulate growth over 50 days
#make microbial group data frame:
MFG=matrix(NA,ncol=4,nrow=6,dimnames=list(c('Rtype','halfSat','yield',
'maxGrowthRate','stoichiom','keyResource'),c('H2','CO2','CH4','H2O')))
MFG['Rtype',]=c('Se','Se','P','P')
MFG['halfSat',c('H2','CO2')]=1e-6
MFG['yield','H2']=0.2
MFG['maxGrowthRate','H2']=2
MFG['keyResource',1]='H2'
MFG['stoichiom',]=c(4,1,1,2)
Archea=data.frame(MFG,stringsAsFactors=FALSE)
#make resourceSysInfo data frame
Rmat=matrix(NA,ncol=4,nrow=4,dimnames=list(c('startValue','inflowRate',
'washOut','molarMass'),c('H2','CO2','CH4','H2O')))
Rmat['startValue',]=c(1,1,0,0)
Rmat['inflowRate',]=c(1,5,0,0)
Rmat['washOut',]=c(0.1,0.1,0.1,0.1)
Rmat['molarMass',]=c(2,44,16,18)
#make microbeSysInfo data frame
Mmat=matrix(NA,ncol=1,nrow=3,dimnames=list(c('startValue','inflowRate',
'washOut'),c('Archea')))
Mmat['startValue',]=1
Mmat['inflowRate',]=0
Mmat['washOut',]=0.1
out=microPopModel(
microbeNames='Archea',
times=seq(0,50,0.1),
resourceSysInfo=data.frame(Rmat,stringsAsFactors=FALSE),
microbeSysInfo=data.frame(Mmat,stringsAsFactors=FALSE)
)