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

#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_06/Cowpea_phenotype_exp6_analysis"
list.files(pattern=".csv")
## [1] "EVT_exp6.csv"       "exp6_FWDWWC.csv"    "exp6_photosynq.csv"
## [4] "Pot_Geno_exp6.csv"
exp6_photo <- read.csv("exp6_photosynq.csv")
colnames(exp6_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_geno6 <- read.csv("Pot_Geno_exp6.csv")
pot_geno6
#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
photo6_interest <- exp6_photo[,c(4:5, 15:16, 18, 24, 28, 40:44, 48, 50)]
photo_geno_6exp <- merge(photo6_interest, pot_geno6, all = TRUE)
photo_geno_6exp <- na.omit(photo_geno_6exp)
photo_geno_6exp
photo_geno_6exp$time <- as.factor(photo_geno_6exp$time)
photo_geno_6exp$day.of.stress <- photo_geno_6exp$time
photo_geno_6exp$day.of.stress <- gsub("7/20/2022 0:00", "14", photo_geno_6exp$day.of.stress)
photo_geno_6exp$day.of.stress <- gsub("7/13/2022 0:00", "7", photo_geno_6exp$day.of.stress)
colnames(photo_geno_6exp)
##  [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_6exp <- photo_geno_6exp[,c(1:2, 15, 17, 3:13)]
photo_geno_6exp$day.of.stress <- as.numeric(photo_geno_6exp$day.of.stress)
photo_geno_6exp
#write.csv(photo_geno_6exp, "photosynQ_geno_exp6.csv", row.names = TRUE)

###Histograms

FoPrime_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

FmPrime_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

FvP_over_FmP_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

leaftemp_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

leafthickness_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

PhiNPQ_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

PS1.Active.Centers_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

PS1.Open.Centers_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

PS1.Over.Reduced.Centers_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

PS1.Oxidized.Centers_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h

SPAD_exp6_h <- gghistogram(photo_geno_6exp, 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_exp6_h