Data processing pipeline for Experiment 94 data collected on Crop Reporter camera within BTI’s PhenoSight facility.
#install.packages("data.table")
library(data.table)
## Warning: package 'data.table' was built under R version 4.3.3
data <- fread("Exp00094_PS2_Analysis_clean.TXT", sep = "\t")
data
colnames(data)
## [1] "File" "Date" "Time" "Obj.No"
## [5] "nTmPam" "Obj.Size" "Obj.Xc" "Obj.Yc"
## [9] "Fv/Fm" "s.d." "Fq'/Fm'" "s.d."
## [13] "NPQ" "s.d." "F0'" "s.d."
## [17] "qP" "s.d." "qN" "s.d."
## [21] "qL" "s.d." "qE" "s.d."
## [25] "qI" "s.d." "фno" "s.d."
## [29] "фnpq" "s.d." "npq(t)" "s.d."
## [33] "ChlIdx" "s.d." "AriIdx" "s.d."
## [37] "NDVI" "s.d." "Border" "Mask/Border"
## [41] "Points" "Area (CH)" "Mask/Area (CH)" "X-Centre"
## [45] "Y-Centre" "Radius" "Area (MC)" "Mask/Area (MC)"
## [49] "Width" "Height" "Area (MR)" "Mask/Area (MR)"
## [53] "Alpha" "Size (SK)" "Junction (SK)" "Endpoint (SK)"
## [57] "Path (SK)" "V58"
PS <- subset(data, data$Obj.No == "All")
PS1 <- subset(PS, PS$nTmPam == 1)
PS2 <- subset(PS, PS$nTmPam == 2)
PS1
PS2
PS1 <- PS1[,c(1:6, 9, 11, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37)]
PS2 <- PS2[,c(1:6, 9, 11, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37)]
PS1
PS2
PS1 <- PS1[,c(1:4, 6:7)]
PS2 <- PS2[,c(1:4, 6, 8:20)]
PS_extra <- subset(PS, PS$nTmPam > 2)
PS_extra <- PS_extra[,c(1:6, 9, 11, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37)]
PS_extra <- PS_extra[,c(1:7)]
PS_extra
PS_melt <- melt(PS_extra, id.vars = c("File", "Date", "Time", "Obj.No", "Obj.Size", "nTmPam"))
PS_melt
PS_cast <- dcast(PS_melt, File + Date + Time + Obj.No + Obj.Size ~ variable + nTmPam)
PS_cast
PS3 <- merge(PS1, PS_cast, by = c("File", "Date", "Time", "Obj.No", "Obj.Size"))
PS4 <- merge(PS3, PS2, by = c("File", "Date", "Time", "Obj.No", "Obj.Size"))
PS4
for(i in 1:nrow(PS4)){
PS4$PhenoTray.ID[i] <- strsplit(PS4$File[i], "_")[[1]][3]
}
length(unique(PS4$PhenoTray.ID))
## [1] 9
for(i in 1:nrow(PS4)){
PS4$month <- substr(PS4$Date, 5, 6)
PS4$day <- substr(PS4$Date, 7, 8)
PS4$hour <- substr(PS4$Time, 1, 2)
}
PS4
unique(PS4$month)
## [1] "05"
temp <- subset(PS4, PS4$month == "05")
min(temp$day)
## [1] "08"
temp <- subset(temp, temp$day == "08")
min(temp$hour)
## [1] "14"
so first day of the experiment is May 8th and the measurements are starting around 14:00.
Let’s calculate Time of Experiment (TOE).
PS4$TOE <- (as.numeric(as.character(PS4$day)) - 8)*24 + (as.numeric(as.character(PS4$hour)) - 14)
unique(PS4$TOE)
## [1] 288 289 290 1 121 122 140 287 0 120 139 44 45 46
PS4 <- PS4[,c(1:10, 20:37)]
PS4
There are still some odd things in the column names - that I would like to straighten out:
colnames(PS4)[6] <- "Fv.Fm"
colnames(PS4)[7] <- "Fv.Fm.3"
colnames(PS4)[8] <- "Fv.Fm.4"
colnames(PS4)[9] <- "Fv.Fm.5"
colnames(PS4)[10] <- "Fv.Fm.6"
colnames(PS4)[11] <- "Fq.Fm"
colnames(PS4)[18] <- "phi.no"
colnames(PS4)[19] <- "phi.npq"
colnames(PS4)[20] <- "npq.t"
PS4 <- PS4[,c(1:4, 24, 28, 5:23)]
PS4
PS4 <- na.omit(PS4)
unique(PS4$PhenoTray.ID)
## [1] "24723" "24725" "24727" "24729" "24731" "24733" "24735" "24737"
write.table(PS4, file = "Exp00094_PS2_Analysis_new.TXT", sep="\t", row.names = F)
#install.packages("ggplot2")
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.3
FvFm_graph <- ggplot(data=PS4, aes(x= TOE, y=Fv.Fm, group = PhenoTray.ID))
FvFm_graph <- FvFm_graph + geom_line(alpha = 0.7)
FvFm_graph <- FvFm_graph + ylab("Fv/Fm") + xlab("Hours of Imaging")
FvFm_graph
FvFm3_graph <- ggplot(data=PS4, aes(x= TOE, y=Fv.Fm.3, group = PhenoTray.ID))
FvFm3_graph <- FvFm3_graph + geom_line(alpha = 0.7)
FvFm3_graph <- FvFm3_graph + ylab("Fv/Fm3") + xlab("Hours of Imaging")
FvFm3_graph
FvFm4_graph <- ggplot(data=PS4, aes(x= TOE, y=Fv.Fm.4, group = PhenoTray.ID))
FvFm4_graph <- FvFm4_graph + geom_line(alpha = 0.7)
FvFm4_graph <- FvFm4_graph + ylab("Fv/Fm4") + xlab("Hours of Imaging")
FvFm4_graph
FvFm5_graph <- ggplot(data=PS4, aes(x= TOE, y=Fv.Fm.5, group = PhenoTray.ID))
FvFm5_graph <- FvFm5_graph + geom_line(alpha = 0.7)
FvFm5_graph <- FvFm5_graph + ylab("Fv/Fm5") + xlab("Hours of Imaging")
FvFm5_graph
FvFm6_graph <- ggplot(data=PS4, aes(x= TOE, y=Fv.Fm.6, group = PhenoTray.ID))
FvFm6_graph <- FvFm6_graph + geom_line(alpha = 0.7)
FvFm6_graph <- FvFm6_graph + ylab("Fv/Fm6") + xlab("Hours of Imaging")
FvFm6_graph
FqFm_graph <- ggplot(data=PS4, aes(x= TOE, y=Fq.Fm, group = PhenoTray.ID))
FqFm_graph <- FqFm_graph + geom_line(alpha = 0.7)
FqFm_graph <- FqFm_graph + ylab("Fq/Fm") + xlab("Hours of Imaging")
FqFm_graph
NPQ_graph <- ggplot(data=PS4, aes(x= TOE, y=NPQ, group = PhenoTray.ID))
NPQ_graph <- NPQ_graph + geom_line(alpha = 0.7)
NPQ_graph <- NPQ_graph + ylab("NPQ") + xlab("Hours of Imaging")
NPQ_graph
qP_graph <- ggplot(data=PS4, aes(x= TOE, y=qP, group = PhenoTray.ID))
qP_graph <- qP_graph + geom_line(alpha = 0.7)
qP_graph <- qP_graph + ylab("qP") + xlab("Hours of Imaging")
qP_graph
qN_graph <- ggplot(data=PS4, aes(x= TOE, y=qN, group = PhenoTray.ID))
qN_graph <- qN_graph + geom_line(alpha = 0.7)
qN_graph <- qN_graph + ylab("qN") + xlab("Hours of Imaging")
qN_graph
qL_graph <- ggplot(data=PS4, aes(x= TOE, y=qL, group = PhenoTray.ID))
qL_graph <- qL_graph + geom_line(alpha = 0.7)
qL_graph <- qL_graph + ylab("qL") + xlab("Hours of Imaging")
qL_graph
qE_graph <- ggplot(data=PS4, aes(x= TOE, y=qE, group = PhenoTray.ID))
qE_graph <- qE_graph + geom_line(alpha = 0.7)
qE_graph <- qE_graph + ylab("qE") + xlab("Hours of Imaging")
qE_graph
qI_graph <- ggplot(data=PS4, aes(x= TOE, y=qI, group = PhenoTray.ID))
qI_graph <- qI_graph + geom_line(alpha = 0.7)
qI_graph <- qI_graph + ylab("qI") + xlab("Hours of Imaging")
qI_graph
phi.no_graph <- ggplot(data=PS4, aes(x= TOE, y=phi.no, group = PhenoTray.ID))
phi.no_graph <- phi.no_graph + geom_line(alpha = 0.7)
phi.no_graph <- phi.no_graph + ylab("phi.no") + xlab("Hours of Imaging")
phi.no_graph
phi.npq_graph <- ggplot(data=PS4, aes(x= TOE, y=phi.npq, group = PhenoTray.ID))
phi.npq_graph <- phi.npq_graph + geom_line(alpha = 0.7)
phi.npq_graph <- phi.npq_graph + ylab("phi.npq") + xlab("Hours of Imaging")
phi.npq_graph
npq.t_graph <- ggplot(data=PS4, aes(x= TOE, y=npq.t, group = PhenoTray.ID))
npq.t_graph <- npq.t_graph + geom_line(alpha = 0.7)
npq.t_graph <- npq.t_graph + ylab("npq(t)") + xlab("Hours of Imaging")
npq.t_graph
ChlIdx_graph <- ggplot(data=PS4, aes(x= TOE, y=ChlIdx, group = PhenoTray.ID))
ChlIdx_graph <- ChlIdx_graph + geom_line(alpha = 0.7)
ChlIdx_graph <- ChlIdx_graph + ylab("ChlIdx") + xlab("Hours of Imaging")
ChlIdx_graph
AriIdx_graph <- ggplot(data=PS4, aes(x= TOE, y=AriIdx, group = PhenoTray.ID))
AriIdx_graph <- AriIdx_graph + geom_line(alpha = 0.7)
AriIdx_graph <- AriIdx_graph + ylab("AriIdx") + xlab("Hours of Imaging")
AriIdx_graph
NDVI_graph <- ggplot(data=PS4, aes(x= TOE, y=NDVI, group = PhenoTray.ID))
NDVI_graph <- NDVI_graph + geom_line(alpha = 0.7)
NDVI_graph <- NDVI_graph + ylab("NDVI") + xlab("Hours of Imaging")
NDVI_graph
library(cowplot)
pdf("Exp00094_plots.pdf", height = 10, width = 7)
plot_grid(FvFm_graph, FqFm_graph, npq.t_graph, NPQ_graph, NDVI_graph, AriIdx_graph, ChlIdx_graph, labels = "AUTO", ncol = 2)
dev.off()
## quartz_off_screen
## 2