Skip to content

Commit

Permalink
fix death_curve_example
Browse files Browse the repository at this point in the history
  • Loading branch information
wrshoemaker committed Jun 12, 2019
1 parent acb7b94 commit 15b0912
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions R/AIC.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ getwd()
setwd("~/GitHub/LTDE/")

library(ggplot2)
library('latex2exp')

df.weib <- read.table("data/demography/weibull_results_clean.csv",
header = TRUE, sep = ",", row.names = 1, stringsAsFactors = FALSE)
Expand Down
17 changes: 9 additions & 8 deletions R/death_curve_example.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ setwd("~/GitHub/LTDE/")

library('ggplot2')
library('ggpubr')
library('latex2exp')

obs <- read.csv("data/demography/longtermdormancy_20170620_nocomments.csv",
obs <- read.csv("data/demography/longtermdormancy_20190528_nocomments.csv",
header = TRUE, stringsAsFactors = FALSE)
## Adding 1 to deal with log(0) observations
obs$Abund <- as.numeric(obs$Colonies) * 10 ^ as.numeric(obs$Dilution) + 1
obs$Abund <- (as.numeric(obs$Colonies) +1)* (1000 / as.numeric(obs$Inoculum )) * ( 10 ^ as.numeric(obs$Dilution) )
strains <- sort(unique(obs$Strain))
strains <- strains[table(obs$Strain)>10]

Expand All @@ -17,17 +18,17 @@ KBS0714.R3 <- obs[(obs$Strain =='KBS0714') & (obs$Rep ==4),]
KBS0715.R4 <- obs[(obs$Strain =='KBS0715') & (obs$Rep ==4),]

KBS0812.R4.time <-(as.numeric(strptime(KBS0812.R4$Firstread_date,format="%d-%b-%y",tz="EST"))-
as.numeric(strptime(KBS0812.R4$Firstread_date[1],format="%d-%b-%y",tz="EST")))/(3600*24)
as.numeric(strptime(KBS0812.R4$Dormstart_date,format="%d-%b-%y",tz="EST")))/(3600*24)

KBS0714.R3.time <-(as.numeric(strptime(KBS0714.R3$Firstread_date,format="%d-%b-%y",tz="EST"))-
as.numeric(strptime(KBS0714.R3$Firstread_date[1],format="%d-%b-%y",tz="EST")))/(3600*24)
as.numeric(strptime(KBS0714.R3$Dormstart_date,format="%d-%b-%y",tz="EST")))/(3600*24)

KBS0715.R4.time <-(as.numeric(strptime(KBS0715.R4$Firstread_date,format="%d-%b-%y",tz="EST"))-
as.numeric(strptime(KBS0715.R4$Firstread_date[1],format="%d-%b-%y",tz="EST")))/(3600*24)
as.numeric(strptime(KBS0715.R4$Dormstart_date,format="%d-%b-%y",tz="EST")))/(3600*24)

KBS0812.R4.time.logRel <- log(KBS0812.R4$Abund / KBS0812.R4$Abund[1])
KBS0714.R3.time.logRel <- log(KBS0714.R3$Abund / KBS0714.R3$Abund[1])
KBS0715.R4.time.logRel <- log(KBS0715.R4$Abund / KBS0715.R4$Abund[1])
KBS0812.R4.time.logRel <- log(KBS0812.R4$Abund / max(KBS0812.R4$Abund))
KBS0714.R3.time.logRel <- log(KBS0714.R3$Abund / max(KBS0714.R3$Abund))
KBS0715.R4.time.logRel <- log(KBS0715.R4$Abund / max(KBS0715.R4$Abund))

KBS0812.R4.df <- do.call(rbind, Map(data.frame, time=KBS0812.R4.time, logRel=KBS0812.R4.time.logRel))
KBS0714.R3.df <- do.call(rbind, Map(data.frame, time=KBS0714.R3.time, logRel=KBS0714.R3.time.logRel))
Expand Down
Binary file modified figs/death_curve_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 15b0912

Please sign in to comment.