This code is the PhotosynQ analysis for cowpea screen 2, performed from April 7th through April 21st, 2022. Measurements were taken twice, April 13th and April 20th 2022.

#Load the data

list.files(pattern=".csv")
## [1] "EVT_exp2.csv"       "FW_DW.csv"          "Photosynq_exp2.csv"
## [4] "Pot_Geno.csv"
pot_geno_exp2 <- read.csv("Pot_Geno.csv")
colnames(pot_geno_exp2)[1] <- "Pot.Number"
pot_geno_exp2
photo_2exp <- read.csv("Photosynq_exp2.csv")
colnames(photo_2exp)
##  [1] "Datum.ID"                      "Repeat"                       
##  [3] "Pot.Number"                    "Treatment"                    
##  [5] "time"                          "leaf.angle"                   
##  [7] "test_data_raw_PAM"             "pump"                         
##  [9] "ECS_averaged_trace"            "fitinput"                     
## [11] "outdata"                       "ECSt.mAU"                     
## [13] "ECS_tau"                       "gH."                          
## [15] "vH."                           "P700_DIRK_averaged_trace"     
## [17] "P700_fitinput"                 "P700_outdata"                 
## [19] "P700_DIRK_ampl"                "tP700"                        
## [21] "kP700"                         "v_initial_P700"               
## [23] "LEFd_trace"                    "data_raw_PAM"                 
## [25] "Fs"                            "FoPrime"                      
## [27] "Phi2"                          "PhiNPQ"                       
## [29] "qL"                            "NPQt"                         
## [31] "PhiNO"                         "FvP_over_FmP"                 
## [33] "FmPrime"                       "PSI_data_absorbance"          
## [35] "PS1.Active.Centers"            "PS1.Open.Centers"             
## [37] "PS1.Over.Reduced.Centers"      "PS1.Oxidized.Centers"         
## [39] "humidity_K"                    "humidity2_K"                  
## [41] "air_temp_kinetics"             "leaf_thickness"               
## [43] "LEAF_temp"                     "Light.Intensity..PAR."        
## [45] "Ambient.Temperature"           "Ambient.Humidity"             
## [47] "Ambient.Pressure"              "Leaf.Temperature"             
## [49] "Leaf.Temperature.Differential" "LEF"                          
## [51] "Leaf.Temperature.Differenial"  "SPAD"                         
## [53] "User"                          "Device.ID"                    
## [55] "Status"                        "Notes"                        
## [57] "Latitude"                      "Longitude"
photo_interest_exp2 <- photo_2exp[,c(3:5, 26, 28, 32:33, 35:38, 42, 48, 52)]
photo_interest_exp2

###Merge the dataframes and select desired columns

photo_geno_2exp <- merge(photo_interest_exp2, pot_geno_exp2, all = TRUE)
photo_geno_2exp <- na.omit(photo_geno_2exp)
photo_geno_2exp[order(photo_geno_2exp$time),]
photo_geno_2exp$time <- as.factor(photo_geno_2exp$time)
photo_geno_2exp$day.of.stress <- photo_geno_2exp$time
photo_geno_2exp$day.of.stress <- gsub("4/20/2022", "14", photo_geno_2exp$day.of.stress)
photo_geno_2exp$day.of.stress <- gsub("4/13/2022", "7", photo_geno_2exp$day.of.stress)
colnames(photo_geno_2exp)
##  [1] "Pot.Number"               "Treatment"               
##  [3] "time"                     "FoPrime"                 
##  [5] "PhiNPQ"                   "FvP_over_FmP"            
##  [7] "FmPrime"                  "PS1.Active.Centers"      
##  [9] "PS1.Open.Centers"         "PS1.Over.Reduced.Centers"
## [11] "PS1.Oxidized.Centers"     "leaf_thickness"          
## [13] "Leaf.Temperature"         "SPAD"                    
## [15] "Genotype"                 "day.of.stress"
photo_geno_2exp <- photo_geno_2exp[,c(1:2, 16, 4:15)]
photo_geno_2exp$PS1.Open.Centers <- as.numeric(photo_geno_2exp$PS1.Open.Centers)
photo_geno_2exp$PS1.Over.Reduced.Centers <- as.numeric(photo_geno_2exp$PS1.Over.Reduced.Centers)
photo_geno_2exp$PS1.Oxidized.Centers <- as.numeric(photo_geno_2exp$PS1.Oxidized.Centers)
photo_geno_2exp
#write.csv(photo_geno_2exp, "photosynQ_geno_exp2.csv", row.names = TRUE)

###Load the libraries

library("ggplot2")
library("cowplot")
library("ggpubr")
## 
## Attaching package: 'ggpubr'
## The following object is masked from 'package:cowplot':
## 
##     get_legend
library("reshape2")

###Histograms

FoPrime_exp2_h <- gghistogram(photo_geno_2exp, x = "FoPrime", binwidth = 20,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("FoPrime (a.u)")
FoPrime_exp2_h

FmPrime_exp2_h <- gghistogram(photo_geno_2exp, x = "FmPrime", binwidth = 100,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("FmPrime (a.u)")
FmPrime_exp2_h

FvP_over_FmP_exp2_h <- gghistogram(photo_geno_2exp, x = "FvP_over_FmP", binwidth = 0.01,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("FvP over FmP (a.u)")
FvP_over_FmP_exp2_h

leaftemp_exp2_h <- gghistogram(photo_geno_2exp, x = "Leaf.Temperature", binwidth = 0.5,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("Leaf Temperature (C)")
leaftemp_exp2_h

leafthickness_exp2_h <- gghistogram(photo_geno_2exp, x = "leaf_thickness", binwidth = 0.05,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("Leaf Thickness (mm)")
leafthickness_exp2_h

PhiNPQ_exp2_h <- gghistogram(photo_geno_2exp, x = "PhiNPQ", binwidth = 0.01,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PhiNPQ (a.u.)")
PhiNPQ_exp2_h

PS1.Active.Centers_exp2_h <- gghistogram(photo_geno_2exp, x = "PS1.Active.Centers", binwidth = 1,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PS1.Active.Centers (a.u.)")
PS1.Active.Centers_exp2_h

PS1.Open.Centers_exp2_h <- gghistogram(photo_geno_2exp, x = "PS1.Open.Centers",
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PS1.Open.Centers (a.u.)")
## Warning: Using `bins = 30` by default. Pick better value with the argument
## `bins`.
PS1.Open.Centers_exp2_h

PS1.Over.Reduced.Centers_exp2_h <- gghistogram(photo_geno_2exp, x = "PS1.Over.Reduced.Centers",
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PS1.Over.Reduced.Centers (a.u.)")
## Warning: Using `bins = 30` by default. Pick better value with the argument
## `bins`.
PS1.Over.Reduced.Centers_exp2_h

PS1.Oxidized.Centers_exp2_h <- gghistogram(photo_geno_2exp, x = "PS1.Oxidized.Centers",
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PS1.Oxidized.Centers (a.u.)")
## Warning: Using `bins = 30` by default. Pick better value with the argument
## `bins`.
PS1.Oxidized.Centers_exp2_h

SPAD_exp2_h <- gghistogram(photo_geno_2exp, x = "SPAD", binwidth = 2.5,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("SPAD (a.u.)")
SPAD_exp2_h

###Look closer for potential outliers

off_PS1.Active.Centers <- subset(photo_geno_2exp, photo_geno_2exp$PS1.Active.Centers > 40)
off_PS1.Active.Centers
off_PS1.Oxidized.Centers <- subset(photo_geno_2exp, photo_geno_2exp$PS1.Oxidized.Centers < -10)
off_PS1.Oxidized.Centers