getwd()
## [1] "C:/Users/Julkowska Lab/Desktop/R codes by Maryam/20231020_ion_leakae_duf_wrky_2xko_soil_grown"
setwd("C:/Users/Julkowska Lab/Desktop/R codes by Maryam/20231020_ion_leakae_duf_wrky_2xko_soil_grown")
list.files(pattern = ".csv")
## [1] "20231019_duf_wrky_2xko_soil_salt_ion_leakage_forR.csv"
## [2] "CropReport_all.csv"                                   
## [3] "CropReport_allv2-afterIncorporatingPrime.csv"
Crop <- read.csv("CropReport_allv2-afterIncorporatingPrime.csv")
Crop
Crop$All.ID<-paste(Crop$Genotype, Crop$condition, sep="_")
Crop
library(ggplot2)
library(ggpubr)
library(multcompView)
aov(Fv.Fm ~ All.ID, data = Crop)
## Call:
##    aov(formula = Fv.Fm ~ All.ID, data = Crop)
## 
## Terms:
##                      All.ID   Residuals
## Sum of Squares  0.000662075 0.004901917
## Deg. of Freedom           9         110
## 
## Residual standard error: 0.006675543
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Fv.Fm ~ All.ID, data = Crop))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Fv.Fm ~ All.ID, data = Crop)
## 
## $All.ID
##                              diff          lwr         upr     p adj
## col_salt-col_ctrl    0.0021666667 -0.006634946 0.010968279 0.9985313
## D_ctrl-col_ctrl     -0.0055833333 -0.014384946 0.003218279 0.5671175
## D_salt-col_ctrl      0.0009166667 -0.007884946 0.009718279 0.9999990
## duf_ctrl-col_ctrl   -0.0025000000 -0.011301612 0.006301612 0.9956028
## duf_salt-col_ctrl    0.0002500000 -0.008551612 0.009051612 1.0000000
## E_ctrl-col_ctrl     -0.0023333333 -0.011134946 0.006468279 0.9973918
## E_salt-col_ctrl      0.0004166667 -0.008384946 0.009218279 1.0000000
## wrky_ctrl-col_ctrl  -0.0032500000 -0.012051612 0.005551612 0.9720750
## wrky_salt-col_ctrl   0.0016666667 -0.007134946 0.010468279 0.9998238
## D_ctrl-col_salt     -0.0077500000 -0.016551612 0.001051612 0.1350457
## D_salt-col_salt     -0.0012500000 -0.010051612 0.007551612 0.9999846
## duf_ctrl-col_salt   -0.0046666667 -0.013468279 0.004134946 0.7861597
## duf_salt-col_salt   -0.0019166667 -0.010718279 0.006884946 0.9994466
## E_ctrl-col_salt     -0.0045000000 -0.013301612 0.004301612 0.8196122
## E_salt-col_salt     -0.0017500000 -0.010551612 0.007051612 0.9997364
## wrky_ctrl-col_salt  -0.0054166667 -0.014218279 0.003384946 0.6094693
## wrky_salt-col_salt  -0.0005000000 -0.009301612 0.008301612 1.0000000
## D_salt-D_ctrl        0.0065000000 -0.002301612 0.015301612 0.3449733
## duf_ctrl-D_ctrl      0.0030833333 -0.005718279 0.011884946 0.9803343
## duf_salt-D_ctrl      0.0058333333 -0.002968279 0.014634946 0.5036402
## E_ctrl-D_ctrl        0.0032500000 -0.005551612 0.012051612 0.9720750
## E_salt-D_ctrl        0.0060000000 -0.002801612 0.014801612 0.4620341
## wrky_ctrl-D_ctrl     0.0023333333 -0.006468279 0.011134946 0.9973918
## wrky_salt-D_ctrl     0.0072500000 -0.001551612 0.016051612 0.2032991
## duf_ctrl-D_salt     -0.0034166667 -0.012218279 0.005384946 0.9614640
## duf_salt-D_salt     -0.0006666667 -0.009468279 0.008134946 0.9999999
## E_ctrl-D_salt       -0.0032500000 -0.012051612 0.005551612 0.9720750
## E_salt-D_salt       -0.0005000000 -0.009301612 0.008301612 1.0000000
## wrky_ctrl-D_salt    -0.0041666667 -0.012968279 0.004634946 0.8776014
## wrky_salt-D_salt     0.0007500000 -0.008051612 0.009551612 0.9999998
## duf_salt-duf_ctrl    0.0027500000 -0.006051612 0.011551612 0.9911537
## E_ctrl-duf_ctrl      0.0001666667 -0.008634946 0.008968279 1.0000000
## E_salt-duf_ctrl      0.0029166667 -0.005884946 0.011718279 0.9865792
## wrky_ctrl-duf_ctrl  -0.0007500000 -0.009551612 0.008051612 0.9999998
## wrky_salt-duf_ctrl   0.0041666667 -0.004634946 0.012968279 0.8776014
## E_ctrl-duf_salt     -0.0025833333 -0.011384946 0.006218279 0.9943899
## E_salt-duf_salt      0.0001666667 -0.008634946 0.008968279 1.0000000
## wrky_ctrl-duf_salt  -0.0035000000 -0.012301612 0.005301612 0.9551780
## wrky_salt-duf_salt   0.0014166667 -0.007384946 0.010218279 0.9999550
## E_salt-E_ctrl        0.0027500000 -0.006051612 0.011551612 0.9911537
## wrky_ctrl-E_ctrl    -0.0009166667 -0.009718279 0.007884946 0.9999990
## wrky_salt-E_ctrl     0.0040000000 -0.004801612 0.012801612 0.9017979
## wrky_ctrl-E_salt    -0.0036666667 -0.012468279 0.005134946 0.9404712
## wrky_salt-E_salt     0.0012500000 -0.007551612 0.010051612 0.9999846
## wrky_salt-wrky_ctrl  0.0049166667 -0.003884946 0.013718279 0.7312322
P8 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P8)
stat.test
## $Letters
##  col_salt    D_ctrl    D_salt  duf_ctrl  duf_salt    E_ctrl    E_salt wrky_ctrl 
##       "a"       "a"       "a"       "a"       "a"       "a"       "a"       "a" 
## wrky_salt  col_ctrl 
##       "a"       "a" 
## 
## $LetterMatrix
##              a
## col_salt  TRUE
## D_ctrl    TRUE
## D_salt    TRUE
## duf_ctrl  TRUE
## duf_salt  TRUE
## E_ctrl    TRUE
## E_salt    TRUE
## wrky_ctrl TRUE
## wrky_salt TRUE
## col_ctrl  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] "salt"
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
#quantum yield or Maximum efficiency of PSII photochemistry, if all centers were closed. this is for dark adopted. 
#(Fvp/Fmp is max photosystem II efficiency in the light.)
Crop$Genotype<- factor(Crop$Genotype, levels=c("col", "duf", "wrky","D", "E"))

Crop_graph <- ggplot(data = Crop, 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)
## Call:
##    aov(formula = Fqp.Fmp ~ All.ID, data = Crop)
## 
## Terms:
##                     All.ID  Residuals
## Sum of Squares  0.00808218 0.05093342
## Deg. of Freedom          9        110
## 
## Residual standard error: 0.02151816
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Fqp.Fmp ~ All.ID, data = Crop))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Fqp.Fmp ~ All.ID, data = Crop)
## 
## $All.ID
##                              diff         lwr         upr     p adj
## col_salt-col_ctrl    0.0010833333 -0.02728806 0.029454728 1.0000000
## D_ctrl-col_ctrl      0.0017500000 -0.02662139 0.030121395 1.0000000
## D_salt-col_ctrl      0.0022500000 -0.02612139 0.030621395 0.9999999
## duf_ctrl-col_ctrl   -0.0064166667 -0.03478806 0.021954728 0.9992495
## duf_salt-col_ctrl   -0.0105000000 -0.03887139 0.017871395 0.9716562
## E_ctrl-col_ctrl     -0.0148333333 -0.04320473 0.013538061 0.7995224
## E_salt-col_ctrl     -0.0207500000 -0.04912139 0.007621395 0.3588339
## wrky_ctrl-col_ctrl  -0.0162500000 -0.04462139 0.012121395 0.7020972
## wrky_salt-col_ctrl  -0.0144166667 -0.04278806 0.013954728 0.8248679
## D_ctrl-col_salt      0.0006666667 -0.02770473 0.029038061 1.0000000
## D_salt-col_salt      0.0011666667 -0.02720473 0.029538061 1.0000000
## duf_ctrl-col_salt   -0.0075000000 -0.03587139 0.020871395 0.9974480
## duf_salt-col_salt   -0.0115833333 -0.03995473 0.016788061 0.9472907
## E_ctrl-col_salt     -0.0159166667 -0.04428806 0.012454728 0.7263618
## E_salt-col_salt     -0.0218333333 -0.05020473 0.006538061 0.2880166
## wrky_ctrl-col_salt  -0.0173333333 -0.04570473 0.011038061 0.6194133
## wrky_salt-col_salt  -0.0155000000 -0.04387139 0.012871395 0.7556252
## D_salt-D_ctrl        0.0005000000 -0.02787139 0.028871395 1.0000000
## duf_ctrl-D_ctrl     -0.0081666667 -0.03653806 0.020204728 0.9951435
## duf_salt-D_ctrl     -0.0122500000 -0.04062139 0.016121395 0.9264969
## E_ctrl-D_ctrl       -0.0165833333 -0.04495473 0.011788061 0.6771919
## E_salt-D_ctrl       -0.0225000000 -0.05087139 0.005871395 0.2488966
## wrky_ctrl-D_ctrl    -0.0180000000 -0.04637139 0.010371395 0.5669193
## wrky_salt-D_ctrl    -0.0161666667 -0.04453806 0.012204728 0.7082278
## duf_ctrl-D_salt     -0.0086666667 -0.03703806 0.019704728 0.9924838
## duf_salt-D_salt     -0.0127500000 -0.04112139 0.015621395 0.9077165
## E_ctrl-D_salt       -0.0170833333 -0.04545473 0.011288061 0.6388851
## E_salt-D_salt       -0.0230000000 -0.05137139 0.005371395 0.2219258
## wrky_ctrl-D_salt    -0.0185000000 -0.04687139 0.009871395 0.5274465
## wrky_salt-D_salt    -0.0166666667 -0.04503806 0.011704728 0.6708789
## duf_salt-duf_ctrl   -0.0040833333 -0.03245473 0.024288061 0.9999827
## E_ctrl-duf_ctrl     -0.0084166667 -0.03678806 0.019954728 0.9939305
## E_salt-duf_ctrl     -0.0143333333 -0.04270473 0.014038061 0.8297281
## wrky_ctrl-duf_ctrl  -0.0098333333 -0.03820473 0.018538061 0.9817097
## wrky_salt-duf_ctrl  -0.0080000000 -0.03637139 0.020371395 0.9958366
## E_ctrl-duf_salt     -0.0043333333 -0.03270473 0.024038061 0.9999712
## E_salt-duf_salt     -0.0102500000 -0.03862139 0.018121395 0.9758193
## wrky_ctrl-duf_salt  -0.0057500000 -0.03412139 0.022621395 0.9996916
## wrky_salt-duf_salt  -0.0039166667 -0.03228806 0.024454728 0.9999879
## E_salt-E_ctrl       -0.0059166667 -0.03428806 0.022454728 0.9996104
## wrky_ctrl-E_ctrl    -0.0014166667 -0.02978806 0.026954728 1.0000000
## wrky_salt-E_ctrl     0.0004166667 -0.02795473 0.028788061 1.0000000
## wrky_ctrl-E_salt     0.0045000000 -0.02387139 0.032871395 0.9999603
## wrky_salt-E_salt     0.0063333333 -0.02203806 0.034704728 0.9993242
## wrky_salt-wrky_ctrl  0.0018333333 -0.02653806 0.030204728 1.0000000
P18 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P18)
stat.test
## $Letters
##  col_salt    D_ctrl    D_salt  duf_ctrl  duf_salt    E_ctrl    E_salt wrky_ctrl 
##       "a"       "a"       "a"       "a"       "a"       "a"       "a"       "a" 
## wrky_salt  col_ctrl 
##       "a"       "a" 
## 
## $LetterMatrix
##              a
## col_salt  TRUE
## D_ctrl    TRUE
## D_salt    TRUE
## duf_ctrl  TRUE
## duf_salt  TRUE
## E_ctrl    TRUE
## E_salt    TRUE
## wrky_ctrl TRUE
## wrky_salt TRUE
## col_ctrl  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] "salt"
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
#Fvp/Fmp is the max photosystem II efficiency in the light, if all centers were open. 
Crop$Genotype<- factor(Crop$Genotype, levels=c("col", "duf", "wrky","D", "E"))
Crop_graph_prime <- ggplot(data = Crop, mapping = aes(x = Genotype, y = Fqp.Fmp, colour = Genotype)) 
Crop_graph_prime <- Crop_graph_prime + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

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

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

aov(NPQ ~ All.ID, data = Crop)
## Call:
##    aov(formula = NPQ ~ All.ID, data = Crop)
## 
## Terms:
##                   All.ID Residuals
## Sum of Squares  0.540198  0.949894
## Deg. of Freedom        9       110
## 
## Residual standard error: 0.09292685
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(NPQ ~ All.ID, data = Crop))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = NPQ ~ All.ID, data = Crop)
## 
## $All.ID
##                             diff          lwr          upr     p adj
## col_salt-col_ctrl    0.099750000 -0.022772783  0.222272783 0.2168744
## D_ctrl-col_ctrl      0.040666667 -0.081856116  0.163189450 0.9864280
## D_salt-col_ctrl      0.145833333  0.023310550  0.268356116 0.0074642
## duf_ctrl-col_ctrl    0.028833333 -0.093689450  0.151356116 0.9989701
## duf_salt-col_ctrl    0.186083333  0.063560550  0.308606116 0.0001374
## E_ctrl-col_ctrl      0.048333333 -0.074189450  0.170856116 0.9573590
## E_salt-col_ctrl      0.195500000  0.072977217  0.318022783 0.0000487
## wrky_ctrl-col_ctrl   0.054000000 -0.068522783  0.176522783 0.9172964
## wrky_salt-col_ctrl   0.156666667  0.034143884  0.279189450 0.0027551
## D_ctrl-col_salt     -0.059083333 -0.181606116  0.063439450 0.8652127
## D_salt-col_salt      0.046083333 -0.076439450  0.168606116 0.9685142
## duf_ctrl-col_salt   -0.070916667 -0.193439450  0.051606116 0.6893582
## duf_salt-col_salt    0.086333333 -0.036189450  0.208856116 0.4130906
## E_ctrl-col_salt     -0.051416667 -0.173939450  0.071106116 0.9378154
## E_salt-col_salt      0.095750000 -0.026772783  0.218272783 0.2677054
## wrky_ctrl-col_salt  -0.045750000 -0.168272783  0.076772783 0.9699623
## wrky_salt-col_salt   0.056916667 -0.065606116  0.179439450 0.8893281
## D_salt-D_ctrl        0.105166667 -0.017356116  0.227689450 0.1592458
## duf_ctrl-D_ctrl     -0.011833333 -0.134356116  0.110689450 0.9999995
## duf_salt-D_ctrl      0.145416667  0.022893884  0.267939450 0.0077457
## E_ctrl-D_ctrl        0.007666667 -0.114856116  0.130189450 1.0000000
## E_salt-D_ctrl        0.154833333  0.032310550  0.277356116 0.0032759
## wrky_ctrl-D_ctrl     0.013333333 -0.109189450  0.135856116 0.9999985
## wrky_salt-D_ctrl     0.116000000 -0.006522783  0.238522783 0.0795132
## duf_ctrl-D_salt     -0.117000000 -0.239522783  0.005522783 0.0742133
## duf_salt-D_salt      0.040250000 -0.082272783  0.162772783 0.9873711
## E_ctrl-D_salt       -0.097500000 -0.220022783  0.025022783 0.2446031
## E_salt-D_salt        0.049666667 -0.072856116  0.172189450 0.9495408
## wrky_ctrl-D_salt    -0.091833333 -0.214356116  0.030689450 0.3241095
## wrky_salt-D_salt     0.010833333 -0.111689450  0.133356116 0.9999998
## duf_salt-duf_ctrl    0.157250000  0.034727217  0.279772783 0.0026064
## E_ctrl-duf_ctrl      0.019500000 -0.103022783  0.142022783 0.9999591
## E_salt-duf_ctrl      0.166666667  0.044143884  0.289189450 0.0010396
## wrky_ctrl-duf_ctrl   0.025166667 -0.097356116  0.147689450 0.9996558
## wrky_salt-duf_ctrl   0.127833333  0.005310550  0.250356116 0.0334781
## E_ctrl-duf_salt     -0.137750000 -0.260272783 -0.015227217 0.0150238
## E_salt-duf_salt      0.009416667 -0.113106116  0.131939450 0.9999999
## wrky_ctrl-duf_salt  -0.132083333 -0.254606116 -0.009560550 0.0239399
## wrky_salt-duf_salt  -0.029416667 -0.151939450  0.093106116 0.9987933
## E_salt-E_ctrl        0.147166667  0.024643884  0.269689450 0.0066259
## wrky_ctrl-E_ctrl     0.005666667 -0.116856116  0.128189450 1.0000000
## wrky_salt-E_ctrl     0.108333333 -0.014189450  0.230856116 0.1313314
## wrky_ctrl-E_salt    -0.141500000 -0.264022783 -0.018977217 0.0109141
## wrky_salt-E_salt    -0.038833333 -0.161356116  0.083689450 0.9901988
## wrky_salt-wrky_ctrl  0.102666667 -0.019856116  0.225189450 0.1842556
P10 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P10)
stat.test
##  col_salt    D_ctrl    D_salt  duf_ctrl  duf_salt    E_ctrl    E_salt wrky_ctrl 
##    "abcd"     "abc"     "abd"      "bc"       "d"     "abc"       "d"     "abc" 
## wrky_salt  col_ctrl 
##      "ad"       "c"
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] "salt"
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
#NPQ refers to as non-photochemical quenching, it is photoprotectants. is indicative of heat dissipation.
Crop$Genotype<- factor(Crop$Genotype, levels=c("col", "duf", "wrky","D", "E"))

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

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

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

aov(ChlIdx ~ All.ID, data = Crop)
## Call:
##    aov(formula = ChlIdx ~ All.ID, data = Crop)
## 
## Terms:
##                    All.ID Residuals
## Sum of Squares  0.0390827 1.2687005
## Deg. of Freedom         9       110
## 
## Residual standard error: 0.1073948
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(ChlIdx ~ All.ID, data = Crop))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ChlIdx ~ All.ID, data = Crop)
## 
## $All.ID
##                              diff        lwr        upr     p adj
## col_salt-col_ctrl   -0.0212500000 -0.1628486 0.12034856 0.9999752
## D_ctrl-col_ctrl     -0.0105000000 -0.1520986 0.13109856 0.9999999
## D_salt-col_ctrl     -0.0030000000 -0.1445986 0.13859856 1.0000000
## duf_ctrl-col_ctrl   -0.0380000000 -0.1795986 0.10359856 0.9971362
## duf_salt-col_ctrl   -0.0348333333 -0.1764319 0.10676523 0.9985391
## E_ctrl-col_ctrl     -0.0260000000 -0.1675986 0.11559856 0.9998636
## E_salt-col_ctrl     -0.0622500000 -0.2038486 0.07934856 0.9184763
## wrky_ctrl-col_ctrl  -0.0371666667 -0.1787652 0.10443189 0.9975834
## wrky_salt-col_ctrl  -0.0378333333 -0.1794319 0.10376523 0.9972307
## D_ctrl-col_salt      0.0107500000 -0.1308486 0.15234856 0.9999999
## D_salt-col_salt      0.0182500000 -0.1233486 0.15984856 0.9999933
## duf_ctrl-col_salt   -0.0167500000 -0.1583486 0.12484856 0.9999968
## duf_salt-col_salt   -0.0135833333 -0.1551819 0.12801523 0.9999995
## E_ctrl-col_salt     -0.0047500000 -0.1463486 0.13684856 1.0000000
## E_salt-col_salt     -0.0410000000 -0.1825986 0.10059856 0.9949260
## wrky_ctrl-col_salt  -0.0159166667 -0.1575152 0.12568189 0.9999980
## wrky_salt-col_salt  -0.0165833333 -0.1581819 0.12501523 0.9999971
## D_salt-D_ctrl        0.0075000000 -0.1340986 0.14909856 1.0000000
## duf_ctrl-D_ctrl     -0.0275000000 -0.1690986 0.11409856 0.9997828
## duf_salt-D_ctrl     -0.0243333333 -0.1659319 0.11726523 0.9999217
## E_ctrl-D_ctrl       -0.0155000000 -0.1570986 0.12609856 0.9999984
## E_salt-D_ctrl       -0.0517500000 -0.1933486 0.08984856 0.9739014
## wrky_ctrl-D_ctrl    -0.0266666667 -0.1682652 0.11493189 0.9998317
## wrky_salt-D_ctrl    -0.0273333333 -0.1689319 0.11426523 0.9997935
## duf_ctrl-D_salt     -0.0350000000 -0.1765986 0.10659856 0.9984834
## duf_salt-D_salt     -0.0318333333 -0.1734319 0.10976523 0.9992848
## E_ctrl-D_salt       -0.0230000000 -0.1645986 0.11859856 0.9999514
## E_salt-D_salt       -0.0592500000 -0.2008486 0.08234856 0.9388782
## wrky_ctrl-D_salt    -0.0341666667 -0.1757652 0.10743189 0.9987449
## wrky_salt-D_salt    -0.0348333333 -0.1764319 0.10676523 0.9985391
## duf_salt-duf_ctrl    0.0031666667 -0.1384319 0.14476523 1.0000000
## E_ctrl-duf_ctrl      0.0120000000 -0.1295986 0.15359856 0.9999998
## E_salt-duf_ctrl     -0.0242500000 -0.1658486 0.11734856 0.9999239
## wrky_ctrl-duf_ctrl   0.0008333333 -0.1407652 0.14243189 1.0000000
## wrky_salt-duf_ctrl   0.0001666667 -0.1414319 0.14176523 1.0000000
## E_ctrl-duf_salt      0.0088333333 -0.1327652 0.15043189 1.0000000
## E_salt-duf_salt     -0.0274166667 -0.1690152 0.11418189 0.9997882
## wrky_ctrl-duf_salt  -0.0023333333 -0.1439319 0.13926523 1.0000000
## wrky_salt-duf_salt  -0.0030000000 -0.1445986 0.13859856 1.0000000
## E_salt-E_ctrl       -0.0362500000 -0.1778486 0.10534856 0.9980070
## wrky_ctrl-E_ctrl    -0.0111666667 -0.1527652 0.13043189 0.9999999
## wrky_salt-E_ctrl    -0.0118333333 -0.1534319 0.12976523 0.9999999
## wrky_ctrl-E_salt     0.0250833333 -0.1165152 0.16668189 0.9998990
## wrky_salt-E_salt     0.0244166667 -0.1171819 0.16601523 0.9999194
## wrky_salt-wrky_ctrl -0.0006666667 -0.1422652 0.14093189 1.0000000
P12 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P12)
stat.test
## $Letters
##  col_salt    D_ctrl    D_salt  duf_ctrl  duf_salt    E_ctrl    E_salt wrky_ctrl 
##       "a"       "a"       "a"       "a"       "a"       "a"       "a"       "a" 
## wrky_salt  col_ctrl 
##       "a"       "a" 
## 
## $LetterMatrix
##              a
## col_salt  TRUE
## D_ctrl    TRUE
## D_salt    TRUE
## duf_ctrl  TRUE
## duf_salt  TRUE
## E_ctrl    TRUE
## E_salt    TRUE
## wrky_ctrl TRUE
## wrky_salt TRUE
## col_ctrl  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] "salt"
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
#chlorophyll content index that is referred to as CCI or alternatively as a SPAD index
Crop$Genotype<- factor(Crop$Genotype, levels=c("col", "duf", "wrky","D", "E"))

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

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

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

aov(AriIdx ~ All.ID, data = Crop)
## Call:
##    aov(formula = AriIdx ~ All.ID, data = Crop)
## 
## Terms:
##                    All.ID Residuals
## Sum of Squares  0.8230347 2.8853371
## Deg. of Freedom         9       110
## 
## Residual standard error: 0.1619578
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(AriIdx ~ All.ID, data = Crop))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = AriIdx ~ All.ID, data = Crop)
## 
## $All.ID
##                             diff         lwr         upr     p adj
## col_salt-col_ctrl   -0.001916667 -0.21545584  0.21162251 1.0000000
## D_ctrl-col_ctrl     -0.090416667 -0.30395584  0.12312251 0.9344329
## D_salt-col_ctrl      0.081083333 -0.13245584  0.29462251 0.9665243
## duf_ctrl-col_ctrl   -0.174250000 -0.38778917  0.03928917 0.2141687
## duf_salt-col_ctrl   -0.039333333 -0.25287251  0.17420584 0.9998600
## E_ctrl-col_ctrl     -0.115333333 -0.32887251  0.09820584 0.7676188
## E_salt-col_ctrl     -0.154583333 -0.36812251  0.05895584 0.3736214
## wrky_ctrl-col_ctrl  -0.193083333 -0.40662251  0.02045584 0.1124515
## wrky_salt-col_ctrl  -0.080083333 -0.29362251  0.13345584 0.9691014
## D_ctrl-col_salt     -0.088500000 -0.30203917  0.12503917 0.9422870
## D_salt-col_salt      0.083000000 -0.13053917  0.29653917 0.9611484
## duf_ctrl-col_salt   -0.172333333 -0.38587251  0.04120584 0.2273307
## duf_salt-col_salt   -0.037416667 -0.25095584  0.17612251 0.9999078
## E_ctrl-col_salt     -0.113416667 -0.32695584  0.10012251 0.7844614
## E_salt-col_salt     -0.152666667 -0.36620584  0.06087251 0.3917823
## wrky_ctrl-col_salt  -0.191166667 -0.40470584  0.02237251 0.1206326
## wrky_salt-col_salt  -0.078166667 -0.29170584  0.13537251 0.9736256
## D_salt-D_ctrl        0.171500000 -0.04203917  0.38503917 0.2332201
## duf_ctrl-D_ctrl     -0.083833333 -0.29737251  0.12970584 0.9586255
## duf_salt-D_ctrl      0.051083333 -0.16245584  0.26462251 0.9988274
## E_ctrl-D_ctrl       -0.024916667 -0.23845584  0.18862251 0.9999972
## E_salt-D_ctrl       -0.064166667 -0.27770584  0.14937251 0.9933320
## wrky_ctrl-D_ctrl    -0.102666667 -0.31620584  0.11087251 0.8672779
## wrky_salt-D_ctrl     0.010333333 -0.20320584  0.22387251 1.0000000
## duf_ctrl-D_salt     -0.255333333 -0.46887251 -0.04179416 0.0070315
## duf_salt-D_salt     -0.120416667 -0.33395584  0.09312251 0.7204424
## E_ctrl-D_salt       -0.196416667 -0.40995584  0.01712251 0.0992831
## E_salt-D_salt       -0.235666667 -0.44920584 -0.02212749 0.0185473
## wrky_ctrl-D_salt    -0.274166667 -0.48770584 -0.06062749 0.0025918
## wrky_salt-D_salt    -0.161166667 -0.37470584  0.05237251 0.3144714
## duf_salt-duf_ctrl    0.134916667 -0.07862251  0.34845584 0.5728149
## E_ctrl-duf_ctrl      0.058916667 -0.15462251  0.27245584 0.9964655
## E_salt-duf_ctrl      0.019666667 -0.19387251  0.23320584 0.9999996
## wrky_ctrl-duf_ctrl  -0.018833333 -0.23237251  0.19470584 0.9999998
## wrky_salt-duf_ctrl   0.094166667 -0.11937251  0.30770584 0.9170333
## E_ctrl-duf_salt     -0.076000000 -0.28953917  0.13753917 0.9781202
## E_salt-duf_salt     -0.115250000 -0.32878917  0.09828917 0.7683626
## wrky_ctrl-duf_salt  -0.153750000 -0.36728917  0.05978917 0.3814695
## wrky_salt-duf_salt  -0.040750000 -0.25428917  0.17278917 0.9998122
## E_salt-E_ctrl       -0.039250000 -0.25278917  0.17428917 0.9998625
## wrky_ctrl-E_ctrl    -0.077750000 -0.29128917  0.13578917 0.9745396
## wrky_salt-E_ctrl     0.035250000 -0.17828917  0.24878917 0.9999442
## wrky_ctrl-E_salt    -0.038500000 -0.25203917  0.17503917 0.9998829
## wrky_salt-E_salt     0.074500000 -0.13903917  0.28803917 0.9808728
## wrky_salt-wrky_ctrl  0.113000000 -0.10053917  0.32653917 0.7880473
P14 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P14)
stat.test
##  col_salt    D_ctrl    D_salt  duf_ctrl  duf_salt    E_ctrl    E_salt wrky_ctrl 
##      "ab"      "ab"       "a"       "b"      "ab"      "ab"       "b"       "b" 
## wrky_salt  col_ctrl 
##      "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] "salt"
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
#AirIdx refers to as leaf anthocyanin content
Crop$Genotype<- factor(Crop$Genotype, levels=c("col", "duf", "wrky","D", "E"))

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

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

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

aov(Alpha ~ All.ID, data = Crop)
## Call:
##    aov(formula = Alpha ~ All.ID, data = Crop)
## 
## Terms:
##                     All.ID  Residuals
## Sum of Squares  0.00183834 0.04359158
## Deg. of Freedom          9        110
## 
## Residual standard error: 0.01990696
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Alpha ~ All.ID, data = Crop))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Alpha ~ All.ID, data = Crop)
## 
## $All.ID
##                              diff         lwr        upr     p adj
## col_salt-col_ctrl   -9.416667e-03 -0.03566372 0.01683039 0.9769155
## D_ctrl-col_ctrl     -1.325000e-02 -0.03949706 0.01299706 0.8303601
## D_salt-col_ctrl     -5.750000e-03 -0.03199706 0.02049706 0.9994191
## duf_ctrl-col_ctrl   -5.666667e-03 -0.03191372 0.02058039 0.9994838
## duf_salt-col_ctrl   -8.416667e-03 -0.03466372 0.01783039 0.9893494
## E_ctrl-col_ctrl     -3.333333e-04 -0.02658039 0.02591372 1.0000000
## E_salt-col_ctrl     -7.416667e-03 -0.03366372 0.01883039 0.9957700
## wrky_ctrl-col_ctrl  -1.016667e-02 -0.03641372 0.01608039 0.9619898
## wrky_salt-col_ctrl  -6.500000e-03 -0.03274706 0.01974706 0.9984608
## D_ctrl-col_salt     -3.833333e-03 -0.03008039 0.02241372 0.9999804
## D_salt-col_salt      3.666667e-03 -0.02258039 0.02991372 0.9999866
## duf_ctrl-col_salt    3.750000e-03 -0.02249706 0.02999706 0.9999837
## duf_salt-col_salt    1.000000e-03 -0.02524706 0.02724706 1.0000000
## E_ctrl-col_salt      9.083333e-03 -0.01716372 0.03533039 0.9818968
## E_salt-col_salt      2.000000e-03 -0.02424706 0.02824706 0.9999999
## wrky_ctrl-col_salt  -7.500000e-04 -0.02699706 0.02549706 1.0000000
## wrky_salt-col_salt   2.916667e-03 -0.02333039 0.02916372 0.9999982
## D_salt-D_ctrl        7.500000e-03 -0.01874706 0.03374706 0.9954015
## duf_ctrl-D_ctrl      7.583333e-03 -0.01866372 0.03383039 0.9950073
## duf_salt-D_ctrl      4.833333e-03 -0.02141372 0.03108039 0.9998603
## E_ctrl-D_ctrl        1.291667e-02 -0.01333039 0.03916372 0.8504953
## E_salt-D_ctrl        5.833333e-03 -0.02041372 0.03208039 0.9993478
## wrky_ctrl-D_ctrl     3.083333e-03 -0.02316372 0.02933039 0.9999970
## wrky_salt-D_ctrl     6.750000e-03 -0.01949706 0.03299706 0.9979356
## duf_ctrl-D_salt      8.333333e-05 -0.02616372 0.02633039 1.0000000
## duf_salt-D_salt     -2.666667e-03 -0.02891372 0.02358039 0.9999992
## E_ctrl-D_salt        5.416667e-03 -0.02083039 0.03166372 0.9996423
## E_salt-D_salt       -1.666667e-03 -0.02791372 0.02458039 1.0000000
## wrky_ctrl-D_salt    -4.416667e-03 -0.03066372 0.02183039 0.9999344
## wrky_salt-D_salt    -7.500000e-04 -0.02699706 0.02549706 1.0000000
## duf_salt-duf_ctrl   -2.750000e-03 -0.02899706 0.02349706 0.9999989
## E_ctrl-duf_ctrl      5.333333e-03 -0.02091372 0.03158039 0.9996849
## E_salt-duf_ctrl     -1.750000e-03 -0.02799706 0.02449706 1.0000000
## wrky_ctrl-duf_ctrl  -4.500000e-03 -0.03074706 0.02174706 0.9999232
## wrky_salt-duf_ctrl  -8.333333e-04 -0.02708039 0.02541372 1.0000000
## E_ctrl-duf_salt      8.083333e-03 -0.01816372 0.03433039 0.9920268
## E_salt-duf_salt      1.000000e-03 -0.02524706 0.02724706 1.0000000
## wrky_ctrl-duf_salt  -1.750000e-03 -0.02799706 0.02449706 1.0000000
## wrky_salt-duf_salt   1.916667e-03 -0.02433039 0.02816372 1.0000000
## E_salt-E_ctrl       -7.083333e-03 -0.03333039 0.01916372 0.9970113
## wrky_ctrl-E_ctrl    -9.833333e-03 -0.03608039 0.01641372 0.9693058
## wrky_salt-E_ctrl    -6.166667e-03 -0.03241372 0.02008039 0.9989833
## wrky_ctrl-E_salt    -2.750000e-03 -0.02899706 0.02349706 0.9999989
## wrky_salt-E_salt     9.166667e-04 -0.02533039 0.02716372 1.0000000
## wrky_salt-wrky_ctrl  3.666667e-03 -0.02258039 0.02991372 0.9999866
P16 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P16)
stat.test
## $Letters
##  col_salt    D_ctrl    D_salt  duf_ctrl  duf_salt    E_ctrl    E_salt wrky_ctrl 
##       "a"       "a"       "a"       "a"       "a"       "a"       "a"       "a" 
## wrky_salt  col_ctrl 
##       "a"       "a" 
## 
## $LetterMatrix
##              a
## col_salt  TRUE
## D_ctrl    TRUE
## D_salt    TRUE
## duf_ctrl  TRUE
## duf_salt  TRUE
## E_ctrl    TRUE
## E_salt    TRUE
## wrky_ctrl TRUE
## wrky_salt TRUE
## col_ctrl  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] "salt"
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
#Alpha: refers to as light response curve.
Crop$Genotype<- factor(Crop$Genotype, levels=c("col", "duf", "wrky","D", "E"))

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

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

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