Skip to content

Commit

Permalink
Added info to README
Browse files Browse the repository at this point in the history
  • Loading branch information
kallisons committed Jan 22, 2015
1 parent fb3bd47 commit c2a4489
Show file tree
Hide file tree
Showing 8 changed files with 294 additions and 211 deletions.
1 change: 1 addition & 0 deletions Analysis/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.txt
2 changes: 2 additions & 0 deletions Model/MRM0D/RunModel_BATS_MRM0D.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#qfrac is the fraction of the surface area of the spherical particle covered by a single layer of bacteria, values greater than 1 mean that there is a second layer of bacteria

#For higher resolution of max_epsilon, copy and paste this list into the code: 0.0000 0.0005 0.0010 0.0015 0.0020 0.0025 0.0030 0.0035 0.0040 0.0045 0.0050 0.0055 0.0060 0.0065 0.0070 0.0075 0.0080 0.0085 0.0090 0.0095 0.0100 0.0105 0.0110 0.0115 0.0120 0.0125 0.0130 0.0135 0.0140 0.0145 0.0150 0.0155 0.0160 0.0165 0.0170 0.0175 0.0180 0.0185 0.0190 0.0195 0.0200 0.0205 0.0210 0.0215 0.0220 0.0225 0.0230 0.0235 0.0240 0.0245 0.0250 0.0255 0.0260 0.0265 0.0270 0.0275 0.0280 0.0285 0.0290 0.0295 0.0300 0.0305 0.0310 0.0315 0.0320 0.0325 0.0330 0.0335 0.0340 0.0345 0.0350 0.0355 0.0360 0.0365 0.0370 0.0375 0.0380 0.0385 0.0390 0.0395 0.0400 0.0405 0.0410 0.0415 0.0420 0.0425 0.0430 0.0435 0.0440 0.0445 0.0450 0.0455 0.0460 0.0465 0.0470 0.0475 0.0480 0.0485 0.0490 0.0495 0.0500

for max_epsilon in 0.0000 0.0100 0.0200 0.0300 0.0400 0.0500
do
for qfrac in 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.50 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.60 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.70 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.80 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.90 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10
Expand Down
26 changes: 0 additions & 26 deletions Model/MRM0D/RunModel_eeprod_optimization.sh

This file was deleted.

170 changes: 0 additions & 170 deletions RCode/GrowthAnalysis_OptimalEpsilon3.R

This file was deleted.

93 changes: 93 additions & 0 deletions RCode/MRM0D_OptimalEpsilon.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#Change working directory to MicrobeReminModel_v1.0/RCode using the setwd() command or using the Misc menu.
#getwd() #shows the current working directory for the R gui.

filepath = paste("../Output/MRM0D/", sep="")

#Bacterial growth is assessed after 3 hours of intial spin-up. Bacterial production is calculated over a 9 minute time interval which is the residence of exoenzyme in the particle. The time step is 30 seconds.
tsegs1<-362 #Begin time for bacterial production calculation
tsegs2<-379 #End time for bacterial production calculation

#--------------------------
# Find Epsilon Optimum
#--------------------------
folderstate<-paste(filepath, "StateVariables/", sep="")
statenames<-list.files(folderstate)

folderbrates<-paste(filepath, "BacteriaRates/", sep="")
bratesnames<-list.files(folderbrates)

foldermrates<-paste(filepath, "MassTransferRates/", sep="")
mratesnames<-list.files(foldermrates)

analysis<-as.data.frame(matrix(NA, length(statenames), 6))
colnames(analysis)<-c("maxe", "qfrac.init", "ba.init", "ba.prod", "enz.prod", "h.prod")

for(a in 1:length(statenames)){

state<-read.table(paste(folderstate, statenames[a], sep=""))
colnames(state)<-c("time", "pom", "enz", "h", "ba", "hdom", "bf", "edom", "denz", "dedom")

brates<-read.table(paste(folderbrates, bratesnames[a], sep=""))
colnames(brates)<-c("time", "attach", "detach", "ba_grow", "bf_grow", "up_ba", "up_bf", "epsilon")

mrates<-read.table(paste(foldermrates, mratesnames[a], sep=""))
colnames(mrates)<-c("time", "pnum", "pom_dgd", "h_hdom", "ehl_k", "enz_dom", "denz_dom")

analysis$maxe[a]<-as.numeric(substr(statenames[a], 20, 25))
analysis$qfrac.init[a]<-as.numeric(substr(statenames[a], 32, 35))
analysis$ba.init[a]<-state$ba[1]
cperb<-5E-12 #carbon per bacteria
analysis$ba.init[a]<-analysis$ba.init[a]/cperb/mrates$pnum[2] #number of bacteria per particle

state<-state[tsegs1:tsegs2,]
brates<-brates[tsegs1:tsegs2,]
mrates<-mrates[tsegs1:tsegs2,]
analysis$ba.prod[a]<-sum(state$ba*brates$ba_grow)
analysis$enz.prod[a]<-sum(state$ba*brates$epsilon)
analysis$h.prod[a]<-sum(state$enz*mrates$pom_dgd)

}

analysis$qfrac.init<-analysis$qfrac.init*100

opt<-aggregate(analysis$ba.prod, list(analysis$qfrac.init), max)
colnames(opt)<-c("qfrac.init", "ba.prod")
opt<-merge(opt, analysis)
colnames(opt)<-gsub("maxe", "opte", colnames(opt))
opt<-opt[order(opt$qfrac.init),]

opt<-opt[c("ba.init", "qfrac.init", "opte")]

outfile<-paste("../Analysis/OptimalEpsilon.txt", sep="")
write.table(opt, outfile, quote=FALSE, col.names=TRUE, row.names=FALSE, sep="\t")


#---------------------------
# Plot Optimal Epsilon
#---------------------------

OutGraph<-paste("../Graphs/MRM0D1_OptimalEpsilon.ps", sep="")
postscript(OutGraph, family="Helvetica", width=4, height=3.25)

#quartz(width=4, height=3.25)
par(oma=c(3,3,1,1))
par(mar=c(1.5,1,1,0.5)+0.1)
par(mfrow=c(1,1))
par(xaxs="i")
par(yaxs="i")
par(cex.axis=1)
par(cex.lab=1)
par(cex.main=1)


plot(opt$ba.init, opt$opte, type="l", ylim=c(0,0.05), xaxt="n", yaxt="n", lwd=2)
axis(side=1, labels=TRUE)
axis(side=2, labels=TRUE, las=1)


mtext("Initial bacterial abundance per particle", side=1, cex=1, line=0.7 , adj=0.5, outer=TRUE)
mtext(expression(paste("Optimal ", epsilon)), side=2, cex=1, line=1.6 , adj=0.5, outer=TRUE)


dev.off()

15 changes: 15 additions & 0 deletions RCode/RunTest_BATS_MRM0D_OptimalEpsilon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

echo “——————————————————————————————”

echo “MRM0D Optimal Epsilon”

diff ../Analysis/OptimalEpsilon.txt ../TestFiles/MRM0D/OptimalEpsilon/OptimalEpsilon.txt
if [ $? -eq 0 ]
then
echo** PASSES TEST: Output Files Are The Same **
else
echo** FAILS TEST: Output Files Are Different **
fi

echo “——————————————————————————————”
Loading

0 comments on commit c2a4489

Please sign in to comment.