Data processing pipeline for Experiment 96 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("Exp00096_PS2_Analysis_clean.TXT", sep = "\t")
data
#colnames(data)
PS <- subset(data, data$Obj.No == "All")
PS
PS1 <- PS[,c(1:6, 9, 11, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37)]
PS1
for(i in 1:nrow(PS1)){
  PS1$PhenoTray.ID[i] <- strsplit(PS1$File[i], "_")[[1]][3]
}
length(unique(PS1$PhenoTray.ID))
## [1] 20
for(i in 1:nrow(PS1)){
  PS1$month <- substr(PS1$Date, 5, 6)
  PS1$day <- substr(PS1$Date, 7, 8)
  PS1$hour <- substr(PS1$Time, 1, 2)
}
PS1
unique(PS1$month)
## [1] "03" "04"
temp <- subset(PS1, PS1$month == "03")
min(temp$day)
## [1] "21"
temp <- subset(temp, temp$day == "21")
min(temp$hour)
## [1] "16"
PS1$cum.days <- 0
for(i in 1:nrow(PS1)){
  if(PS1$month[i] == "03"){
    PS1$cum.days[i] <- 0}
  if(PS1$month[i] == "04"){
    PS1$cum.days[i] <- 31}
}
PS1

so first day of the experiment is March 21st and the measurements are starting around 16:00.

Let’s calculate Time of Experiment (TOE).

PS1$TOE <- (as.numeric(as.character(PS1$day)) - 21)*24 + (PS1$cum.days*24) + (as.numeric(as.character(PS1$hour)) - 16)
unique(PS1$TOE)
##   [1]  77  80  81  84  85  88  89  92  93  96   0 100 108 112 141 183 476 499
##  [19] 500 516 517   1 519 521 528 532 540 544 552 556 564 568   4 576 580 588
##  [37] 592 600 604 612 616 624 628  12 636 640 648 665 667 669 673 676 684 688
##  [55]  69 696 700 708 712 720 724 732 736 741 744  72 748 761 762 768 772 784
##  [73] 815 823 859  73 865 908 910  76  74  82 475 518 520  70 740 756 780 822
##  [91] 338 502 785 860 909 477 670 816  78 478 664 209 259  90 666 671 263 697
## [109] 763  86 337 515  94  97
PS1
PS4 <- PS1[,c(1:5, 21, 26, 6:20)]
PS4

There are still some odd things in the column names - that I would like to straighten out:

colnames(PS4)[9] <- "Fv.Fm"
colnames(PS4)[10] <- "Fq.Fm"
colnames(PS4)[17] <- "phi.no"
colnames(PS4)[18] <- "phi.npq"
colnames(PS4)[19] <- "npq.t"
PS4 <- PS4[,c(1:4, 6:22)]
PS4
PS4 <- na.omit(PS4)
unique(PS4$PhenoTray.ID)
##  [1] "24747" "24748" "24749" "24750" "24751" "24752" "24753" "24754" "24755"
## [10] "24756" "24757" "24758" "24759" "24760" "24761" "24762" "24763" "24764"
## [19] "24765" "24766"
write.table(PS4, file = "Exp00096_PS2_Analysis_new.TXT", sep="\t", row.names = F)

Data visualization

#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

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

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("Exp00096_plots.pdf", height = 10, width = 7)
plot_grid(FvFm_graph, FqFm_graph, NDVI_graph, AriIdx_graph, ChlIdx_graph, labels = "AUTO", ncol = 2)
dev.off()
## quartz_off_screen 
##                 2