This code is the PhotosynQ analysis for cowpea screen 5, performed from June 9th through June 23rd 2022. Measurements were taken twice, June 15th and 22nd.

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

##Loading and organizing the data

getwd()
## [1] "C:/Users/J Lab/Box/Plant Architecture Lab/Hayley/Cowpea/Cowpea_screen_05_20220609-25/Cowpea_phenotype_exp5_analysis"
list.files(pattern=".csv")
## [1] "exp5_EVT.csv"       "exp5_FW_DW_WC.csv"  "exp5_photosynq.csv"
## [4] "exp5_pot_geno.csv"
exp5_photo <- read.csv("exp5_photosynq.csv")
colnames(exp5_photo)
##  [1] "ID"                            "Series"                       
##  [3] "Repeat"                        "Pot.number"                   
##  [5] "Treatment"                     "air_temp_kinetics"            
##  [7] "Ambient.Humidity"              "Ambient.Pressure"             
##  [9] "Ambient.Temperature"           "data_raw_PAM"                 
## [11] "ECS_averaged_trace"            "ECS_tau"                      
## [13] "ECSt.mAU"                      "fitinput"                     
## [15] "FmPrime"                       "FoPrime"                      
## [17] "Fs"                            "FvP_over_FmP"                 
## [19] "gH."                           "humidity2_K"                  
## [21] "humidity_K"                    "kP700"                        
## [23] "leaf.angle"                    "Leaf.Temperature"             
## [25] "Leaf.Temperature.Differenial"  "Leaf.Temperature.Differential"
## [27] "LEAF_temp"                     "leaf_thickness"               
## [29] "LEF"                           "LEFd_trace"                   
## [31] "Light.Intensity..PAR."         "NPQt"                         
## [33] "outdata"                       "P700_DIRK_ampl"               
## [35] "P700_DIRK_averaged_trace"      "P700_fitinput"                
## [37] "P700_outdata"                  "Phi2"                         
## [39] "PhiNO"                         "PhiNPQ"                       
## [41] "PS1.Active.Centers"            "PS1.Open.Centers"             
## [43] "PS1.Over.Reduced.Centers"      "PS1.Oxidized.Centers"         
## [45] "PSI_data_absorbance"           "pump"                         
## [47] "qL"                            "SPAD"                         
## [49] "test_data_raw_PAM"             "time"                         
## [51] "Time.of.Day"                   "tP700"                        
## [53] "v_initial_P700"                "vH."                          
## [55] "User"                          "Device.ID"                    
## [57] "Latitude"                      "Longitude"                    
## [59] "Issues"
pot_geno5 <- read.csv("exp5_pot_geno.csv")
pot_geno5
#we are interested in: Pot.Number, Treatment, time, FoPrime, PhiNPQ, FvP_over_FmP, FmPrime, PS1.Active.Centers, PS1.Open.Centers, PS1.Over.Reduced.Centers, PS1.Oxidized.Centers, leaf_thickness, Leaf.Temperature, SPAD
photo5_interest <- exp5_photo[,c(4:5, 15:16, 18, 24, 28, 40:44, 48, 50)]
photo_geno_5exp <- merge(photo5_interest, pot_geno5, all = TRUE)
photo_geno_5exp <- na.omit(photo_geno_5exp)
photo_geno_5exp
photo_geno_5exp$time <- as.factor(photo_geno_5exp$time)
photo_geno_5exp$day.of.stress <- photo_geno_5exp$time
photo_geno_5exp$day.of.stress <- gsub("6/22/2022 0:00", "14", photo_geno_5exp$day.of.stress)
photo_geno_5exp$day.of.stress <- gsub("6/15/2022 0:00", "7", photo_geno_5exp$day.of.stress)
colnames(photo_geno_5exp)
##  [1] "Pot.number"               "Treatment"               
##  [3] "FmPrime"                  "FoPrime"                 
##  [5] "FvP_over_FmP"             "Leaf.Temperature"        
##  [7] "leaf_thickness"           "PhiNPQ"                  
##  [9] "PS1.Active.Centers"       "PS1.Open.Centers"        
## [11] "PS1.Over.Reduced.Centers" "PS1.Oxidized.Centers"    
## [13] "SPAD"                     "time"                    
## [15] "Genotype"                 "Seed.stock.used"         
## [17] "day.of.stress"
photo_geno_5exp <- photo_geno_5exp[,c(1:2, 15, 17, 3:13)]
photo_geno_5exp$day.of.stress <- as.numeric(photo_geno_5exp$day.of.stress)
photo_geno_5exp
#write.csv(photo_geno_5exp, "photosynQ_geno_exp5.csv", row.names = TRUE)

###Histograms

FoPrime_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

FmPrime_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

FvP_over_FmP_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

leaftemp_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

leafthickness_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

PhiNPQ_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

PS1.Active.Centers_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

PS1.Open.Centers_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

PS1.Over.Reduced.Centers_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

PS1.Oxidized.Centers_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h

SPAD_exp5_h <- gghistogram(photo_geno_5exp, 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_exp5_h