the Cropreporter measurements were done in two time points, one week apart:early vs late measurements. The early measurements have between 5 to 10 replicates while the late one has 5 replicates only.

getwd()
## [1] "C:/Users/Julkowska Lab/Desktop/R codes by Maryam/202311_Tomato_shoot_growth_ACC_la_248_salt_soil"
list.files(pattern = ".csv")
## [1] "all-data-Crop-ACC-20231108.csv"         
## [2] "all-data-Crop-ACC-20231114.csv"         
## [3] "FW_lastday_ACC_salt_soil.csv"           
## [4] "Maryam_2tomatoes_ACC_salt_soil_data.csv"
## [5] "Results_110823.csv"                     
## [6] "Results_110823_half_deleted.csv"        
## [7] "Results_111423.csv"                     
## [8] "Results_111623.csv"                     
## [9] "Results_112123.csv"
Crop_early <- read.csv("all-data-Crop-ACC-20231108.csv")
Crop_early
Crop_early$All.ID<-paste(Crop_early$Genotype, Crop_early$condition, sep="_")
Crop_early
library(ggplot2)
library(ggpubr)
library(multcompView)
aov(Fv.Fm ~ All.ID, data = Crop_early)
## Call:
##    aov(formula = Fv.Fm ~ All.ID, data = Crop_early)
## 
## Terms:
##                      All.ID   Residuals
## Sum of Squares  0.015979570 0.006460975
## Deg. of Freedom          11          87
## 
## Residual standard error: 0.008617661
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Fv.Fm ~ All.ID, data = Crop_early))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Fv.Fm ~ All.ID, data = Crop_early)
## 
## $All.ID
##                                diff          lwr           upr     p adj
## LA_c+mock-LA_c+acc        -0.004625 -0.019097080  0.0098470800 0.9950789
## LA_c+noacc-LA_c+acc       -0.004125 -0.021849606  0.0135996058 0.9997264
## LA_s+acc-LA_c+acc          0.001875 -0.012597080  0.0163470800 0.9999993
## LA_s+mock-LA_c+acc         0.000875 -0.013597080  0.0153470800 1.0000000
## LA_s+noacc-LA_c+acc       -0.002625 -0.017097080  0.0118470800 0.9999768
## m248_c+acc-LA_c+acc       -0.018925 -0.032654421 -0.0051955794 0.0007433
## m248_c+mock-LA_c+acc      -0.022925 -0.036654421 -0.0091955794 0.0000150
## m248_c+noacc-LA_c+acc     -0.015125 -0.031625710  0.0013757100 0.1043936
## m248_s+acc-LA_c+acc       -0.035125 -0.048854421 -0.0213955794 0.0000000
## m248_s+mock-LA_c+acc      -0.028125 -0.041854421 -0.0143955794 0.0000001
## m248_s+noacc-LA_c+acc     -0.024025 -0.037754421 -0.0102955794 0.0000048
## LA_c+noacc-LA_c+mock       0.000500 -0.017224606  0.0182246058 1.0000000
## LA_s+acc-LA_c+mock         0.006500 -0.007972080  0.0209720800 0.9342972
## LA_s+mock-LA_c+mock        0.005500 -0.008972080  0.0199720800 0.9799993
## LA_s+noacc-LA_c+mock       0.002000 -0.012472080  0.0164720800 0.9999986
## m248_c+acc-LA_c+mock      -0.014300 -0.028029421 -0.0005705794 0.0336058
## m248_c+mock-LA_c+mock     -0.018300 -0.032029421 -0.0045705794 0.0013100
## m248_c+noacc-LA_c+mock    -0.010500 -0.027000710  0.0060007100 0.5981582
## m248_s+acc-LA_c+mock      -0.030500 -0.044229421 -0.0167705794 0.0000000
## m248_s+mock-LA_c+mock     -0.023500 -0.037229421 -0.0097705794 0.0000083
## m248_s+noacc-LA_c+mock    -0.019400 -0.033129421 -0.0056705794 0.0004789
## LA_s+acc-LA_c+noacc        0.006000 -0.011724606  0.0237246058 0.9920282
## LA_s+mock-LA_c+noacc       0.005000 -0.012724606  0.0227246058 0.9983530
## LA_s+noacc-LA_c+noacc      0.001500 -0.016224606  0.0192246058 1.0000000
## m248_c+acc-LA_c+noacc     -0.014800 -0.031923596  0.0023235960 0.1583226
## m248_c+mock-LA_c+noacc    -0.018800 -0.035923596 -0.0016764040 0.0190431
## m248_c+noacc-LA_c+noacc   -0.011000 -0.030416333  0.0084163328 0.7541953
## m248_s+acc-LA_c+noacc     -0.031000 -0.048123596 -0.0138764040 0.0000020
## m248_s+mock-LA_c+noacc    -0.024000 -0.041123596 -0.0068764040 0.0005544
## m248_s+noacc-LA_c+noacc   -0.019900 -0.037023596 -0.0027764040 0.0095949
## LA_s+mock-LA_s+acc        -0.001000 -0.015472080  0.0134720800 1.0000000
## LA_s+noacc-LA_s+acc       -0.004500 -0.018972080  0.0099720800 0.9961091
## m248_c+acc-LA_s+acc       -0.020800 -0.034529421 -0.0070705794 0.0001259
## m248_c+mock-LA_s+acc      -0.024800 -0.038529421 -0.0110705794 0.0000021
## m248_c+noacc-LA_s+acc     -0.017000 -0.033500710 -0.0004992900 0.0375104
## m248_s+acc-LA_s+acc       -0.037000 -0.050729421 -0.0232705794 0.0000000
## m248_s+mock-LA_s+acc      -0.030000 -0.043729421 -0.0162705794 0.0000000
## m248_s+noacc-LA_s+acc     -0.025900 -0.039629421 -0.0121705794 0.0000007
## LA_s+noacc-LA_s+mock      -0.003500 -0.017972080  0.0109720800 0.9996049
## m248_c+acc-LA_s+mock      -0.019800 -0.033529421 -0.0060705794 0.0003289
## m248_c+mock-LA_s+mock     -0.023800 -0.037529421 -0.0100705794 0.0000061
## m248_c+noacc-LA_s+mock    -0.016000 -0.032500710  0.0005007100 0.0660045
## m248_s+acc-LA_s+mock      -0.036000 -0.049729421 -0.0222705794 0.0000000
## m248_s+mock-LA_s+mock     -0.029000 -0.042729421 -0.0152705794 0.0000000
## m248_s+noacc-LA_s+mock    -0.024900 -0.038629421 -0.0111705794 0.0000019
## m248_c+acc-LA_s+noacc     -0.016300 -0.030029421 -0.0025705794 0.0072669
## m248_c+mock-LA_s+noacc    -0.020300 -0.034029421 -0.0065705794 0.0002042
## m248_c+noacc-LA_s+noacc   -0.012500 -0.029000710  0.0040007100 0.3275898
## m248_s+acc-LA_s+noacc     -0.032500 -0.046229421 -0.0187705794 0.0000000
## m248_s+mock-LA_s+noacc    -0.025500 -0.039229421 -0.0117705794 0.0000010
## m248_s+noacc-LA_s+noacc   -0.021400 -0.035129421 -0.0076705794 0.0000698
## m248_c+mock-m248_c+acc    -0.004000 -0.016944222  0.0089442219 0.9963125
## m248_c+noacc-m248_c+acc    0.003800 -0.012053369  0.0196533693 0.9996370
## m248_s+acc-m248_c+acc     -0.016200 -0.029144222 -0.0032557781 0.0034807
## m248_s+mock-m248_c+acc    -0.009200 -0.022144222  0.0037442219 0.4257287
## m248_s+noacc-m248_c+acc   -0.005100 -0.018044222  0.0078442219 0.9737588
## m248_c+noacc-m248_c+mock   0.007800 -0.008053369  0.0236533693 0.8840050
## m248_s+acc-m248_c+mock    -0.012200 -0.025144222  0.0007442219 0.0838337
## m248_s+mock-m248_c+mock   -0.005200 -0.018144222  0.0077442219 0.9697247
## m248_s+noacc-m248_c+mock  -0.001100 -0.014044222  0.0118442219 1.0000000
## m248_s+acc-m248_c+noacc   -0.020000 -0.035853369 -0.0041466307 0.0030936
## m248_s+mock-m248_c+noacc  -0.013000 -0.028853369  0.0028533693 0.2185816
## m248_s+noacc-m248_c+noacc -0.008900 -0.024753369  0.0069533693 0.7646623
## m248_s+mock-m248_s+acc     0.007000 -0.005944222  0.0199442219 0.8046160
## m248_s+noacc-m248_s+acc    0.011100 -0.001844222  0.0240442219 0.1666397
## m248_s+noacc-m248_s+mock   0.004100 -0.008844222  0.0170442219 0.9954394
P8 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P8)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##         "ab"        "abc"          "a"         "ab"         "ab"         "cd" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##         "de"        "bcd"          "e"         "de"         "de"         "ab"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_early
Crop_early$Genotype<- factor(Crop_early$Genotype, levels=c("LA", "m248"))
Crop_early$condition<- factor(Crop_early$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_early, mapping = aes(x = Genotype, y = Fv.Fm, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("Fv/Fm") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 0.83)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(Fqp.Fmp ~ All.ID, data = Crop_early)
## Call:
##    aov(formula = Fqp.Fmp ~ All.ID, data = Crop_early)
## 
## Terms:
##                     All.ID  Residuals
## Sum of Squares  0.04052058 0.15000593
## Deg. of Freedom         11         87
## 
## Residual standard error: 0.04152356
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Fqp.Fmp ~ All.ID, data = Crop_early))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Fqp.Fmp ~ All.ID, data = Crop_early)
## 
## $All.ID
##                                diff         lwr          upr     p adj
## LA_c+mock-LA_c+acc        -0.025000 -0.09473264  0.044732644 0.9873073
## LA_c+noacc-LA_c+acc        0.019125 -0.06627970  0.104529698 0.9998114
## LA_s+acc-LA_c+acc         -0.012375 -0.08210764  0.057357644 0.9999814
## LA_s+mock-LA_c+acc        -0.002125 -0.07185764  0.067607644 1.0000000
## LA_s+noacc-LA_c+acc        0.026000 -0.04373264  0.095732644 0.9827309
## m248_c+acc-LA_c+acc       -0.001275 -0.06742919  0.064879194 1.0000000
## m248_c+mock-LA_c+acc      -0.024375 -0.09052919  0.041779194 0.9842520
## m248_c+noacc-LA_c+acc      0.031225 -0.04828245  0.110732447 0.9743799
## m248_s+acc-LA_c+acc       -0.044375 -0.11052919  0.021779194 0.5171463
## m248_s+mock-LA_c+acc      -0.018075 -0.08422919  0.048079194 0.9987674
## m248_s+noacc-LA_c+acc     -0.010175 -0.07632919  0.055979194 0.9999957
## LA_c+noacc-LA_c+mock       0.044125 -0.04127970  0.129529698 0.8467284
## LA_s+acc-LA_c+mock         0.012625 -0.05710764  0.082357644 0.9999772
## LA_s+mock-LA_c+mock        0.022875 -0.04685764  0.092607644 0.9938627
## LA_s+noacc-LA_c+mock       0.051000 -0.01873264  0.120732644 0.3810033
## m248_c+acc-LA_c+mock       0.023725 -0.04242919  0.089879194 0.9872736
## m248_c+mock-LA_c+mock      0.000625 -0.06552919  0.066779194 1.0000000
## m248_c+noacc-LA_c+mock     0.056225 -0.02328245  0.135732447 0.4336845
## m248_s+acc-LA_c+mock      -0.019375 -0.08552919  0.046779194 0.9976963
## m248_s+mock-LA_c+mock      0.006925 -0.05922919  0.073079194 0.9999999
## m248_s+noacc-LA_c+mock     0.014825 -0.05132919  0.080979194 0.9998100
## LA_s+acc-LA_c+noacc       -0.031500 -0.11690470  0.053904698 0.9841266
## LA_s+mock-LA_c+noacc      -0.021250 -0.10665470  0.064154698 0.9994829
## LA_s+noacc-LA_c+noacc      0.006875 -0.07852970  0.092279698 1.0000000
## m248_c+acc-LA_c+noacc     -0.020400 -0.10290878  0.062108777 0.9995129
## m248_c+mock-LA_c+noacc    -0.043500 -0.12600878  0.039008777 0.8289529
## m248_c+noacc-LA_c+noacc    0.012100 -0.08145616  0.105656159 0.9999993
## m248_s+acc-LA_c+noacc     -0.063500 -0.14600878  0.019008777 0.3044043
## m248_s+mock-LA_c+noacc    -0.037200 -0.11970878  0.045308777 0.9326301
## m248_s+noacc-LA_c+noacc   -0.029300 -0.11180878  0.053208777 0.9882363
## LA_s+mock-LA_s+acc         0.010250 -0.05948264  0.079982644 0.9999973
## LA_s+noacc-LA_s+acc        0.038375 -0.03135764  0.108107644 0.7865588
## m248_c+acc-LA_s+acc        0.011100 -0.05505419  0.077254194 0.9999895
## m248_c+mock-LA_s+acc      -0.012000 -0.07815419  0.054154194 0.9999768
## m248_c+noacc-LA_s+acc      0.043600 -0.03590745  0.123107447 0.7902936
## m248_s+acc-LA_s+acc       -0.032000 -0.09815419  0.034154194 0.8951745
## m248_s+mock-LA_s+acc      -0.005700 -0.07185419  0.060454194 1.0000000
## m248_s+noacc-LA_s+acc      0.002200 -0.06395419  0.068354194 1.0000000
## LA_s+noacc-LA_s+mock       0.028125 -0.04160764  0.097857644 0.9688328
## m248_c+acc-LA_s+mock       0.000850 -0.06530419  0.067004194 1.0000000
## m248_c+mock-LA_s+mock     -0.022250 -0.08840419  0.043904194 0.9924420
## m248_c+noacc-LA_s+mock     0.033350 -0.04615745  0.112857447 0.9587342
## m248_s+acc-LA_s+mock      -0.042250 -0.10840419  0.023904194 0.5927008
## m248_s+mock-LA_s+mock     -0.015950 -0.08210419  0.050204194 0.9996162
## m248_s+noacc-LA_s+mock    -0.008050 -0.07420419  0.058104194 0.9999996
## m248_c+acc-LA_s+noacc     -0.027275 -0.09342919  0.038879194 0.9634762
## m248_c+mock-LA_s+noacc    -0.050375 -0.11652919  0.015779194 0.3199260
## m248_c+noacc-LA_s+noacc    0.005225 -0.07428245  0.084732447 1.0000000
## m248_s+acc-LA_s+noacc     -0.070375 -0.13652919 -0.004220806 0.0269600
## m248_s+mock-LA_s+noacc    -0.044075 -0.11022919  0.022079194 0.5277721
## m248_s+noacc-LA_s+noacc   -0.036175 -0.10232919  0.029979194 0.7932516
## m248_c+mock-m248_c+acc    -0.023100 -0.08547077  0.039270773 0.9836050
## m248_c+noacc-m248_c+acc    0.032500 -0.04388828  0.108888284 0.9544303
## m248_s+acc-m248_c+acc     -0.043100 -0.10547077  0.019270773 0.4702115
## m248_s+mock-m248_c+acc    -0.016800 -0.07917077  0.045570773 0.9989182
## m248_s+noacc-m248_c+acc   -0.008900 -0.07127077  0.053470773 0.9999980
## m248_c+noacc-m248_c+mock   0.055600 -0.02078828  0.131988284 0.3884525
## m248_s+acc-m248_c+mock    -0.020000 -0.08237077  0.042370773 0.9949353
## m248_s+mock-m248_c+mock    0.006300 -0.05607077  0.068670773 0.9999999
## m248_s+noacc-m248_c+mock   0.014200 -0.04817077  0.076570773 0.9997786
## m248_s+acc-m248_c+noacc   -0.075600 -0.15198828  0.000788284 0.0550185
## m248_s+mock-m248_c+noacc  -0.049300 -0.12568828  0.027088284 0.5768702
## m248_s+noacc-m248_c+noacc -0.041400 -0.11778828  0.034988284 0.8024112
## m248_s+mock-m248_s+acc     0.026300 -0.03607077  0.088670773 0.9571818
## m248_s+noacc-m248_s+acc    0.034200 -0.02817077  0.096570773 0.7903752
## m248_s+noacc-m248_s+mock   0.007900 -0.05447077  0.070270773 0.9999994
P10 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P10)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##         "ab"         "ab"         "ab"         "ab"          "a"         "ab" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##         "ab"         "ab"          "b"         "ab"         "ab"         "ab"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_early
Crop_early$condition<- factor(Crop_early$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))
Crop_early$Genotype<- factor(Crop_early$Genotype, levels=c("LA", "m248"))


Crop_graph <- ggplot(data = Crop_early, mapping = aes(x = Genotype, y = Fqp.Fmp, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("Fqp.Fmp") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 0.6)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(NPQ ~ All.ID, data = Crop_early)
## Call:
##    aov(formula = NPQ ~ All.ID, data = Crop_early)
## 
## Terms:
##                    All.ID Residuals
## Sum of Squares   36.88433 123.37079
## Deg. of Freedom        11        87
## 
## Residual standard error: 1.190821
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(NPQ ~ All.ID, data = Crop_early))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = NPQ ~ All.ID, data = Crop_early)
## 
## $All.ID
##                                diff        lwr       upr     p adj
## LA_c+mock-LA_c+acc         0.057375 -1.9424321 2.0571821 1.0000000
## LA_c+noacc-LA_c+acc       -1.450875 -3.9001285 0.9983785 0.6989670
## LA_s+acc-LA_c+acc          0.103250 -1.8965571 2.1030571 1.0000000
## LA_s+mock-LA_c+acc         0.093250 -1.9065571 2.0930571 1.0000000
## LA_s+noacc-LA_c+acc       -1.528375 -3.5281821 0.4714321 0.3145681
## m248_c+acc-LA_c+acc       -0.750075 -2.6472586 1.1471086 0.9730778
## m248_c+mock-LA_c+acc      -0.724975 -2.6221586 1.1722086 0.9791458
## m248_c+noacc-LA_c+acc     -1.600375 -3.8805059 0.6797559 0.4455474
## m248_s+acc-LA_c+acc       -0.472275 -2.3694586 1.4249086 0.9994805
## m248_s+mock-LA_c+acc      -0.518675 -2.4158586 1.3785086 0.9987605
## m248_s+noacc-LA_c+acc     -1.465775 -3.3629586 0.4314086 0.2988109
## LA_c+noacc-LA_c+mock      -1.508250 -3.9575035 0.9410035 0.6459911
## LA_s+acc-LA_c+mock         0.045875 -1.9539321 2.0456821 1.0000000
## LA_s+mock-LA_c+mock        0.035875 -1.9639321 2.0356821 1.0000000
## LA_s+noacc-LA_c+mock      -1.585750 -3.5855571 0.4140571 0.2624064
## m248_c+acc-LA_c+mock      -0.807450 -2.7046336 1.0897336 0.9543212
## m248_c+mock-LA_c+mock     -0.782350 -2.6795336 1.1148336 0.9634255
## m248_c+noacc-LA_c+mock    -1.657750 -3.9378809 0.6223809 0.3902022
## m248_s+acc-LA_c+mock      -0.529650 -2.4268336 1.3675336 0.9985006
## m248_s+mock-LA_c+mock     -0.576050 -2.4732336 1.3211336 0.9968351
## m248_s+noacc-LA_c+mock    -1.523150 -3.4203336 0.3740336 0.2457635
## LA_s+acc-LA_c+noacc        1.554125 -0.8951285 4.0033785 0.6023966
## LA_s+mock-LA_c+noacc       1.544125 -0.9051285 3.9933785 0.6119602
## LA_s+noacc-LA_c+noacc     -0.077500 -2.5267535 2.3717535 1.0000000
## m248_c+acc-LA_c+noacc      0.700800 -1.6654037 3.0670037 0.9974565
## m248_c+mock-LA_c+noacc     0.725900 -1.6403037 3.0921037 0.9965380
## m248_c+noacc-LA_c+noacc   -0.149500 -2.8325228 2.5335228 1.0000000
## m248_s+acc-LA_c+noacc      0.978600 -1.3876037 3.3448037 0.9626600
## m248_s+mock-LA_c+noacc     0.932200 -1.4340037 3.2984037 0.9737755
## m248_s+noacc-LA_c+noacc   -0.014900 -2.3811037 2.3513037 1.0000000
## LA_s+mock-LA_s+acc        -0.010000 -2.0098071 1.9898071 1.0000000
## LA_s+noacc-LA_s+acc       -1.631625 -3.6314321 0.3681821 0.2249148
## m248_c+acc-LA_s+acc       -0.853325 -2.7505086 1.0438586 0.9336761
## m248_c+mock-LA_s+acc      -0.828225 -2.7254086 1.0689586 0.9456380
## m248_c+noacc-LA_s+acc     -1.703625 -3.9837559 0.5765059 0.3482806
## m248_s+acc-LA_s+acc       -0.575525 -2.4727086 1.3216586 0.9968602
## m248_s+mock-LA_s+acc      -0.621925 -2.5191086 1.2752586 0.9938978
## m248_s+noacc-LA_s+acc     -1.569025 -3.4662086 0.3281586 0.2080956
## LA_s+noacc-LA_s+mock      -1.621625 -3.6214321 0.3781821 0.2327611
## m248_c+acc-LA_s+mock      -0.843325 -2.7405086 1.0538586 0.9386396
## m248_c+mock-LA_s+mock     -0.818225 -2.7154086 1.0789586 0.9499517
## m248_c+noacc-LA_s+mock    -1.693625 -3.9737559 0.5865059 0.3572203
## m248_s+acc-LA_s+mock      -0.565525 -2.4627086 1.3316586 0.9973076
## m248_s+mock-LA_s+mock     -0.611925 -2.5091086 1.2852586 0.9946776
## m248_s+noacc-LA_s+mock    -1.559025 -3.4562086 0.3381586 0.2159427
## m248_c+acc-LA_s+noacc      0.778300 -1.1188836 2.6754836 0.9647593
## m248_c+mock-LA_s+noacc     0.803400 -1.0937836 2.7005836 0.9558905
## m248_c+noacc-LA_s+noacc   -0.072000 -2.3521309 2.2081309 1.0000000
## m248_s+acc-LA_s+noacc      1.056100 -0.8410836 2.9532836 0.7741215
## m248_s+mock-LA_s+noacc     1.009700 -0.8874836 2.9068836 0.8201860
## m248_s+noacc-LA_s+noacc    0.062600 -1.8345836 1.9597836 1.0000000
## m248_c+mock-m248_c+acc     0.025100 -1.7635818 1.8137818 1.0000000
## m248_c+noacc-m248_c+acc   -0.850300 -3.0409789 1.3403789 0.9765342
## m248_s+acc-m248_c+acc      0.277800 -1.5108818 2.0664818 0.9999953
## m248_s+mock-m248_c+acc     0.231400 -1.5572818 2.0200818 0.9999993
## m248_s+noacc-m248_c+acc   -0.715700 -2.5043818 1.0729818 0.9705942
## m248_c+noacc-m248_c+mock  -0.875400 -3.0660789 1.3152789 0.9708759
## m248_s+acc-m248_c+mock     0.252700 -1.5359818 2.0413818 0.9999982
## m248_s+mock-m248_c+mock    0.206300 -1.5823818 1.9949818 0.9999998
## m248_s+noacc-m248_c+mock  -0.740800 -2.5294818 1.0478818 0.9622819
## m248_s+acc-m248_c+noacc    1.128100 -1.0625789 3.3187789 0.8494965
## m248_s+mock-m248_c+noacc   1.081700 -1.1089789 3.2723789 0.8815375
## m248_s+noacc-m248_c+noacc  0.134600 -2.0560789 2.3252789 1.0000000
## m248_s+mock-m248_s+acc    -0.046400 -1.8350818 1.7422818 1.0000000
## m248_s+noacc-m248_s+acc   -0.993500 -2.7821818 0.7951818 0.7765554
## m248_s+noacc-m248_s+mock  -0.947100 -2.7357818 0.8415818 0.8249791
P12 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P12)
stat.test
## $Letters
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##          "a"          "a"          "a"          "a"          "a"          "a" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##          "a"          "a"          "a"          "a"          "a"          "a" 
## 
## $LetterMatrix
##                 a
## LA_c+mock    TRUE
## LA_c+noacc   TRUE
## LA_s+acc     TRUE
## LA_s+mock    TRUE
## LA_s+noacc   TRUE
## m248_c+acc   TRUE
## m248_c+mock  TRUE
## m248_c+noacc TRUE
## m248_s+acc   TRUE
## m248_s+mock  TRUE
## m248_s+noacc TRUE
## LA_c+acc     TRUE
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_early
Crop_early$Genotype<- factor(Crop_early$Genotype, levels=c("LA", "m248"))
Crop_early$condition<- factor(Crop_early$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_early, mapping = aes(x = Genotype, y = NPQ, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("NPQ") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 5)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(ChlIdx ~ All.ID, data = Crop_early)
## Call:
##    aov(formula = ChlIdx ~ All.ID, data = Crop_early)
## 
## Terms:
##                   All.ID Residuals
## Sum of Squares  1.512881  1.244120
## Deg. of Freedom       11        87
## 
## Residual standard error: 0.1195836
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(ChlIdx ~ All.ID, data = Crop_early))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ChlIdx ~ All.ID, data = Crop_early)
## 
## $All.ID
##                                diff          lwr          upr     p adj
## LA_c+mock-LA_c+acc         0.069000 -0.131822789  0.269822789 0.9909926
## LA_c+noacc-LA_c+acc        0.030625 -0.215331681  0.276581681 0.9999995
## LA_s+acc-LA_c+acc          0.049625 -0.151197789  0.250447789 0.9995154
## LA_s+mock-LA_c+acc         0.204625  0.003802211  0.405447789 0.0418205
## LA_s+noacc-LA_c+acc        0.101000 -0.099822789  0.301822789 0.8682317
## m248_c+acc-LA_c+acc       -0.200275 -0.390792226 -0.009757774 0.0305592
## m248_c+mock-LA_c+acc      -0.070275 -0.260792226  0.120242226 0.9841158
## m248_c+noacc-LA_c+acc     -0.094375 -0.323348209  0.134598209 0.9635573
## m248_s+acc-LA_c+acc       -0.211575 -0.402092226 -0.021057774 0.0166934
## m248_s+mock-LA_c+acc      -0.102875 -0.293392226  0.087642226 0.8061045
## m248_s+noacc-LA_c+acc     -0.122675 -0.313192226  0.067842226 0.5803599
## LA_c+noacc-LA_c+mock      -0.038375 -0.284331681  0.207581681 0.9999950
## LA_s+acc-LA_c+mock        -0.019375 -0.220197789  0.181447789 1.0000000
## LA_s+mock-LA_c+mock        0.135625 -0.065197789  0.336447789 0.5064830
## LA_s+noacc-LA_c+mock       0.032000 -0.168822789  0.232822789 0.9999938
## m248_c+acc-LA_c+mock      -0.269275 -0.459792226 -0.078757774 0.0004767
## m248_c+mock-LA_c+mock     -0.139275 -0.329792226  0.051242226 0.3816988
## m248_c+noacc-LA_c+mock    -0.163375 -0.392348209  0.065598209 0.4196040
## m248_s+acc-LA_c+mock      -0.280575 -0.471092226 -0.090057774 0.0002206
## m248_s+mock-LA_c+mock     -0.171875 -0.362392226  0.018642226 0.1175772
## m248_s+noacc-LA_c+mock    -0.191675 -0.382192226 -0.001157774 0.0472346
## LA_s+acc-LA_c+noacc        0.019000 -0.226956681  0.264956681 1.0000000
## LA_s+mock-LA_c+noacc       0.174000 -0.071956681  0.419956681 0.4330703
## LA_s+noacc-LA_c+noacc      0.070375 -0.175581681  0.316331681 0.9981288
## m248_c+acc-LA_c+noacc     -0.230900 -0.468516729  0.006716729 0.0647838
## m248_c+mock-LA_c+noacc    -0.100900 -0.338516729  0.136716729 0.9550400
## m248_c+noacc-LA_c+noacc   -0.125000 -0.394432045  0.144432045 0.9190134
## m248_s+acc-LA_c+noacc     -0.242200 -0.479816729 -0.004583271 0.0416789
## m248_s+mock-LA_c+noacc    -0.133500 -0.371116729  0.104116729 0.7637851
## m248_s+noacc-LA_c+noacc   -0.153300 -0.390916729  0.084316729 0.5774127
## LA_s+mock-LA_s+acc         0.155000 -0.045822789  0.355822789 0.3002658
## LA_s+noacc-LA_s+acc        0.051375 -0.149447789  0.252197789 0.9993289
## m248_c+acc-LA_s+acc       -0.249900 -0.440417226 -0.059382774 0.0016978
## m248_c+mock-LA_s+acc      -0.119900 -0.310417226  0.070617226 0.6145504
## m248_c+noacc-LA_s+acc     -0.144000 -0.372973209  0.084973209 0.6155899
## m248_s+acc-LA_s+acc       -0.261200 -0.451717226 -0.070682774 0.0008160
## m248_s+mock-LA_s+acc      -0.152500 -0.343017226  0.038017226 0.2497269
## m248_s+noacc-LA_s+acc     -0.172300 -0.362817226  0.018217226 0.1154631
## LA_s+noacc-LA_s+mock      -0.103625 -0.304447789  0.097197789 0.8477971
## m248_c+acc-LA_s+mock      -0.404900 -0.595417226 -0.214382774 0.0000000
## m248_c+mock-LA_s+mock     -0.274900 -0.465417226 -0.084382774 0.0003257
## m248_c+noacc-LA_s+mock    -0.299000 -0.527973209 -0.070026791 0.0018229
## m248_s+acc-LA_s+mock      -0.416200 -0.606717226 -0.225682774 0.0000000
## m248_s+mock-LA_s+mock     -0.307500 -0.498017226 -0.116982774 0.0000327
## m248_s+noacc-LA_s+mock    -0.327300 -0.517817226 -0.136782774 0.0000076
## m248_c+acc-LA_s+noacc     -0.301275 -0.491792226 -0.110757774 0.0000512
## m248_c+mock-LA_s+noacc    -0.171275 -0.361792226  0.019242226 0.1206142
## m248_c+noacc-LA_s+noacc   -0.195375 -0.424348209  0.033598209 0.1720306
## m248_s+acc-LA_s+noacc     -0.312575 -0.503092226 -0.122057774 0.0000225
## m248_s+mock-LA_s+noacc    -0.203875 -0.394392226 -0.013357774 0.0253025
## m248_s+noacc-LA_s+noacc   -0.223675 -0.414192226 -0.033157774 0.0084157
## m248_c+mock-m248_c+acc     0.130000 -0.049621363  0.309621363 0.3972833
## m248_c+noacc-m248_c+acc    0.105900 -0.114090343  0.325890343 0.8981928
## m248_s+acc-m248_c+acc     -0.011300 -0.190921363  0.168321363 1.0000000
## m248_s+mock-m248_c+acc     0.097400 -0.082221363  0.277021363 0.8018818
## m248_s+noacc-m248_c+acc    0.077600 -0.102021363  0.257221363 0.9493646
## m248_c+noacc-m248_c+mock  -0.024100 -0.244090343  0.195890343 0.9999999
## m248_s+acc-m248_c+mock    -0.141300 -0.320921363  0.038321363 0.2733616
## m248_s+mock-m248_c+mock   -0.032600 -0.212221363  0.147021363 0.9999766
## m248_s+noacc-m248_c+mock  -0.052400 -0.232021363  0.127221363 0.9977755
## m248_s+acc-m248_c+noacc   -0.117200 -0.337190343  0.102790343 0.8192232
## m248_s+mock-m248_c+noacc  -0.008500 -0.228490343  0.211490343 1.0000000
## m248_s+noacc-m248_c+noacc -0.028300 -0.248290343  0.191690343 0.9999993
## m248_s+mock-m248_s+acc     0.108700 -0.070921363  0.288321363 0.6703191
## m248_s+noacc-m248_s+acc    0.088900 -0.090721363  0.268521363 0.8799040
## m248_s+noacc-m248_s+mock  -0.019800 -0.199421363  0.159821363 0.9999999
P14 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P14)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##        "abc"      "abcde"       "abcd"          "a"         "ab"         "ef" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##      "bcdef"      "bcdef"          "f"       "cdef"        "def"        "bcd"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_early
Crop_early$Genotype<- factor(Crop_early$Genotype, levels=c("LA", "m248"))
Crop_early$condition<- factor(Crop_early$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_early, mapping = aes(x = Genotype, y = ChlIdx, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("ChlIdx") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 2.5)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(AriIdx ~ All.ID, data = Crop_early)
## Call:
##    aov(formula = AriIdx ~ All.ID, data = Crop_early)
## 
## Terms:
##                   All.ID Residuals
## Sum of Squares  25.77635   5.70175
## Deg. of Freedom       11        87
## 
## Residual standard error: 0.2560026
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(AriIdx ~ All.ID, data = Crop_early))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = AriIdx ~ All.ID, data = Crop_early)
## 
## $All.ID
##                                diff         lwr           upr     p adj
## LA_c+mock-LA_c+acc        -0.224000 -0.65391837  0.2059183670 0.8394970
## LA_c+noacc-LA_c+acc       -0.020750 -0.54729032  0.5057903151 1.0000000
## LA_s+acc-LA_c+acc         -0.204125 -0.63404337  0.2257933670 0.9064128
## LA_s+mock-LA_c+acc         0.109500 -0.32041837  0.5394183670 0.9993559
## LA_s+noacc-LA_c+acc       -0.299250 -0.72916837  0.1306683670 0.4587183
## m248_c+acc-LA_c+acc       -1.029700 -1.43755637 -0.6218436257 0.0000000
## m248_c+mock-LA_c+acc      -0.890000 -1.29785637 -0.4821436257 0.0000000
## m248_c+noacc-LA_c+acc     -0.788800 -1.27898236 -0.2986176432 0.0000349
## m248_s+acc-LA_c+acc       -1.311500 -1.71935637 -0.9036436257 0.0000000
## m248_s+mock-LA_c+acc      -0.981800 -1.38965637 -0.5739436257 0.0000000
## m248_s+noacc-LA_c+acc     -1.326800 -1.73465637 -0.9189436257 0.0000000
## LA_c+noacc-LA_c+mock       0.203250 -0.32329032  0.7297903151 0.9774883
## LA_s+acc-LA_c+mock         0.019875 -0.41004337  0.4497933670 1.0000000
## LA_s+mock-LA_c+mock        0.333500 -0.09641837  0.7634183670 0.2930354
## LA_s+noacc-LA_c+mock      -0.075250 -0.50516837  0.3546683670 0.9999838
## m248_c+acc-LA_c+mock      -0.805700 -1.21355637 -0.3978436257 0.0000002
## m248_c+mock-LA_c+mock     -0.666000 -1.07385637 -0.2581436257 0.0000251
## m248_c+noacc-LA_c+mock    -0.564800 -1.05498236 -0.0746176432 0.0106922
## m248_s+acc-LA_c+mock      -1.087500 -1.49535637 -0.6796436257 0.0000000
## m248_s+mock-LA_c+mock     -0.757800 -1.16565637 -0.3499436257 0.0000010
## m248_s+noacc-LA_c+mock    -1.102800 -1.51065637 -0.6949436257 0.0000000
## LA_s+acc-LA_c+noacc       -0.183375 -0.70991532  0.3431653151 0.9899446
## LA_s+mock-LA_c+noacc       0.130250 -0.39629032  0.6567903151 0.9995106
## LA_s+noacc-LA_c+noacc     -0.278500 -0.80504032  0.2480403151 0.8259803
## m248_c+acc-LA_c+noacc     -1.008950 -1.51763627 -0.5002637282 0.0000002
## m248_c+mock-LA_c+noacc    -0.869250 -1.37793627 -0.3605637282 0.0000086
## m248_c+noacc-LA_c+noacc   -0.768050 -1.34484602 -0.1912539840 0.0013315
## m248_s+acc-LA_c+noacc     -1.290750 -1.79943627 -0.7820637282 0.0000000
## m248_s+mock-LA_c+noacc    -0.961050 -1.46973627 -0.4523637282 0.0000006
## m248_s+noacc-LA_c+noacc   -1.306050 -1.81473627 -0.7973637282 0.0000000
## LA_s+mock-LA_s+acc         0.313625 -0.11629337  0.7435433670 0.3849612
## LA_s+noacc-LA_s+acc       -0.095125 -0.52504337  0.3347933670 0.9998322
## m248_c+acc-LA_s+acc       -0.825575 -1.23343137 -0.4177186257 0.0000001
## m248_c+mock-LA_s+acc      -0.685875 -1.09373137 -0.2780186257 0.0000127
## m248_c+noacc-LA_s+acc     -0.584675 -1.07485736 -0.0944926432 0.0068295
## m248_s+acc-LA_s+acc       -1.107375 -1.51523137 -0.6995186257 0.0000000
## m248_s+mock-LA_s+acc      -0.777675 -1.18553137 -0.3698186257 0.0000005
## m248_s+noacc-LA_s+acc     -1.122675 -1.53053137 -0.7148186257 0.0000000
## LA_s+noacc-LA_s+mock      -0.408750 -0.83866837  0.0211683670 0.0780288
## m248_c+acc-LA_s+mock      -1.139200 -1.54705637 -0.7313436257 0.0000000
## m248_c+mock-LA_s+mock     -0.999500 -1.40735637 -0.5916436257 0.0000000
## m248_c+noacc-LA_s+mock    -0.898300 -1.38848236 -0.4081176432 0.0000014
## m248_s+acc-LA_s+mock      -1.421000 -1.82885637 -1.0131436257 0.0000000
## m248_s+mock-LA_s+mock     -1.091300 -1.49915637 -0.6834436257 0.0000000
## m248_s+noacc-LA_s+mock    -1.436300 -1.84415637 -1.0284436257 0.0000000
## m248_c+acc-LA_s+noacc     -0.730450 -1.13830637 -0.3225936257 0.0000026
## m248_c+mock-LA_s+noacc    -0.590750 -0.99860637 -0.1828936257 0.0003032
## m248_c+noacc-LA_s+noacc   -0.489550 -0.97973236  0.0006323568 0.0506048
## m248_s+acc-LA_s+noacc     -1.012250 -1.42010637 -0.6043936257 0.0000000
## m248_s+mock-LA_s+noacc    -0.682550 -1.09040637 -0.2746936257 0.0000142
## m248_s+noacc-LA_s+noacc   -1.027550 -1.43540637 -0.6196936257 0.0000000
## m248_c+mock-m248_c+acc     0.139700 -0.24483068  0.5242306773 0.9859010
## m248_c+noacc-m248_c+acc    0.240900 -0.23005197  0.7118519749 0.8549973
## m248_s+acc-m248_c+acc     -0.281800 -0.66633068  0.1027306773 0.3778844
## m248_s+mock-m248_c+acc     0.047900 -0.33663068  0.4324306773 0.9999995
## m248_s+noacc-m248_c+acc   -0.297100 -0.68163068  0.0874306773 0.2987655
## m248_c+noacc-m248_c+mock   0.101200 -0.36975197  0.5721519749 0.9998739
## m248_s+acc-m248_c+mock    -0.421500 -0.80603068 -0.0369693227 0.0193932
## m248_s+mock-m248_c+mock   -0.091800 -0.47633068  0.2927306773 0.9996507
## m248_s+noacc-m248_c+mock  -0.436800 -0.82133068 -0.0522693227 0.0127501
## m248_s+acc-m248_c+noacc   -0.522700 -0.99365197 -0.0517480251 0.0168076
## m248_s+mock-m248_c+noacc  -0.193000 -0.66395197  0.2779519749 0.9650244
## m248_s+noacc-m248_c+noacc -0.538000 -1.00895197 -0.0670480251 0.0118971
## m248_s+mock-m248_s+acc     0.329700 -0.05483068  0.7142306773 0.1667856
## m248_s+noacc-m248_s+acc   -0.015300 -0.39983068  0.3692306773 1.0000000
## m248_s+noacc-m248_s+mock  -0.345000 -0.72953068  0.0395306773 0.1223803
P16 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P16)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##          "a"          "a"          "a"          "a"         "ab"         "cd" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##          "c"         "bc"          "d"         "cd"          "d"          "a"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_early
Crop_early$Genotype<- factor(Crop_early$Genotype, levels=c("LA", "m248"))
Crop_early$condition<- factor(Crop_early$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_early, mapping = aes(x = Genotype, y = AriIdx, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("AriIdx") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 4.5)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(Alpha ~ All.ID, data = Crop_early)
## Call:
##    aov(formula = Alpha ~ All.ID, data = Crop_early)
## 
## Terms:
##                     All.ID  Residuals
## Sum of Squares  0.01822712 0.01501090
## Deg. of Freedom         11         87
## 
## Residual standard error: 0.01313541
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Alpha ~ All.ID, data = Crop_early))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Alpha ~ All.ID, data = Crop_early)
## 
## $All.ID
##                                    diff          lwr           upr     p adj
## LA_c+mock-LA_c+acc        -9.750000e-03 -0.031808973  0.0123089731 0.9409169
## LA_c+noacc-LA_c+acc       -1.110223e-16 -0.027016614  0.0270166141 1.0000000
## LA_s+acc-LA_c+acc         -9.125000e-03 -0.031183973  0.0129339731 0.9626021
## LA_s+mock-LA_c+acc        -3.412500e-02 -0.056183973 -0.0120660269 0.0000818
## LA_s+noacc-LA_c+acc       -3.975000e-02 -0.061808973 -0.0176910269 0.0000023
## m248_c+acc-LA_c+acc       -1.250000e-03 -0.022176979  0.0196769793 1.0000000
## m248_c+mock-LA_c+acc      -4.550000e-03 -0.025476979  0.0163769793 0.9998585
## m248_c+noacc-LA_c+acc      5.000000e-05 -0.025101099  0.0252010990 1.0000000
## m248_s+acc-LA_c+acc       -1.715000e-02 -0.038076979  0.0037769793 0.2193409
## m248_s+mock-LA_c+acc      -2.775000e-02 -0.048676979 -0.0068230207 0.0014252
## m248_s+noacc-LA_c+acc     -2.695000e-02 -0.047876979 -0.0060230207 0.0022647
## LA_c+noacc-LA_c+mock       9.750000e-03 -0.017266614  0.0367666141 0.9866237
## LA_s+acc-LA_c+mock         6.250000e-04 -0.021433973  0.0226839731 1.0000000
## LA_s+mock-LA_c+mock       -2.437500e-02 -0.046433973 -0.0023160269 0.0176890
## LA_s+noacc-LA_c+mock      -3.000000e-02 -0.052058973 -0.0079410269 0.0009366
## m248_c+acc-LA_c+mock       8.500000e-03 -0.012426979  0.0294269793 0.9671996
## m248_c+mock-LA_c+mock      5.200000e-03 -0.015726979  0.0261269793 0.9994894
## m248_c+noacc-LA_c+mock     9.800000e-03 -0.015351099  0.0349510990 0.9758451
## m248_s+acc-LA_c+mock      -7.400000e-03 -0.028326979  0.0135269793 0.9886297
## m248_s+mock-LA_c+mock     -1.800000e-02 -0.038926979  0.0029269793 0.1634017
## m248_s+noacc-LA_c+mock    -1.720000e-02 -0.038126979  0.0037269793 0.2157196
## LA_s+acc-LA_c+noacc       -9.125000e-03 -0.036141614  0.0178916141 0.9921742
## LA_s+mock-LA_c+noacc      -3.412500e-02 -0.061141614 -0.0071083859 0.0030376
## LA_s+noacc-LA_c+noacc     -3.975000e-02 -0.066766614 -0.0127333859 0.0002247
## m248_c+acc-LA_c+noacc     -1.250000e-03 -0.027350529  0.0248505289 1.0000000
## m248_c+mock-LA_c+noacc    -4.550000e-03 -0.030650529  0.0215505289 0.9999845
## m248_c+noacc-LA_c+noacc    5.000000e-05 -0.029545218  0.0296452180 1.0000000
## m248_s+acc-LA_c+noacc     -1.715000e-02 -0.043250529  0.0089505289 0.5493349
## m248_s+mock-LA_c+noacc    -2.775000e-02 -0.053850529 -0.0016494711 0.0271241
## m248_s+noacc-LA_c+noacc   -2.695000e-02 -0.053050529 -0.0008494711 0.0366891
## LA_s+mock-LA_s+acc        -2.500000e-02 -0.047058973 -0.0029410269 0.0131109
## LA_s+noacc-LA_s+acc       -3.062500e-02 -0.052683973 -0.0085660269 0.0006560
## m248_c+acc-LA_s+acc        7.875000e-03 -0.013051979  0.0288019793 0.9814566
## m248_c+mock-LA_s+acc       4.575000e-03 -0.016351979  0.0255019793 0.9998507
## m248_c+noacc-LA_s+acc      9.175000e-03 -0.015976099  0.0343260990 0.9854376
## m248_s+acc-LA_s+acc       -8.025000e-03 -0.028951979  0.0129019793 0.9785823
## m248_s+mock-LA_s+acc      -1.862500e-02 -0.039551979  0.0023019793 0.1296383
## m248_s+noacc-LA_s+acc     -1.782500e-02 -0.038751979  0.0031019793 0.1739524
## LA_s+noacc-LA_s+mock      -5.625000e-03 -0.027683973  0.0164339731 0.9993488
## m248_c+acc-LA_s+mock       3.287500e-02  0.011948021  0.0538019793 0.0000591
## m248_c+mock-LA_s+mock      2.957500e-02  0.008648021  0.0505019793 0.0004775
## m248_c+noacc-LA_s+mock     3.417500e-02  0.009023901  0.0593260990 0.0009507
## m248_s+acc-LA_s+mock       1.697500e-02 -0.003951979  0.0379019793 0.2323436
## m248_s+mock-LA_s+mock      6.375000e-03 -0.014551979  0.0273019793 0.9967433
## m248_s+noacc-LA_s+mock     7.175000e-03 -0.013751979  0.0281019793 0.9911474
## m248_c+acc-LA_s+noacc      3.850000e-02  0.017573021  0.0594269793 0.0000013
## m248_c+mock-LA_s+noacc     3.520000e-02  0.014273021  0.0561269793 0.0000126
## m248_c+noacc-LA_s+noacc    3.980000e-02  0.014648901  0.0649510990 0.0000505
## m248_s+acc-LA_s+noacc      2.260000e-02  0.001673021  0.0435269793 0.0229021
## m248_s+mock-LA_s+noacc     1.200000e-02 -0.008926979  0.0329269793 0.7398746
## m248_s+noacc-LA_s+noacc    1.280000e-02 -0.008126979  0.0337269793 0.6555262
## m248_c+mock-m248_c+acc    -3.300000e-03 -0.023030145  0.0164301453 0.9999898
## m248_c+noacc-m248_c+acc    1.300000e-03 -0.022864394  0.0254643943 1.0000000
## m248_s+acc-m248_c+acc     -1.590000e-02 -0.035630145  0.0038301453 0.2408171
## m248_s+mock-m248_c+acc    -2.650000e-02 -0.046230145 -0.0067698547 0.0011549
## m248_s+noacc-m248_c+acc   -2.570000e-02 -0.045430145 -0.0059698547 0.0018961
## m248_c+noacc-m248_c+mock   4.600000e-03 -0.019564394  0.0287643943 0.9999622
## m248_s+acc-m248_c+mock    -1.260000e-02 -0.032330145  0.0071301453 0.5928013
## m248_s+mock-m248_c+mock   -2.320000e-02 -0.042930145 -0.0034698547 0.0082473
## m248_s+noacc-m248_c+mock  -2.240000e-02 -0.042130145 -0.0026698547 0.0128340
## m248_s+acc-m248_c+noacc   -1.720000e-02 -0.041364394  0.0069643943 0.4234044
## m248_s+mock-m248_c+noacc  -2.780000e-02 -0.051964394 -0.0036356057 0.0109000
## m248_s+noacc-m248_c+noacc -2.700000e-02 -0.051164394 -0.0028356057 0.0155381
## m248_s+mock-m248_s+acc    -1.060000e-02 -0.030330145  0.0091301453 0.8111114
## m248_s+noacc-m248_s+acc   -9.800000e-03 -0.029530145  0.0099301453 0.8773745
## m248_s+noacc-m248_s+mock   8.000000e-04 -0.018930145  0.0205301453 1.0000000
P18 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P18)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##         "ab"          "a"         "ab"         "cd"          "c"          "a" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##          "a"          "a"        "abd"        "bcd"        "bcd"          "a"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_early
Crop_early$Genotype<- factor(Crop_early$Genotype, levels=c("LA", "m248"))
Crop_early$condition<- factor(Crop_early$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_early, mapping = aes(x = Genotype, y = Alpha, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("Alpha") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 0.86)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

####NOW calculting for late measurement

Crop_late <- read.csv("all-data-Crop-ACC-20231114.csv")
Crop_late
Crop_late$All.ID<-paste(Crop_late$Genotype, Crop_late$condition, sep="_")
Crop_late
aov(Fv.Fm ~ All.ID, data = Crop_late)
## Call:
##    aov(formula = Fv.Fm ~ All.ID, data = Crop_late)
## 
## Terms:
##                     All.ID  Residuals
## Sum of Squares  0.00118405 0.00142960
## Deg. of Freedom         11         48
## 
## Residual standard error: 0.005457411
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Fv.Fm ~ All.ID, data = Crop_late))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Fv.Fm ~ All.ID, data = Crop_late)
## 
## $All.ID
##                              diff           lwr           upr     p adj
## LA_c+mock-LA_c+acc         0.0056 -0.0062517629  0.0174517629 0.8921151
## LA_c+noacc-LA_c+acc        0.0020 -0.0098517629  0.0138517629 0.9999834
## LA_s+acc-LA_c+acc          0.0144  0.0025482371  0.0262517629 0.0063177
## LA_s+mock-LA_c+acc         0.0072 -0.0046517629  0.0190517629 0.6345118
## LA_s+noacc-LA_c+acc       -0.0016 -0.0134517629  0.0102517629 0.9999983
## m248_c+acc-LA_c+acc       -0.0014 -0.0132517629  0.0104517629 0.9999996
## m248_c+mock-LA_c+acc       0.0094 -0.0024517629  0.0212517629 0.2464304
## m248_c+noacc-LA_c+acc      0.0054 -0.0064517629  0.0172517629 0.9132326
## m248_s+acc-LA_c+acc        0.0044 -0.0074517629  0.0162517629 0.9785335
## m248_s+mock-LA_c+acc       0.0058 -0.0060517629  0.0176517629 0.8681272
## m248_s+noacc-LA_c+acc      0.0022 -0.0096517629  0.0140517629 0.9999566
## LA_c+noacc-LA_c+mock      -0.0036 -0.0154517629  0.0082517629 0.9956901
## LA_s+acc-LA_c+mock         0.0088 -0.0030517629  0.0206517629 0.3359534
## LA_s+mock-LA_c+mock        0.0016 -0.0102517629  0.0134517629 0.9999983
## LA_s+noacc-LA_c+mock      -0.0072 -0.0190517629  0.0046517629 0.6345118
## m248_c+acc-LA_c+mock      -0.0070 -0.0188517629  0.0048517629 0.6728503
## m248_c+mock-LA_c+mock      0.0038 -0.0080517629  0.0156517629 0.9932249
## m248_c+noacc-LA_c+mock    -0.0002 -0.0120517629  0.0116517629 1.0000000
## m248_s+acc-LA_c+mock      -0.0012 -0.0130517629  0.0106517629 0.9999999
## m248_s+mock-LA_c+mock      0.0002 -0.0116517629  0.0120517629 1.0000000
## m248_s+noacc-LA_c+mock    -0.0034 -0.0152517629  0.0084517629 0.9973654
## LA_s+acc-LA_c+noacc        0.0124  0.0005482371  0.0242517629 0.0329874
## LA_s+mock-LA_c+noacc       0.0052 -0.0066517629  0.0170517629 0.9314885
## LA_s+noacc-LA_c+noacc     -0.0036 -0.0154517629  0.0082517629 0.9956901
## m248_c+acc-LA_c+noacc     -0.0034 -0.0152517629  0.0084517629 0.9973654
## m248_c+mock-LA_c+noacc     0.0074 -0.0044517629  0.0192517629 0.5955355
## m248_c+noacc-LA_c+noacc    0.0034 -0.0084517629  0.0152517629 0.9973654
## m248_s+acc-LA_c+noacc      0.0024 -0.0094517629  0.0142517629 0.9998974
## m248_s+mock-LA_c+noacc     0.0038 -0.0080517629  0.0156517629 0.9932249
## m248_s+noacc-LA_c+noacc    0.0002 -0.0116517629  0.0120517629 1.0000000
## LA_s+mock-LA_s+acc        -0.0072 -0.0190517629  0.0046517629 0.6345118
## LA_s+noacc-LA_s+acc       -0.0160 -0.0278517629 -0.0041482371 0.0014966
## m248_c+acc-LA_s+acc       -0.0158 -0.0276517629 -0.0039482371 0.0018000
## m248_c+mock-LA_s+acc      -0.0050 -0.0168517629  0.0068517629 0.9469671
## m248_c+noacc-LA_s+acc     -0.0090 -0.0208517629  0.0028517629 0.3042090
## m248_s+acc-LA_s+acc       -0.0100 -0.0218517629  0.0018517629 0.1745985
## m248_s+mock-LA_s+acc      -0.0086 -0.0204517629  0.0032517629 0.3694620
## m248_s+noacc-LA_s+acc     -0.0122 -0.0240517629 -0.0003482371 0.0384732
## LA_s+noacc-LA_s+mock      -0.0088 -0.0206517629  0.0030517629 0.3359534
## m248_c+acc-LA_s+mock      -0.0086 -0.0204517629  0.0032517629 0.3694620
## m248_c+mock-LA_s+mock      0.0022 -0.0096517629  0.0140517629 0.9999566
## m248_c+noacc-LA_s+mock    -0.0018 -0.0136517629  0.0100517629 0.9999943
## m248_s+acc-LA_s+mock      -0.0028 -0.0146517629  0.0090517629 0.9995484
## m248_s+mock-LA_s+mock     -0.0014 -0.0132517629  0.0104517629 0.9999996
## m248_s+noacc-LA_s+mock    -0.0050 -0.0168517629  0.0068517629 0.9469671
## m248_c+acc-LA_s+noacc      0.0002 -0.0116517629  0.0120517629 1.0000000
## m248_c+mock-LA_s+noacc     0.0110 -0.0008517629  0.0228517629 0.0917658
## m248_c+noacc-LA_s+noacc    0.0070 -0.0048517629  0.0188517629 0.6728503
## m248_s+acc-LA_s+noacc      0.0060 -0.0058517629  0.0178517629 0.8413387
## m248_s+mock-LA_s+noacc     0.0074 -0.0044517629  0.0192517629 0.5955355
## m248_s+noacc-LA_s+noacc    0.0038 -0.0080517629  0.0156517629 0.9932249
## m248_c+mock-m248_c+acc     0.0108 -0.0010517629  0.0226517629 0.1050326
## m248_c+noacc-m248_c+acc    0.0068 -0.0050517629  0.0186517629 0.7101424
## m248_s+acc-m248_c+acc      0.0058 -0.0060517629  0.0176517629 0.8681272
## m248_s+mock-m248_c+acc     0.0072 -0.0046517629  0.0190517629 0.6345118
## m248_s+noacc-m248_c+acc    0.0036 -0.0082517629  0.0154517629 0.9956901
## m248_c+noacc-m248_c+mock  -0.0040 -0.0158517629  0.0078517629 0.9897270
## m248_s+acc-m248_c+mock    -0.0050 -0.0168517629  0.0068517629 0.9469671
## m248_s+mock-m248_c+mock   -0.0036 -0.0154517629  0.0082517629 0.9956901
## m248_s+noacc-m248_c+mock  -0.0072 -0.0190517629  0.0046517629 0.6345118
## m248_s+acc-m248_c+noacc   -0.0010 -0.0128517629  0.0108517629 1.0000000
## m248_s+mock-m248_c+noacc   0.0004 -0.0114517629  0.0122517629 1.0000000
## m248_s+noacc-m248_c+noacc -0.0032 -0.0150517629  0.0086517629 0.9984592
## m248_s+mock-m248_s+acc     0.0014 -0.0104517629  0.0132517629 0.9999996
## m248_s+noacc-m248_s+acc   -0.0022 -0.0140517629  0.0096517629 0.9999566
## m248_s+noacc-m248_s+mock  -0.0036 -0.0154517629  0.0082517629 0.9956901
P8 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P8)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##         "ab"          "a"          "b"         "ab"          "a"          "a" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##         "ab"         "ab"         "ab"         "ab"          "a"          "a"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_late
Crop_late$Genotype<- factor(Crop_late$Genotype, levels=c("LA", "m248"))
Crop_late$condition<- factor(Crop_late$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_late, mapping = aes(x = Genotype, y = Fv.Fm, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("Fv/Fm") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 0.82)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(Fqp.Fmp ~ All.ID, data = Crop_late)
## Call:
##    aov(formula = Fqp.Fmp ~ All.ID, data = Crop_late)
## 
## Terms:
##                     All.ID  Residuals
## Sum of Squares  0.08487593 0.03030800
## Deg. of Freedom         11         48
## 
## Residual standard error: 0.02512801
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Fqp.Fmp ~ All.ID, data = Crop_late))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Fqp.Fmp ~ All.ID, data = Crop_late)
## 
## $All.ID
##                              diff           lwr           upr     p adj
## LA_c+mock-LA_c+acc         0.0266 -0.0279700467  0.0811700467 0.8710172
## LA_c+noacc-LA_c+acc       -0.0096 -0.0641700467  0.0449700467 0.9999747
## LA_s+acc-LA_c+acc          0.1064  0.0518299533  0.1609700467 0.0000014
## LA_s+mock-LA_c+acc         0.0274 -0.0271700467  0.0819700467 0.8481745
## LA_s+noacc-LA_c+acc       -0.0248 -0.0793700467  0.0297700467 0.9145862
## m248_c+acc-LA_c+acc       -0.0310 -0.0855700467  0.0235700467 0.7223825
## m248_c+mock-LA_c+acc       0.0312 -0.0233700467  0.0857700467 0.7145000
## m248_c+noacc-LA_c+acc      0.0286 -0.0259700467  0.0831700467 0.8101310
## m248_s+acc-LA_c+acc        0.0784  0.0238299533  0.1329700467 0.0005703
## m248_s+mock-LA_c+acc       0.0244 -0.0301700467  0.0789700467 0.9227786
## m248_s+noacc-LA_c+acc      0.0180 -0.0365700467  0.0725700467 0.9914577
## LA_c+noacc-LA_c+mock      -0.0362 -0.0907700467  0.0183700467 0.5052495
## LA_s+acc-LA_c+mock         0.0798  0.0252299533  0.1343700467 0.0004266
## LA_s+mock-LA_c+mock        0.0008 -0.0537700467  0.0553700467 1.0000000
## LA_s+noacc-LA_c+mock      -0.0514 -0.1059700467  0.0031700467 0.0820056
## m248_c+acc-LA_c+mock      -0.0576 -0.1121700467 -0.0030299533 0.0302853
## m248_c+mock-LA_c+mock      0.0046 -0.0499700467  0.0591700467 1.0000000
## m248_c+noacc-LA_c+mock     0.0020 -0.0525700467  0.0565700467 1.0000000
## m248_s+acc-LA_c+mock       0.0518 -0.0027700467  0.1063700467 0.0771819
## m248_s+mock-LA_c+mock     -0.0022 -0.0567700467  0.0523700467 1.0000000
## m248_s+noacc-LA_c+mock    -0.0086 -0.0631700467  0.0459700467 0.9999917
## LA_s+acc-LA_c+noacc        0.1160  0.0614299533  0.1705700467 0.0000002
## LA_s+mock-LA_c+noacc       0.0370 -0.0175700467  0.0915700467 0.4719369
## LA_s+noacc-LA_c+noacc     -0.0152 -0.0697700467  0.0393700467 0.9979669
## m248_c+acc-LA_c+noacc     -0.0214 -0.0759700467  0.0331700467 0.9679733
## m248_c+mock-LA_c+noacc     0.0408 -0.0137700467  0.0953700467 0.3260584
## m248_c+noacc-LA_c+noacc    0.0382 -0.0163700467  0.0927700467 0.4233218
## m248_s+acc-LA_c+noacc      0.0880  0.0334299533  0.1425700467 0.0000752
## m248_s+mock-LA_c+noacc     0.0340 -0.0205700467  0.0885700467 0.5986147
## m248_s+noacc-LA_c+noacc    0.0276 -0.0269700467  0.0821700467 0.8421412
## LA_s+mock-LA_s+acc        -0.0790 -0.1335700467 -0.0244299533 0.0005037
## LA_s+noacc-LA_s+acc       -0.1312 -0.1857700467 -0.0766299533 0.0000000
## m248_c+acc-LA_s+acc       -0.1374 -0.1919700467 -0.0828299533 0.0000000
## m248_c+mock-LA_s+acc      -0.0752 -0.1297700467 -0.0206299533 0.0010987
## m248_c+noacc-LA_s+acc     -0.0778 -0.1323700467 -0.0232299533 0.0006455
## m248_s+acc-LA_s+acc       -0.0280 -0.0825700467  0.0265700467 0.8296996
## m248_s+mock-LA_s+acc      -0.0820 -0.1365700467 -0.0274299533 0.0002692
## m248_s+noacc-LA_s+acc     -0.0884 -0.1429700467 -0.0338299533 0.0000690
## LA_s+noacc-LA_s+mock      -0.0522 -0.1067700467  0.0023700467 0.0726030
## m248_c+acc-LA_s+mock      -0.0584 -0.1129700467 -0.0038299533 0.0264184
## m248_c+mock-LA_s+mock      0.0038 -0.0507700467  0.0583700467 1.0000000
## m248_c+noacc-LA_s+mock     0.0012 -0.0533700467  0.0557700467 1.0000000
## m248_s+acc-LA_s+mock       0.0510 -0.0035700467  0.1055700467 0.0870830
## m248_s+mock-LA_s+mock     -0.0030 -0.0575700467  0.0515700467 1.0000000
## m248_s+noacc-LA_s+mock    -0.0094 -0.0639700467  0.0451700467 0.9999795
## m248_c+acc-LA_s+noacc     -0.0062 -0.0607700467  0.0483700467 0.9999997
## m248_c+mock-LA_s+noacc     0.0560  0.0014299533  0.1105700467 0.0395938
## m248_c+noacc-LA_s+noacc    0.0534 -0.0011700467  0.1079700467 0.0602425
## m248_s+acc-LA_s+noacc      0.1032  0.0486299533  0.1577700467 0.0000027
## m248_s+mock-LA_s+noacc     0.0492 -0.0053700467  0.1037700467 0.1133198
## m248_s+noacc-LA_s+noacc    0.0428 -0.0117700467  0.0973700467 0.2607695
## m248_c+mock-m248_c+acc     0.0622  0.0076299533  0.1167700467 0.0135097
## m248_c+noacc-m248_c+acc    0.0596  0.0050299533  0.1141700467 0.0214571
## m248_s+acc-m248_c+acc      0.1094  0.0548299533  0.1639700467 0.0000007
## m248_s+mock-m248_c+acc     0.0554  0.0008299533  0.1099700467 0.0436986
## m248_s+noacc-m248_c+acc    0.0490 -0.0055700467  0.1035700467 0.1165998
## m248_c+noacc-m248_c+mock  -0.0026 -0.0571700467  0.0519700467 1.0000000
## m248_s+acc-m248_c+mock     0.0472 -0.0073700467  0.1017700467 0.1497099
## m248_s+mock-m248_c+mock   -0.0068 -0.0613700467  0.0477700467 0.9999993
## m248_s+noacc-m248_c+mock  -0.0132 -0.0677700467  0.0413700467 0.9994367
## m248_s+acc-m248_c+noacc    0.0498 -0.0047700467  0.1043700467 0.1039308
## m248_s+mock-m248_c+noacc  -0.0042 -0.0587700467  0.0503700467 1.0000000
## m248_s+noacc-m248_c+noacc -0.0106 -0.0651700467  0.0439700467 0.9999319
## m248_s+mock-m248_s+acc    -0.0540 -0.1085700467  0.0005700467 0.0547810
## m248_s+noacc-m248_s+acc   -0.0604 -0.1149700467 -0.0058299533 0.0186417
## m248_s+noacc-m248_s+mock  -0.0064 -0.0609700467  0.0481700467 0.9999996
P10 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P10)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##        "abc"        "abd"          "e"        "abc"         "ad"          "d" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##         "bc"        "abc"         "ce"        "abc"        "abd"        "abd"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_late
Crop_late$Genotype<- factor(Crop_late$Genotype, levels=c("LA", "m248"))
Crop_late$condition<- factor(Crop_late$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_late, mapping = aes(x = Genotype, y = Fqp.Fmp, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("Fqp.Fmp") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 0.3)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(NPQ ~ All.ID, data = Crop_late)
## Call:
##    aov(formula = NPQ ~ All.ID, data = Crop_late)
## 
## Terms:
##                    All.ID Residuals
## Sum of Squares  0.6827641 0.2864628
## Deg. of Freedom        11        48
## 
## Residual standard error: 0.07725267
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(NPQ ~ All.ID, data = Crop_late))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = NPQ ~ All.ID, data = Crop_late)
## 
## $All.ID
##                              diff          lwr           upr     p adj
## LA_c+mock-LA_c+acc        -0.1062 -0.273968261  0.0615682608 0.5754734
## LA_c+noacc-LA_c+acc       -0.0048 -0.172568261  0.1629682608 1.0000000
## LA_s+acc-LA_c+acc         -0.1950 -0.362768261 -0.0272317392 0.0108008
## LA_s+mock-LA_c+acc        -0.1986 -0.366368261 -0.0308317392 0.0086991
## LA_s+noacc-LA_c+acc        0.0202 -0.147568261  0.1879682608 0.9999995
## m248_c+acc-LA_c+acc       -0.0256 -0.193368261  0.1421682608 0.9999941
## m248_c+mock-LA_c+acc      -0.0286 -0.196368261  0.1391682608 0.9999816
## m248_c+noacc-LA_c+acc     -0.1346 -0.302368261  0.0331682608 0.2321010
## m248_s+acc-LA_c+acc       -0.2770 -0.444768261 -0.1092317392 0.0000478
## m248_s+mock-LA_c+acc      -0.3022 -0.469968261 -0.1344317392 0.0000080
## m248_s+noacc-LA_c+acc     -0.1642 -0.331968261  0.0035682608 0.0601535
## LA_c+noacc-LA_c+mock       0.1014 -0.066368261  0.2691682608 0.6416133
## LA_s+acc-LA_c+mock        -0.0888 -0.256568261  0.0789682608 0.8005051
## LA_s+mock-LA_c+mock       -0.0924 -0.260168261  0.0753682608 0.7585586
## LA_s+noacc-LA_c+mock       0.1264 -0.041368261  0.2941682608 0.3152119
## m248_c+acc-LA_c+mock       0.0806 -0.087168261  0.2483682608 0.8812104
## m248_c+mock-LA_c+mock      0.0776 -0.090168261  0.2453682608 0.9049282
## m248_c+noacc-LA_c+mock    -0.0284 -0.196168261  0.1393682608 0.9999828
## m248_s+acc-LA_c+mock      -0.1708 -0.338568261 -0.0030317392 0.0425951
## m248_s+mock-LA_c+mock     -0.1960 -0.363768261 -0.0282317392 0.0101736
## m248_s+noacc-LA_c+mock    -0.0580 -0.225768261  0.1097682608 0.9875707
## LA_s+acc-LA_c+noacc       -0.1902 -0.357968261 -0.0224317392 0.0143484
## LA_s+mock-LA_c+noacc      -0.1938 -0.361568261 -0.0260317392 0.0116013
## LA_s+noacc-LA_c+noacc      0.0250 -0.142768261  0.1927682608 0.9999954
## m248_c+acc-LA_c+noacc     -0.0208 -0.188568261  0.1469682608 0.9999993
## m248_c+mock-LA_c+noacc    -0.0238 -0.191568261  0.1439682608 0.9999972
## m248_c+noacc-LA_c+noacc   -0.1298 -0.297568261  0.0379682608 0.2787664
## m248_s+acc-LA_c+noacc     -0.2722 -0.439968261 -0.1044317392 0.0000670
## m248_s+mock-LA_c+noacc    -0.2974 -0.465168261 -0.1296317392 0.0000113
## m248_s+noacc-LA_c+noacc   -0.1594 -0.327168261  0.0083682608 0.0766186
## LA_s+mock-LA_s+acc        -0.0036 -0.171368261  0.1641682608 1.0000000
## LA_s+noacc-LA_s+acc        0.2152  0.047431739  0.3829682608 0.0031013
## m248_c+acc-LA_s+acc        0.1694  0.001631739  0.3371682608 0.0458838
## m248_c+mock-LA_s+acc       0.1664 -0.001368261  0.3341682608 0.0536996
## m248_c+noacc-LA_s+acc      0.0604 -0.107368261  0.2281682608 0.9829798
## m248_s+acc-LA_s+acc       -0.0820 -0.249768261  0.0857682608 0.8690426
## m248_s+mock-LA_s+acc      -0.1072 -0.274968261  0.0605682608 0.5616197
## m248_s+noacc-LA_s+acc      0.0308 -0.136968261  0.1985682608 0.9999611
## LA_s+noacc-LA_s+mock       0.2188  0.051031739  0.3865682608 0.0024636
## m248_c+acc-LA_s+mock       0.1730  0.005231739  0.3407682608 0.0378508
## m248_c+mock-LA_s+mock      0.1700  0.002231739  0.3377682608 0.0444477
## m248_c+noacc-LA_s+mock     0.0640 -0.103768261  0.2317682608 0.9737622
## m248_s+acc-LA_s+mock      -0.0784 -0.246168261  0.0893682608 0.8989195
## m248_s+mock-LA_s+mock     -0.1036 -0.271368261  0.0641682608 0.6114335
## m248_s+noacc-LA_s+mock     0.0344 -0.133368261  0.2021682608 0.9998840
## m248_c+acc-LA_s+noacc     -0.0458 -0.213568261  0.1219682608 0.9982995
## m248_c+mock-LA_s+noacc    -0.0488 -0.216568261  0.1189682608 0.9970280
## m248_c+noacc-LA_s+noacc   -0.1548 -0.322568261  0.0129682608 0.0958730
## m248_s+acc-LA_s+noacc     -0.2972 -0.464968261 -0.1294317392 0.0000115
## m248_s+mock-LA_s+noacc    -0.3224 -0.490168261 -0.1546317392 0.0000019
## m248_s+noacc-LA_s+noacc   -0.1844 -0.352168261 -0.0166317392 0.0200748
## m248_c+mock-m248_c+acc    -0.0030 -0.170768261  0.1647682608 1.0000000
## m248_c+noacc-m248_c+acc   -0.1090 -0.276768261  0.0587682608 0.5367287
## m248_s+acc-m248_c+acc     -0.2514 -0.419168261 -0.0836317392 0.0002824
## m248_s+mock-m248_c+acc    -0.2766 -0.444368261 -0.1088317392 0.0000492
## m248_s+noacc-m248_c+acc   -0.1386 -0.306368261  0.0291682608 0.1975809
## m248_c+noacc-m248_c+mock  -0.1060 -0.273768261  0.0617682608 0.5782443
## m248_s+acc-m248_c+mock    -0.2484 -0.416168261 -0.0806317392 0.0003465
## m248_s+mock-m248_c+mock   -0.2736 -0.441368261 -0.1058317392 0.0000607
## m248_s+noacc-m248_c+mock  -0.1356 -0.303368261  0.0321682608 0.2230987
## m248_s+acc-m248_c+noacc   -0.1424 -0.310168261  0.0253682608 0.1684176
## m248_s+mock-m248_c+noacc  -0.1676 -0.335368261  0.0001682608 0.0504425
## m248_s+noacc-m248_c+noacc -0.0296 -0.197368261  0.1381682608 0.9999739
## m248_s+mock-m248_s+acc    -0.0252 -0.192968261  0.1425682608 0.9999950
## m248_s+noacc-m248_s+acc    0.1128 -0.054968261  0.2805682608 0.4847540
## m248_s+noacc-m248_s+mock   0.1380 -0.029768261  0.3057682608 0.2025066
P12 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P12)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##       "abcd"         "ac"        "bde"         "be"          "c"         "ac" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##        "acd"      "abcde"          "e"          "e"       "abde"         "ac"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_late
Crop_late$Genotype<- factor(Crop_late$Genotype, levels=c("LA", "m248"))
Crop_late$condition<- factor(Crop_late$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_late, mapping = aes(x = Genotype, y = NPQ, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("NPQ") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 1.3
                                                                       )
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(ChlIdx ~ All.ID, data = Crop_late)
## Call:
##    aov(formula = ChlIdx ~ All.ID, data = Crop_late)
## 
## Terms:
##                    All.ID Residuals
## Sum of Squares  0.8940762 0.5951000
## Deg. of Freedom        11        48
## 
## Residual standard error: 0.1113459
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(ChlIdx ~ All.ID, data = Crop_late))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ChlIdx ~ All.ID, data = Crop_late)
## 
## $All.ID
##                              diff          lwr          upr     p adj
## LA_c+mock-LA_c+acc         0.1106 -0.131207998  0.352407998 0.9111654
## LA_c+noacc-LA_c+acc       -0.0524 -0.294207998  0.189407998 0.9998016
## LA_s+acc-LA_c+acc          0.1026 -0.139207998  0.344407998 0.9449082
## LA_s+mock-LA_c+acc         0.0596 -0.182207998  0.301407998 0.9993292
## LA_s+noacc-LA_c+acc       -0.2032 -0.445007998  0.038607998 0.1788953
## m248_c+acc-LA_c+acc       -0.2456 -0.487407998 -0.003792002 0.0435145
## m248_c+mock-LA_c+acc      -0.0394 -0.281207998  0.202407998 0.9999884
## m248_c+noacc-LA_c+acc     -0.1652 -0.407007998  0.076607998 0.4603677
## m248_s+acc-LA_c+acc       -0.1340 -0.375807998  0.107807998 0.7516080
## m248_s+mock-LA_c+acc      -0.0092 -0.251007998  0.232607998 1.0000000
## m248_s+noacc-LA_c+acc     -0.2376 -0.479407998  0.004207998 0.0581834
## LA_c+noacc-LA_c+mock      -0.1630 -0.404807998  0.078807998 0.4808285
## LA_s+acc-LA_c+mock        -0.0080 -0.249807998  0.233807998 1.0000000
## LA_s+mock-LA_c+mock       -0.0510 -0.292807998  0.190807998 0.9998474
## LA_s+noacc-LA_c+mock      -0.3138 -0.555607998 -0.071992002 0.0026409
## m248_c+acc-LA_c+mock      -0.3562 -0.598007998 -0.114392002 0.0003776
## m248_c+mock-LA_c+mock     -0.1500 -0.391807998  0.091807998 0.6049325
## m248_c+noacc-LA_c+mock    -0.2758 -0.517607998 -0.033992002 0.0134093
## m248_s+acc-LA_c+mock      -0.2446 -0.486407998 -0.002792002 0.0451478
## m248_s+mock-LA_c+mock     -0.1198 -0.361607998  0.122007998 0.8588302
## m248_s+noacc-LA_c+mock    -0.3482 -0.590007998 -0.106392002 0.0005495
## LA_s+acc-LA_c+noacc        0.1550 -0.086807998  0.396807998 0.5569089
## LA_s+mock-LA_c+noacc       0.1120 -0.129807998  0.353807998 0.9041418
## LA_s+noacc-LA_c+noacc     -0.1508 -0.392607998  0.091007998 0.5972626
## m248_c+acc-LA_c+noacc     -0.1932 -0.435007998  0.048607998 0.2372172
## m248_c+mock-LA_c+noacc     0.0130 -0.228807998  0.254807998 1.0000000
## m248_c+noacc-LA_c+noacc   -0.1128 -0.354607998  0.129007998 0.8999761
## m248_s+acc-LA_c+noacc     -0.0816 -0.323407998  0.160207998 0.9897378
## m248_s+mock-LA_c+noacc     0.0432 -0.198607998  0.285007998 0.9999704
## m248_s+noacc-LA_c+noacc   -0.1852 -0.427007998  0.056607998 0.2924490
## LA_s+mock-LA_s+acc        -0.0430 -0.284807998  0.198807998 0.9999718
## LA_s+noacc-LA_s+acc       -0.3058 -0.547607998 -0.063992002 0.0037588
## m248_c+acc-LA_s+acc       -0.3482 -0.590007998 -0.106392002 0.0005495
## m248_c+mock-LA_s+acc      -0.1420 -0.383807998  0.099807998 0.6804314
## m248_c+noacc-LA_s+acc     -0.2678 -0.509607998 -0.025992002 0.0185241
## m248_s+acc-LA_s+acc       -0.2366 -0.478407998  0.005207998 0.0602925
## m248_s+mock-LA_s+acc      -0.1118 -0.353607998  0.130007998 0.9051660
## m248_s+noacc-LA_s+acc     -0.3402 -0.582007998 -0.098392002 0.0007969
## LA_s+noacc-LA_s+mock      -0.2628 -0.504607998 -0.020992002 0.0225809
## m248_c+acc-LA_s+mock      -0.3052 -0.547007998 -0.063392002 0.0038588
## m248_c+mock-LA_s+mock     -0.0990 -0.340807998  0.142807998 0.9567022
## m248_c+noacc-LA_s+mock    -0.2248 -0.466607998  0.017007998 0.0906348
## m248_s+acc-LA_s+mock      -0.1936 -0.435407998  0.048207998 0.2346554
## m248_s+mock-LA_s+mock     -0.0688 -0.310607998  0.173007998 0.9975486
## m248_s+noacc-LA_s+mock    -0.2972 -0.539007998 -0.055392002 0.0054604
## m248_c+acc-LA_s+noacc     -0.0424 -0.284207998  0.199407998 0.9999755
## m248_c+mock-LA_s+noacc     0.1638 -0.078007998  0.405607998 0.4733572
## m248_c+noacc-LA_s+noacc    0.0380 -0.203807998  0.279807998 0.9999920
## m248_s+acc-LA_s+noacc      0.0692 -0.172607998  0.311007998 0.9974210
## m248_s+mock-LA_s+noacc     0.1940 -0.047807998  0.435807998 0.2321129
## m248_s+noacc-LA_s+noacc   -0.0344 -0.276207998  0.207407998 0.9999971
## m248_c+mock-m248_c+acc     0.2062 -0.035607998  0.448007998 0.1636819
## m248_c+noacc-m248_c+acc    0.0804 -0.161407998  0.322207998 0.9908883
## m248_s+acc-m248_c+acc      0.1116 -0.130207998  0.353407998 0.9061831
## m248_s+mock-m248_c+acc     0.2364 -0.005407998  0.478207998 0.0607223
## m248_s+noacc-m248_c+acc    0.0080 -0.233807998  0.249807998 1.0000000
## m248_c+noacc-m248_c+mock  -0.1258 -0.367607998  0.116007998 0.8171030
## m248_s+acc-m248_c+mock    -0.0946 -0.336407998  0.147207998 0.9685160
## m248_s+mock-m248_c+mock    0.0302 -0.211607998  0.272007998 0.9999993
## m248_s+noacc-m248_c+mock  -0.1982 -0.440007998  0.043607998 0.2065723
## m248_s+acc-m248_c+noacc    0.0312 -0.210607998  0.273007998 0.9999990
## m248_s+mock-m248_c+noacc   0.1560 -0.085807998  0.397807998 0.5473094
## m248_s+noacc-m248_c+noacc -0.0724 -0.314207998  0.169407998 0.9961876
## m248_s+mock-m248_s+acc     0.1248 -0.117007998  0.366607998 0.8244488
## m248_s+noacc-m248_s+acc   -0.1036 -0.345407998  0.138207998 0.9412708
## m248_s+noacc-m248_s+mock  -0.2284 -0.470207998  0.013407998 0.0802379
P14 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P14)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##          "a"      "abcde"         "ac"        "acd"         "be"          "b" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##      "abcde"        "bde"       "bcde"      "abcde"         "be"       "acde"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_late
Crop_late$Genotype<- factor(Crop_late$Genotype, levels=c("LA", "m248"))
Crop_late$condition<- factor(Crop_late$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_late, mapping = aes(x = Genotype, y = ChlIdx, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("ChlIdx") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 2.4)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(AriIdx ~ All.ID, data = Crop_late)
## Call:
##    aov(formula = AriIdx ~ All.ID, data = Crop_late)
## 
## Terms:
##                   All.ID Residuals
## Sum of Squares  8.154362  8.483437
## Deg. of Freedom       11        48
## 
## Residual standard error: 0.4204025
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(AriIdx ~ All.ID, data = Crop_late))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = AriIdx ~ All.ID, data = Crop_late)
## 
## $All.ID
##                              diff        lwr          upr     p adj
## LA_c+mock-LA_c+acc        -0.1706 -1.0835807  0.742380707 0.9999536
## LA_c+noacc-LA_c+acc       -0.1364 -1.0493807  0.776580707 0.9999952
## LA_s+acc-LA_c+acc         -0.0466 -0.9595807  0.866380707 1.0000000
## LA_s+mock-LA_c+acc        -0.3878 -1.3007807  0.525180707 0.9445125
## LA_s+noacc-LA_c+acc       -0.5030 -1.4159807  0.409980707 0.7581865
## m248_c+acc-LA_c+acc       -0.8806 -1.7935807  0.032380707 0.0678944
## m248_c+mock-LA_c+acc      -0.8048 -1.7177807  0.108180707 0.1322559
## m248_c+noacc-LA_c+acc     -0.6056 -1.5185807  0.307380707 0.5053544
## m248_s+acc-LA_c+acc       -1.1178 -2.0307807 -0.204819293 0.0057357
## m248_s+mock-LA_c+acc      -0.8018 -1.7147807  0.111180707 0.1355828
## m248_s+noacc-LA_c+acc     -0.9636 -1.8765807 -0.050619293 0.0303078
## LA_c+noacc-LA_c+mock       0.0342 -0.8787807  0.947180707 1.0000000
## LA_s+acc-LA_c+mock         0.1240 -0.7889807  1.036980707 0.9999982
## LA_s+mock-LA_c+mock       -0.2172 -1.1301807  0.695780707 0.9995179
## LA_s+noacc-LA_c+mock      -0.3324 -1.2453807  0.580580707 0.9814629
## m248_c+acc-LA_c+mock      -0.7100 -1.6229807  0.202980707 0.2719243
## m248_c+mock-LA_c+mock     -0.6342 -1.5471807  0.278780707 0.4350154
## m248_c+noacc-LA_c+mock    -0.4350 -1.3479807  0.477980707 0.8867455
## m248_s+acc-LA_c+mock      -0.9472 -1.8601807 -0.034219293 0.0357458
## m248_s+mock-LA_c+mock     -0.6312 -1.5441807  0.281780707 0.4422312
## m248_s+noacc-LA_c+mock    -0.7930 -1.7059807  0.119980707 0.1457269
## LA_s+acc-LA_c+noacc        0.0898 -0.8231807  1.002780707 0.9999999
## LA_s+mock-LA_c+noacc      -0.2514 -1.1643807  0.661580707 0.9981636
## LA_s+noacc-LA_c+noacc     -0.3666 -1.2795807  0.546380707 0.9621507
## m248_c+acc-LA_c+noacc     -0.7442 -1.6571807  0.168780707 0.2130250
## m248_c+mock-LA_c+noacc    -0.6684 -1.5813807  0.244580707 0.3564012
## m248_c+noacc-LA_c+noacc   -0.4692 -1.3821807  0.443780707 0.8282789
## m248_s+acc-LA_c+noacc     -0.9814 -1.8943807 -0.068419293 0.0252640
## m248_s+mock-LA_c+noacc    -0.6654 -1.5783807  0.247580707 0.3629970
## m248_s+noacc-LA_c+noacc   -0.8272 -1.7401807  0.085780707 0.1094394
## LA_s+mock-LA_s+acc        -0.3412 -1.2541807  0.571780707 0.9774476
## LA_s+noacc-LA_s+acc       -0.4564 -1.3693807  0.456580707 0.8517444
## m248_c+acc-LA_s+acc       -0.8340 -1.7469807  0.078980707 0.1031894
## m248_c+mock-LA_s+acc      -0.7582 -1.6711807  0.154780707 0.1917394
## m248_c+noacc-LA_s+acc     -0.5590 -1.4719807  0.353980707 0.6235285
## m248_s+acc-LA_s+acc       -1.0712 -1.9841807 -0.158219293 0.0096719
## m248_s+mock-LA_s+acc      -0.7552 -1.6681807  0.157780707 0.1961636
## m248_s+noacc-LA_s+acc     -0.9170 -1.8299807 -0.004019293 0.0480980
## LA_s+noacc-LA_s+mock      -0.1152 -1.0281807  0.797780707 0.9999992
## m248_c+acc-LA_s+mock      -0.4928 -1.4057807  0.420180707 0.7804760
## m248_c+mock-LA_s+mock     -0.4170 -1.3299807  0.495980707 0.9119234
## m248_c+noacc-LA_s+mock    -0.2178 -1.1307807  0.695180707 0.9995053
## m248_s+acc-LA_s+mock      -0.7300 -1.6429807  0.182980707 0.2362892
## m248_s+mock-LA_s+mock     -0.4140 -1.3269807  0.498980707 0.9157379
## m248_s+noacc-LA_s+mock    -0.5758 -1.4887807  0.337180707 0.5808995
## m248_c+acc-LA_s+noacc     -0.3776 -1.2905807  0.535380707 0.9535961
## m248_c+mock-LA_s+noacc    -0.3018 -1.2147807  0.611180707 0.9913067
## m248_c+noacc-LA_s+noacc   -0.1026 -1.0155807  0.810380707 0.9999998
## m248_s+acc-LA_s+noacc     -0.6148 -1.5277807  0.298180707 0.4823905
## m248_s+mock-LA_s+noacc    -0.2988 -1.2117807  0.614180707 0.9919838
## m248_s+noacc-LA_s+noacc   -0.4606 -1.3735807  0.452380707 0.8442472
## m248_c+mock-m248_c+acc     0.0758 -0.8371807  0.988780707 1.0000000
## m248_c+noacc-m248_c+acc    0.2750 -0.6379807  1.187980707 0.9959874
## m248_s+acc-m248_c+acc     -0.2372 -1.1501807  0.675780707 0.9989116
## m248_s+mock-m248_c+acc     0.0788 -0.8341807  0.991780707 1.0000000
## m248_s+noacc-m248_c+acc   -0.0830 -0.9959807  0.829980707 1.0000000
## m248_c+noacc-m248_c+mock   0.1992 -0.7137807  1.112180707 0.9997882
## m248_s+acc-m248_c+mock    -0.3130 -1.2259807  0.599980707 0.9883646
## m248_s+mock-m248_c+mock    0.0030 -0.9099807  0.915980707 1.0000000
## m248_s+noacc-m248_c+mock  -0.1588 -1.0717807  0.754180707 0.9999774
## m248_s+acc-m248_c+noacc   -0.5122 -1.4251807  0.400780707 0.7373491
## m248_s+mock-m248_c+noacc  -0.1962 -1.1091807  0.716780707 0.9998170
## m248_s+noacc-m248_c+noacc -0.3580 -1.2709807  0.554980707 0.9679933
## m248_s+mock-m248_s+acc     0.3160 -0.5969807  1.228980707 0.9874561
## m248_s+noacc-m248_s+acc    0.1542 -0.7587807  1.067180707 0.9999832
## m248_s+noacc-m248_s+mock  -0.1618 -1.0747807  0.751180707 0.9999727
P16 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P16)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##         "ab"         "ab"          "a"        "abc"        "abc"        "abc" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##        "abc"        "abc"          "c"        "abc"         "bc"          "a"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_late
Crop_late$Genotype<- factor(Crop_late$Genotype, levels=c("LA", "m248"))
Crop_late$condition<- factor(Crop_late$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_late, mapping = aes(x = Genotype, y = AriIdx, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("AriIdx") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 5)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph

aov(Alpha ~ All.ID, data = Crop_late)
## Call:
##    aov(formula = Alpha ~ All.ID, data = Crop_late)
## 
## Terms:
##                      All.ID   Residuals
## Sum of Squares  0.003033933 0.004322800
## Deg. of Freedom          11          48
## 
## Residual standard error: 0.009489907
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Alpha ~ All.ID, data = Crop_late))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Alpha ~ All.ID, data = Crop_late)
## 
## $All.ID
##                              diff           lwr         upr     p adj
## LA_c+mock-LA_c+acc        -0.0006 -0.0212090635 0.020009063 1.0000000
## LA_c+noacc-LA_c+acc        0.0018 -0.0188090635 0.022409063 1.0000000
## LA_s+acc-LA_c+acc         -0.0012 -0.0218090635 0.019409063 1.0000000
## LA_s+mock-LA_c+acc        -0.0102 -0.0308090635 0.010409063 0.8596215
## LA_s+noacc-LA_c+acc       -0.0110 -0.0316090635 0.009609063 0.7921086
## m248_c+acc-LA_c+acc        0.0040 -0.0166090635 0.024609063 0.9999324
## m248_c+mock-LA_c+acc       0.0126 -0.0080090635 0.033209063 0.6255988
## m248_c+noacc-LA_c+acc      0.0112 -0.0094090635 0.031809063 0.7732346
## m248_s+acc-LA_c+acc        0.0050 -0.0156090635 0.025609063 0.9994209
## m248_s+mock-LA_c+acc      -0.0056 -0.0262090635 0.015009063 0.9983689
## m248_s+noacc-LA_c+acc      0.0056 -0.0150090635 0.026209063 0.9983689
## LA_c+noacc-LA_c+mock       0.0024 -0.0182090635 0.023009063 0.9999996
## LA_s+acc-LA_c+mock        -0.0006 -0.0212090635 0.020009063 1.0000000
## LA_s+mock-LA_c+mock       -0.0096 -0.0302090635 0.011009063 0.9008304
## LA_s+noacc-LA_c+mock      -0.0104 -0.0310090635 0.010209063 0.8440308
## m248_c+acc-LA_c+mock       0.0046 -0.0160090635 0.025209063 0.9997365
## m248_c+mock-LA_c+mock      0.0132 -0.0074090635 0.033809063 0.5580924
## m248_c+noacc-LA_c+mock     0.0118 -0.0088090635 0.032409063 0.7127236
## m248_s+acc-LA_c+mock       0.0056 -0.0150090635 0.026209063 0.9983689
## m248_s+mock-LA_c+mock     -0.0050 -0.0256090635 0.015609063 0.9994209
## m248_s+noacc-LA_c+mock     0.0062 -0.0144090635 0.026809063 0.9960295
## LA_s+acc-LA_c+noacc       -0.0030 -0.0236090635 0.017609063 0.9999964
## LA_s+mock-LA_c+noacc      -0.0120 -0.0326090635 0.008609063 0.6914839
## LA_s+noacc-LA_c+noacc     -0.0128 -0.0334090635 0.007809063 0.6031737
## m248_c+acc-LA_c+noacc      0.0022 -0.0184090635 0.022809063 0.9999999
## m248_c+mock-LA_c+noacc     0.0108 -0.0098090635 0.031409063 0.8102329
## m248_c+noacc-LA_c+noacc    0.0094 -0.0112090635 0.030009063 0.9126698
## m248_s+acc-LA_c+noacc      0.0032 -0.0174090635 0.023809063 0.9999929
## m248_s+mock-LA_c+noacc    -0.0074 -0.0280090635 0.013209063 0.9833222
## m248_s+noacc-LA_c+noacc    0.0038 -0.0168090635 0.024409063 0.9999594
## LA_s+mock-LA_s+acc        -0.0090 -0.0296090635 0.011609063 0.9335168
## LA_s+noacc-LA_s+acc       -0.0098 -0.0304090635 0.010809063 0.8880384
## m248_c+acc-LA_s+acc        0.0052 -0.0154090635 0.025809063 0.9991672
## m248_c+mock-LA_s+acc       0.0138 -0.0068090635 0.034409063 0.4909972
## m248_c+noacc-LA_s+acc      0.0124 -0.0082090635 0.033009063 0.6478442
## m248_s+acc-LA_s+acc        0.0062 -0.0144090635 0.026809063 0.9960295
## m248_s+mock-LA_s+acc      -0.0044 -0.0250090635 0.016209063 0.9998282
## m248_s+noacc-LA_s+acc      0.0068 -0.0138090635 0.027409063 0.9914365
## LA_s+noacc-LA_s+mock      -0.0008 -0.0214090635 0.019809063 1.0000000
## m248_c+acc-LA_s+mock       0.0142 -0.0064090635 0.034809063 0.4474065
## m248_c+mock-LA_s+mock      0.0228  0.0021909365 0.043409063 0.0187363
## m248_c+noacc-LA_s+mock     0.0214  0.0007909365 0.042009063 0.0354546
## m248_s+acc-LA_s+mock       0.0152 -0.0054090635 0.035809063 0.3456374
## m248_s+mock-LA_s+mock      0.0046 -0.0160090635 0.025209063 0.9997365
## m248_s+noacc-LA_s+mock     0.0158 -0.0048090635 0.036409063 0.2911029
## m248_c+acc-LA_s+noacc      0.0150 -0.0056090635 0.035609063 0.3649892
## m248_c+mock-LA_s+noacc     0.0236  0.0029909365 0.044209063 0.0128187
## m248_c+noacc-LA_s+noacc    0.0222  0.0015909365 0.042809063 0.0247328
## m248_s+acc-LA_s+noacc      0.0160 -0.0046090635 0.036609063 0.2741695
## m248_s+mock-LA_s+noacc     0.0054 -0.0152090635 0.026009063 0.9988244
## m248_s+noacc-LA_s+noacc    0.0166 -0.0040090635 0.037209063 0.2272768
## m248_c+mock-m248_c+acc     0.0086 -0.0120090635 0.029209063 0.9507121
## m248_c+noacc-m248_c+acc    0.0072 -0.0134090635 0.027809063 0.9865061
## m248_s+acc-m248_c+acc      0.0010 -0.0196090635 0.021609063 1.0000000
## m248_s+mock-m248_c+acc    -0.0096 -0.0302090635 0.011009063 0.9008304
## m248_s+noacc-m248_c+acc    0.0016 -0.0190090635 0.022209063 1.0000000
## m248_c+noacc-m248_c+mock  -0.0014 -0.0220090635 0.019209063 1.0000000
## m248_s+acc-m248_c+mock    -0.0076 -0.0282090635 0.013009063 0.9795852
## m248_s+mock-m248_c+mock   -0.0182 -0.0388090635 0.002409063 0.1306614
## m248_s+noacc-m248_c+mock  -0.0070 -0.0276090635 0.013609063 0.9891926
## m248_s+acc-m248_c+noacc   -0.0062 -0.0268090635 0.014409063 0.9960295
## m248_s+mock-m248_c+noacc  -0.0168 -0.0374090635 0.003809063 0.2129629
## m248_s+noacc-m248_c+noacc -0.0056 -0.0262090635 0.015009063 0.9983689
## m248_s+mock-m248_s+acc    -0.0106 -0.0312090635 0.010009063 0.8275554
## m248_s+noacc-m248_s+acc    0.0006 -0.0200090635 0.021209063 1.0000000
## m248_s+noacc-m248_s+mock   0.0112 -0.0094090635 0.031809063 0.7732346
P18 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P18)
stat.test
##    LA_c+mock   LA_c+noacc     LA_s+acc    LA_s+mock   LA_s+noacc   m248_c+acc 
##         "ab"         "ab"         "ab"          "a"          "a"         "ab" 
##  m248_c+mock m248_c+noacc   m248_s+acc  m248_s+mock m248_s+noacc     LA_c+acc 
##          "b"          "b"         "ab"         "ab"         "ab"         "ab"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
###################################################################
test$info <- strsplit(test$group1, "_")
test$info[[1]][2]
## [1] "c+mock"
test$Genotype <- "none"
test$condition<- "none"
test
for(i in 1:nrow(test)){
  test$Genotype[i] <- test$info[[i]][1]
  test$condition[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Genotype
test2$group2 <- test2$Genotype
Crop_late
Crop_late$Genotype<- factor(Crop_late$Genotype, levels=c("LA", "m248"))
Crop_late$condition<- factor(Crop_late$condition, levels=c("c+noacc", "c+mock", "c+acc",  "s+noacc", "s+mock", "s+acc"))


Crop_graph <- ggplot(data = Crop_late, mapping = aes(x = Genotype, y = Alpha, colour = Genotype)) 
Crop_graph <- Crop_graph + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Crop_graph <- Crop_graph + facet_grid(~ condition, scales = "free_y")

Crop_graph <- Crop_graph + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Crop_graph <- Crop_graph + scale_color_manual(values = c("blue","blueviolet","cyan", "red", "deeppink", "magenta"))
Crop_graph <- Crop_graph + ylab("Alpha") + xlab("") + stat_pvalue_manual(test2, label = "Tukey", y.position = 0.83)
Crop_graph <- Crop_graph + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Crop_graph <- Crop_graph + rremove("legend")
Crop_graph