This notebook is to analyze the CropReporter data from Noor AlBader’s pilot experiment, imaged on Nov. 11th using BTI’s Phenotyping facility.

Noor <- read.csv("20240118_Noor_Tomatoes_MMJ_mmj.csv", header = T)
Noor2 <- na.omit(Noor)
Noor2
library(ggpubr)
## Loading required package: ggplot2
library(ggplot2)
library(ggsci)

FvFm_overall <- ggerrorplot(Noor2, y = "Fv.Fm", x = "Genotype", fill="Genotype", color="Genotype", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "Treatment",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Maximum Quantum Yield of PSII (Fv/Fm)") 
#GR_overall <- GR_overall + rremove("legend") + stat_compare_means(method="t.test", ref.group = "Control", 
#                                                              label = "p.signif", hide.ns = T)
FvFm_overall <- FvFm_overall + scale_color_jco() + theme(axis.text.x = element_text(angle=90, vjust=0.5)) + theme(legend.position = "none") + stat_compare_means(method = "aov", label.y = 0.85)
FvFm_overall

FqFm_overall <- ggerrorplot(Noor2, y = "Fq..Fm.", x = "Genotype", fill="Genotype", color="Genotype", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "Treatment",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Light-adapted Quantum Yield of PSII (Fq/Fm)") 
#GR_overall <- GR_overall + rremove("legend") + stat_compare_means(method="t.test", ref.group = "Control", 
#                                                              label = "p.signif", hide.ns = T)
FqFm_overall <- FqFm_overall + scale_color_jco() + theme(axis.text.x = element_text(angle=90, vjust=0.5)) + theme(legend.position = "none") + stat_compare_means(method = "aov", label.y = 0.45)
FqFm_overall

NPQ_overall <- ggerrorplot(Noor2, y = "NPQ", x = "Genotype", fill="Genotype", color="Genotype", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "Treatment",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Non-photochemical Quenching (a.u.)") 
#GR_overall <- GR_overall + rremove("legend") + stat_compare_means(method="t.test", ref.group = "Control", 
#                                                              label = "p.signif", hide.ns = T)
NPQ_overall <- NPQ_overall + scale_color_jco() + theme(axis.text.x = element_text(angle=90, vjust=0.5)) + theme(legend.position = "none") + stat_compare_means(method = "aov", label.y = 5.5)
NPQ_overall

Chl_overall <- ggerrorplot(Noor2, y = "ChlIdx", x = "Genotype", fill="Genotype", color="Genotype", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "Treatment",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Chlorophyll Index (a.u.)") 
#GR_overall <- GR_overall + rremove("legend") + stat_compare_means(method="t.test", ref.group = "Control", 
#                                                              label = "p.signif", hide.ns = T)
Chl_overall <- Chl_overall + scale_color_jco() + theme(axis.text.x = element_text(angle=90, vjust=0.5)) + theme(legend.position = "none") + stat_compare_means(method = "aov", label.y = 2.5)
Chl_overall

Ari_overall <- ggerrorplot(Noor2, y = "AriIdx", x = "Genotype", fill="Genotype", color="Genotype", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "Treatment",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Anthocyanin Index (a.u.)") 
#GR_overall <- GR_overall + rremove("legend") + stat_compare_means(method="t.test", ref.group = "Control", 
#                                                              label = "p.signif", hide.ns = T)
Ari_overall <- Ari_overall + scale_color_jco() + theme(axis.text.x = element_text(angle=90, vjust=0.5)) + theme(legend.position = "none") + stat_compare_means(method = "aov", label.y = 6)
Ari_overall

library(stringr)
library(multcompView)
Control <- subset(Noor2, Noor$Treatment == "Control")
Salt <- subset(Noor2, Noor$Treatment == "Salt")
Control$Genotype <- as.factor(Control$Genotype)
Salt$Genotype <- as.factor(Salt$Genotype)

Output <- TukeyHSD(aov(Fv.Fm ~ Genotype, data = Control))
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
testc <- as.data.frame(stat.test$Letters)
testc$group2 <- rownames(testc)
testc$group1 <- rownames(testc)
testc$Genotype <- rownames(testc)
testc$Genotype <- rownames(testc)
colnames(testc)[1] <- "Tukey"
testc$Treatment <- "Control"

Output <- TukeyHSD(aov(Fv.Fm ~ Genotype, data = Salt))
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
tests <- as.data.frame(stat.test$Letters)
tests$group2 <- rownames(tests)
tests$group1 <- rownames(tests)
tests$Genotype <- rownames(tests)
tests$Genotype <- rownames(tests)
colnames(tests)[1] <- "Tukey"
tests$Treatment <- "Salt"

test <- rbind(testc, tests)
test
FvFm_overall <- FvFm_overall + stat_pvalue_manual(test, label = "Tukey", y.position = 0.84)
FvFm_overall

Output <- TukeyHSD(aov(Fq..Fm. ~ Genotype, data = Control))
Control
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
testc <- as.data.frame(stat.test$Letters)
testc$group2 <- rownames(testc)
testc$group1 <- rownames(testc)
testc$Genotype <- rownames(testc)
testc$Genotype <- rownames(testc)
colnames(testc)[1] <- "Tukey"
testc$Treatment <- "Control"

Output <- TukeyHSD(aov(Fq..Fm. ~ Genotype, data = Salt))
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
tests <- as.data.frame(stat.test$Letters)
tests$group2 <- rownames(tests)
tests$group1 <- rownames(tests)
tests$Genotype <- rownames(tests)
tests$Genotype <- rownames(tests)
colnames(tests)[1] <- "Tukey"
tests$Treatment <- "Salt"

test <- rbind(testc, tests)
test
FqFm_overall <- FqFm_overall + stat_pvalue_manual(test, label = "Tukey", y.position = 0.4)
FqFm_overall

Output <- TukeyHSD(aov(NPQ ~ Genotype, data = Control))
Control
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
testc <- as.data.frame(stat.test$Letters)
testc$group2 <- rownames(testc)
testc$group1 <- rownames(testc)
testc$Genotype <- rownames(testc)
testc$Genotype <- rownames(testc)
colnames(testc)[1] <- "Tukey"
testc$Treatment <- "Control"

Output <- TukeyHSD(aov(NPQ ~ Genotype, data = Salt))
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
tests <- as.data.frame(stat.test$Letters)
tests$group2 <- rownames(tests)
tests$group1 <- rownames(tests)
tests$Genotype <- rownames(tests)
tests$Genotype <- rownames(tests)
colnames(tests)[1] <- "Tukey"
tests$Treatment <- "Salt"

test <- rbind(testc, tests)
test
NPQ_overall <- NPQ_overall + stat_pvalue_manual(test, label = "Tukey", y.position = 5)
NPQ_overall

Output <- TukeyHSD(aov(ChlIdx ~ Genotype, data = Control))
Control
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
testc <- as.data.frame(stat.test$Letters)
testc$group2 <- rownames(testc)
testc$group1 <- rownames(testc)
testc$Genotype <- rownames(testc)
testc$Genotype <- rownames(testc)
colnames(testc)[1] <- "Tukey"
testc$Treatment <- "Control"

Output <- TukeyHSD(aov(ChlIdx ~ Genotype, data = Salt))
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
tests <- as.data.frame(stat.test$Letters)
tests$group2 <- rownames(tests)
tests$group1 <- rownames(tests)
tests$Genotype <- rownames(tests)
tests$Genotype <- rownames(tests)
colnames(tests)[1] <- "Tukey"
tests$Treatment <- "Salt"

test <- rbind(testc, tests)
test
Chl_overall <- Chl_overall + stat_pvalue_manual(test, label = "Tukey", y.position = 2.4)
Chl_overall

Output <- TukeyHSD(aov(AriIdx ~ Genotype, data = Control))
Control
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
testc <- as.data.frame(stat.test$Letters)
testc$group2 <- rownames(testc)
testc$group1 <- rownames(testc)
testc$Genotype <- rownames(testc)
testc$Genotype <- rownames(testc)
colnames(testc)[1] <- "Tukey"
testc$Treatment <- "Control"

Output <- TukeyHSD(aov(AriIdx ~ Genotype, data = Salt))
P7 = Output$Genotype[,'p adj']
stat.test<- multcompLetters(P7)
tests <- as.data.frame(stat.test$Letters)
tests$group2 <- rownames(tests)
tests$group1 <- rownames(tests)
tests$Genotype <- rownames(tests)
tests$Genotype <- rownames(tests)
colnames(tests)[1] <- "Tukey"
tests$Treatment <- "Salt"

test <- rbind(testc, tests)
test
Ari_overall <- Ari_overall + stat_pvalue_manual(test, label = "Tukey", y.position = 5.5)
Ari_overall

library(cowplot)
## 
## Attaching package: 'cowplot'
## The following object is masked from 'package:ggpubr':
## 
##     get_legend
pdf("Noor_results_tomato.pdf", width = 20, height = 10)
plot_grid(FvFm_overall, FqFm_overall, NPQ_overall, Chl_overall, Ari_overall, labels = "AUTO")
dev.off()
## quartz_off_screen 
##                 2