Data processing pipeline for Experiment 100 data collected on Crop Reporter camera within BTI’s PhenoSight facility.

list.files()
##  [1] "Exp00089_ExpDesign.tsv"            "Exp00089_Pipeline.html"           
##  [3] "Exp00089_Pipeline.nb.html"         "Exp00089_Pipeline.Rmd"            
##  [5] "Exp00089_plots.pdf"                "Exp00089_PS2_Analysis_new.TXT"    
##  [7] "Exp00089_PS2_Analysis.TXT"         "Exp00092_ExpDesign.tsv"           
##  [9] "Exp00092_Pipeline.html"            "Exp00092_Pipeline.Rmd"            
## [11] "Exp00092_plots.pdf"                "Exp00092_PS_analysis_new.TXT"     
## [13] "Exp00092_PS_analysis.TXT"          "Exp00092_PS2_Analysis_new.TXT"    
## [15] "Exp00094_ExpDesign.tsv"            "Exp00094_Pipeline.html"           
## [17] "Exp00094_Pipeline.Rmd"             "Exp00094_plots.pdf"               
## [19] "Exp00094_PS2_Analysis_clean.TXT"   "Exp00094_PS2_Analysis_new.TXT"    
## [21] "Exp00095_ExpDesign.tsv"            "Exp00095_PS2_Analysis_clean.TXT"  
## [23] "Exp00096_ExpDesign.tsv"            "Exp00096_Pipeline.html"           
## [25] "Exp00096_Pipeline.Rmd"             "Exp00096_plots.pdf"               
## [27] "Exp00096_PS2_Analysis_clean.TXT"   "Exp00096_PS2_Analysis_new.TXT"    
## [29] "Exp010098_ExpDesign.tsv"           "Exp010098_Pipeline.html"          
## [31] "Exp010098_Pipeline.Rmd"            "Exp010098_plots.pdf"              
## [33] "Exp010098_PS2_Analysis_clean.TXT"  "Exp010098_PS2_Analysis_new.TXT"   
## [35] "Exp010099_ExpDesign.tsv"           "Exp010099_Pipeline.html"          
## [37] "Exp010099_Pipeline.Rmd"            "Exp010099_plots.pdf"              
## [39] "Exp010099_PS2_Analysis_clean.TXT"  "Exp010099_PS2_Analysis_new.TXT"   
## [41] "Exp010100_ExpDesign.tsv"           "Exp010100_Pipeline.Rmd"           
## [43] "Exp010100_plots.pdf"               "Exp010100_PS2_Analysis_clean.TXT" 
## [45] "Exp010100_PS2_Analysis_new.TXT"    "Exp010102_ExpDesign.tsv"          
## [47] "Exp010102_PS2_Analysis_clean.TXT"  "Exp010103_ExpDesign.tsv"          
## [49] "Exp010103_PS2_Analysis_clean.TXT"  "Exp010104_ExpDesign.tsv"          
## [51] "Exp010104_PS2_Analysis_clean.TXT"  "Exp010105_ExpDesign.tsv"          
## [53] "Exp010105_PS2_Analysis_clean.TXT"  "Exp010108_ExpDesign.tsv"          
## [55] "Exp010108_PS2_Analysis_clean.TXT"  "Exp010109_ExpDesign.tsv"          
## [57] "Exp010109_PS2_Analysis_clean.TXT"  "Exp010111_PS2_Analysis_clean.TXT" 
## [59] "Exp010113_PS2_Analysis.TXT"        "Exp010134_ExpDesign.tsv"          
## [61] "Exp010134_PS2_Analysis.TXT"        "Exp010136_ExpDesign.tsv"          
## [63] "Exp010136_PS2_Analysis.TXT"        "Exp010190A_PS2_Analysis_clean.TXT"
## [65] "Exp010190B_PS2_Analysis.TXT"       "Exp010190C_PS2_Analysis_clean.TXT"
## [67] "Exp010191_ExpDesign.txt"           "Exp010191_PS2_Analysis_new.TXT"   
## [69] "Exp10214_PS2_Analysis_clean.TXT"   "Exp10215_PS2_Analysis_clean.TXT"  
## [71] "Exp10217_PS2_Analysis.TXT"         "Exp10218_PS2_Analysis.TXT"        
## [73] "rsconnect"
#install.packages("data.table")
library(data.table)
## Warning: package 'data.table' was built under R version 4.3.3
data <- fread("Exp010100_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")
PS
PS1 <- subset(PS, PS$nTmPam == 1)
PS2 <- subset(PS, PS$nTmPam == 2)
PS1
PS2
PS1 <- PS1[,c(1:4, 6, 9)]
PS1
PS2 <- PS2[,c(1:4, 6, 11, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37)]
PS2
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] 16
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] "31"
temp <- subset(temp, temp$day == "31")
min(temp$hour)
## [1] "12"
PS4$cum.days <- 0
for(i in 1:nrow(PS4)){
  if(PS4$month[i] == "05"){
    PS4$cum.days[i] <- 0}
  if(PS4$month[i] == "06"){
    PS4$cum.days[i] <- 31}
}
PS4

so first day of the experiment is May 31 and the measurements are starting around 12:00.

Let’s calculate Time of Experiment (TOE).

PS4$TOE <- (as.numeric(as.character(PS4$day)) - 31)*24 + (PS4$cum.days*24) + (as.numeric(as.character(PS4$hour)) - 12)
unique(PS4$TOE)
## [1] 0 1
PS4
PS4 <- PS4[,c(1:4, 24, 29, 5:23)]
PS4

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

colnames(PS4)[8] <- "Fv.Fm"
colnames(PS4)[9] <- "Fv.Fm.3"
colnames(PS4)[10] <- "Fv.Fm.4"
colnames(PS4)[11] <- "Fv.Fm.5"
colnames(PS4)[12] <- "Fv.Fm.6"
colnames(PS4)[13] <- "Fq.Fm"
colnames(PS4)[20] <- "phi.no"
colnames(PS4)[21] <- "phi.npq"
colnames(PS4)[22] <- "npq.t"
PS4
PS4 <- na.omit(PS4)
unique(PS4$PhenoTray.ID)
##  [1] "34835" "34836" "34837" "34838" "34839" "34840" "34841" "34842" "34843"
## [10] "34844" "34845" "34846" "34847" "34848" "34849" "34850"
write.table(PS4, file = "Exp010100_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
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?

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
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?

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
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?

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
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?

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
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?

library(cowplot)
pdf("Exp010100_plots.pdf", height = 10, width = 7)
plot_grid(FvFm_graph, FqFm_graph, NDVI_graph, AriIdx_graph, ChlIdx_graph, labels = "AUTO", ncol = 2)
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
dev.off()
## quartz_off_screen 
##                 2