This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.

getwd()
## [1] "C:/Users/Julkowska Lab/Desktop/R codes by Maryam/20240306_ICP-MS_FW_DW_Soil_grown_duf_wrky_2xko"
list.files(pattern = ".csv")
## [1] "20240402_ICP_soil_5geno_arabidopsis_phenorigs.csv"
ICP_wd <- read.csv("20240402_ICP_soil_5geno_arabidopsis_phenorigs.csv")
ICP_wd
ICP_wd$All.ID2<-paste(ICP_wd$Accession,ICP_wd$Tissue, sep="_")
ICP_wd
library(ggplot2)
library(ggpubr)
library(multcompView)
## Warning: package 'multcompView' was built under R version 4.3.2
aov(Na.con.mg.mg.dry.weight ~ All.ID2, data = ICP_wd)
## Call:
##    aov(formula = Na.con.mg.mg.dry.weight ~ All.ID2, data = ICP_wd)
## 
## Terms:
##                  All.ID2 Residuals
## Sum of Squares  389.2321  384.4170
## Deg. of Freedom        9       102
## 
## Residual standard error: 1.941338
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Na.con.mg.mg.dry.weight ~ All.ID2, data = ICP_wd))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Na.con.mg.mg.dry.weight ~ All.ID2, data = ICP_wd)
## 
## $All.ID2
##                      diff        lwr        upr     p adj
## col_sh-col_ro  3.19998578  0.5786010  5.8213706 0.0054059
## d_ro-col_ro   -2.34464449 -4.9084094  0.2191204 0.1033193
## d_sh-col_ro    1.03774817 -1.5260167  3.6015131 0.9493133
## duf_ro-col_ro -1.41397899 -4.1028783  1.2749203 0.7923412
## duf_sh-col_ro  2.41645668 -0.2049281  5.0378415 0.0974417
## e_ro-col_ro   -2.14068920 -4.8295885  0.5482101 0.2430026
## e_sh-col_ro    0.95997022 -1.7289291  3.6488695 0.9773112
## w_ro-col_ro   -1.10312432 -3.6668892  1.4606406 0.9270707
## w_sh-col_ro    2.10277463 -0.4609903  4.6665395 0.2073594
## d_ro-col_sh   -5.54463027 -8.1660151 -2.9232455 0.0000000
## d_sh-col_sh   -2.16223761 -4.7836224  0.4591472 0.2009076
## duf_ro-col_sh -4.61396477 -7.3578575 -1.8700720 0.0000159
## duf_sh-col_sh -0.78352910 -3.4612942  1.8942360 0.9944148
## e_ro-col_sh   -5.34067498 -8.0845677 -2.5967823 0.0000003
## e_sh-col_sh   -2.24001556 -4.9839083  0.5038772 0.2127690
## w_ro-col_sh   -4.30311010 -6.9244949 -1.6817253 0.0000277
## w_sh-col_sh   -1.09721115 -3.7185959  1.5241736 0.9379777
## d_sh-d_ro      3.38239266  0.8186278  5.9461576 0.0017461
## duf_ro-d_ro    0.93066550 -1.7582338  3.6195648 0.9815890
## duf_sh-d_ro    4.76110117  2.1397164  7.3824860 0.0000023
## e_ro-d_ro      0.20395528 -2.4849440  2.8928546 0.9999999
## e_sh-d_ro      3.30461470  0.6157154  5.9935140 0.0049319
## w_ro-d_ro      1.24152017 -1.3222447  3.8052851 0.8608657
## w_sh-d_ro      4.44741912  1.8836542  7.0111840 0.0000076
## duf_ro-d_sh   -2.45172716 -5.1406265  0.2371722 0.1055970
## duf_sh-d_sh    1.37870851 -1.2426763  4.0000933 0.7921803
## e_ro-d_sh     -3.17843737 -5.8673367 -0.4895381 0.0082443
## e_sh-d_sh     -0.07777795 -2.7666773  2.6111214 1.0000000
## w_ro-d_sh     -2.14087249 -4.7046374  0.4228924 0.1872644
## w_sh-d_sh      1.06502646 -1.4987384  3.6287914 0.9407056
## duf_sh-duf_ro  3.83043567  1.0865429  6.5743284 0.0006903
## e_ro-duf_ro   -0.72671021 -3.5351740  2.0817535 0.9977923
## e_sh-duf_ro    2.37394921 -0.4345145  5.1824129 0.1742657
## w_ro-duf_ro    0.31085467 -2.3780446  2.9997540 0.9999973
## w_sh-duf_ro    3.51675362  0.8278543  6.2056529 0.0019981
## e_ro-duf_sh   -4.55714588 -7.3010386 -1.8132532 0.0000213
## e_sh-duf_sh   -1.45648646 -4.2003792  1.2874063 0.7832702
## w_ro-duf_sh   -3.51958100 -6.1409658 -0.8981962 0.0013222
## w_sh-duf_sh   -0.31368205 -2.9350668  2.3077027 0.9999964
## e_sh-e_ro      3.10065942  0.2921957  5.9091232 0.0185633
## w_ro-e_ro      1.03756488 -1.6513344  3.7264642 0.9623660
## w_sh-e_ro      4.24346384  1.5545645  6.9323632 0.0000657
## w_ro-e_sh     -2.06309454 -4.7519939  0.6258048 0.2907345
## w_sh-e_sh      1.14280442 -1.5460949  3.8317037 0.9321231
## w_sh-w_ro      3.20589895  0.6421340  5.7696639 0.0038748
P7 = Output$All.ID2[,'p adj']
stat.test<- multcompLetters(P7)
stat.test
## col_sh   d_ro   d_sh duf_ro duf_sh   e_ro   e_sh   w_ro   w_sh col_ro 
##    "a"    "b"  "acd"   "bc"   "ad"    "b"  "acd"   "bc"   "ad"  "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] "sh"
#test$info[[1]][3]

test$Accession <- "none"
test$Tissue<- "none"
test
for(i in 1:nrow(test)){
  test$Accession[i] <- test$info[[i]][1]
  test$Tissue[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Accession
test2$group2 <- test2$Accession


ICP_wd
ICP_wd2 <- subset(ICP_wd, ICP_wd$Na.con.mg.mg.dry.weight < 15)
ICP_wd3 <- subset(ICP_wd2, ICP_wd2$Na.con.mg.mg.dry.weight > 3)

ICP_wd3$Accession <- factor(ICP_wd3$Accession, levels = c("col", "duf", "w", "d","e"))


Na_content_wd <- ggplot(data = ICP_wd3, mapping = aes(x = Accession, y = Na.con.mg.mg.dry.weight, colour = Accession)) 
Na_content_wd <- Na_content_wd + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Na_content_wd <- Na_content_wd + facet_grid(~Tissue , scales = "free_y")

Na_content_wd <- Na_content_wd + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Na_content_wd <- Na_content_wd + scale_color_manual(values = c("blue", "plum", "rosybrown1", "hotpink","red"))
Na_content_wd <- Na_content_wd + ylab("Na content, mg/mg dry weight") + xlab("")+stat_pvalue_manual(test2, label = "Tukey", y.position = 20)
Na_content_wd <- Na_content_wd + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Na_content_wd <- Na_content_wd + rremove("legend")
Na_content_wd

aov(K.con..mg.mg.dry.weight ~ All.ID2, data = ICP_wd)
## Call:
##    aov(formula = K.con..mg.mg.dry.weight ~ All.ID2, data = ICP_wd)
## 
## Terms:
##                  All.ID2 Residuals
## Sum of Squares   499.958  2383.797
## Deg. of Freedom        9       102
## 
## Residual standard error: 4.83431
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(K.con..mg.mg.dry.weight ~ All.ID2, data = ICP_wd))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K.con..mg.mg.dry.weight ~ All.ID2, data = ICP_wd)
## 
## $All.ID2
##                      diff         lwr       upr     p adj
## col_sh-col_ro  2.26491446  -4.2628446  8.792673 0.9812786
## d_ro-col_ro    6.86316830   0.4788940 13.247443 0.0247463
## d_sh-col_ro    5.99120556  -0.3930687 12.375480 0.0850699
## duf_ro-col_ro  6.00469304  -0.6911903 12.700576 0.1188310
## duf_sh-col_ro  6.23111745  -0.2966416 12.758876 0.0743285
## e_ro-col_ro    5.09201218  -1.6038712 11.787896 0.3027421
## e_sh-col_ro    3.48947744  -3.2064059 10.185361 0.8008179
## w_ro-col_ro    5.77869607  -0.6055782 12.162970 0.1113021
## w_sh-col_ro    6.03023740  -0.3540369 12.414512 0.0808550
## d_ro-col_sh    4.59825383  -1.9295052 11.126013 0.4117796
## d_sh-col_sh    3.72629109  -2.8014679 10.254050 0.7041134
## duf_ro-col_sh  3.73977858  -3.0930491 10.572606 0.7517892
## duf_sh-col_sh  3.96620299  -2.7019540 10.634360 0.6528764
## e_ro-col_sh    2.82709772  -4.0057299  9.659925 0.9421131
## e_sh-col_sh    1.22456298  -5.6082647  8.057391 0.9998861
## w_ro-col_sh    3.51378161  -3.0139774 10.041541 0.7692527
## w_sh-col_sh    3.76532294  -2.7624361 10.293082 0.6915409
## d_sh-d_ro     -0.87196274  -7.2562370  5.512312 0.9999887
## duf_ro-d_ro   -0.85847525  -7.5543586  5.837408 0.9999935
## duf_sh-d_ro   -0.63205084  -7.1598099  5.895708 0.9999994
## e_ro-d_ro     -1.77115611  -8.4670395  4.924727 0.9973856
## e_sh-d_ro     -3.37369085 -10.0695742  3.322193 0.8303848
## w_ro-d_ro     -1.08447222  -7.4687465  5.299802 0.9999274
## w_sh-d_ro     -0.83293089  -7.2172052  5.551343 0.9999924
## duf_ro-d_sh    0.01348749  -6.6823959  6.709371 1.0000000
## duf_sh-d_sh    0.23991190  -6.2878471  6.767671 1.0000000
## e_ro-d_sh     -0.89919337  -7.5950767  5.796690 0.9999902
## e_sh-d_sh     -2.50172811  -9.1976115  4.194155 0.9693963
## w_ro-d_sh     -0.21250948  -6.5967838  6.171765 1.0000000
## w_sh-d_sh      0.03903185  -6.3452424  6.423306 1.0000000
## duf_sh-duf_ro  0.22642441  -6.6064033  7.059252 1.0000000
## e_ro-duf_ro   -0.91268086  -7.9063029  6.080941 0.9999924
## e_sh-duf_ro   -2.51521560  -9.5088377  4.478406 0.9761736
## w_ro-duf_ro   -0.22599697  -6.9218803  6.469886 1.0000000
## w_sh-duf_ro    0.02554436  -6.6703390  6.721428 1.0000000
## e_ro-duf_sh   -1.13910527  -7.9719329  5.693722 0.9999380
## e_sh-duf_sh   -2.74164001  -9.5744677  4.091188 0.9519635
## w_ro-duf_sh   -0.45242138  -6.9801804  6.075338 1.0000000
## w_sh-duf_sh   -0.20088005  -6.7286391  6.326879 1.0000000
## e_sh-e_ro     -1.60253474  -8.5961568  5.391087 0.9991494
## w_ro-e_ro      0.68668389  -6.0091995  7.382567 0.9999991
## w_sh-e_ro      0.93822522  -5.7576581  7.634109 0.9999859
## w_ro-e_sh      2.28921863  -4.4066647  8.985102 0.9830709
## w_sh-e_sh      2.54075996  -4.1551234  9.236643 0.9661833
## w_sh-w_ro      0.25154133  -6.1327330  6.635816 1.0000000
P6 = Output$All.ID2[,'p adj']
stat.test<- multcompLetters(P6)
stat.test
## col_sh   d_ro   d_sh duf_ro duf_sh   e_ro   e_sh   w_ro   w_sh col_ro 
##   "ab"    "a"   "ab"   "ab"   "ab"   "ab"   "ab"   "ab"   "ab"    "b"
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] "sh"
#test$info[[1]][3]

test$Accession <- "none"
test$Tissue<- "none"
test
for(i in 1:nrow(test)){
  test$Accession[i] <- test$info[[i]][1]
  test$Tissue[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Accession
test2$group2 <- test2$Accession


ICP_wd
ICP_wd4 <- subset(ICP_wd, ICP_wd$K.con..mg.mg.dry.weight < 35)
ICP_wd5 <- subset(ICP_wd, ICP_wd$K.con..mg.mg.dry.weight >10)
ICP_wd$Accession <- factor(ICP_wd$Accession, levels = c("col", "duf", "w", "d","e"))

k_content_wd <- ggplot(data = ICP_wd5, mapping = aes(x = Accession, y = K.con..mg.mg.dry.weight, colour = Accession)) 
k_content_wd <- k_content_wd + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

k_content_wd <- k_content_wd + facet_grid(~Tissue , scales = "free_y")

k_content_wd <- k_content_wd + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
k_content_wd <- k_content_wd + scale_color_manual(values = c("blue", "plum", "rosybrown1", "hotpink","red"))
k_content_wd <- k_content_wd + ylab("K content, mg/mg dry weight") + xlab("")+stat_pvalue_manual(test2, label = "Tukey", y.position = 45)
k_content_wd <- k_content_wd + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
k_content_wd <- k_content_wd + rremove("legend")
k_content_wd

aov(Na.K.ratio ~ All.ID2, data = ICP_wd)
## Call:
##    aov(formula = Na.K.ratio ~ All.ID2, data = ICP_wd)
## 
## Terms:
##                   All.ID2 Residuals
## Sum of Squares  0.6074367 0.7566360
## Deg. of Freedom         9       102
## 
## Residual standard error: 0.08612781
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Na.K.ratio ~ All.ID2, data = ICP_wd))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Na.K.ratio ~ All.ID2, data = ICP_wd)
## 
## $All.ID2
##                       diff          lwr          upr     p adj
## col_sh-col_ro  0.072751231 -0.043546967  0.189049429 0.5847438
## d_ro-col_ro   -0.167560703 -0.281302584 -0.053818821 0.0002609
## d_sh-col_ro   -0.057691830 -0.171433711  0.056050052 0.8248094
## duf_ro-col_ro -0.125368446 -0.244661938 -0.006074954 0.0312147
## duf_sh-col_ro -0.014084398 -0.130382596  0.102213800 0.9999960
## e_ro-col_ro   -0.154069990 -0.273363482 -0.034776498 0.0024192
## e_sh-col_ro   -0.032450585 -0.151744077  0.086842907 0.9967641
## w_ro-col_ro   -0.123225819 -0.236967701 -0.009483937 0.0227971
## w_sh-col_ro   -0.017471037 -0.131212919  0.096270845 0.9999691
## d_ro-col_sh   -0.240311934 -0.356610132 -0.124013735 0.0000001
## d_sh-col_sh   -0.130443061 -0.246741259 -0.014144862 0.0155351
## duf_ro-col_sh -0.198119677 -0.319852961 -0.076386392 0.0000336
## duf_sh-col_sh -0.086835629 -0.205635150  0.031963892 0.3581016
## e_ro-col_sh   -0.226821221 -0.348554505 -0.105087937 0.0000012
## e_sh-col_sh   -0.105201816 -0.226935100  0.016531468 0.1520081
## w_ro-col_sh   -0.195977050 -0.312275248 -0.079678852 0.0000152
## w_sh-col_sh   -0.090222268 -0.206520466  0.026075930 0.2760850
## d_sh-d_ro      0.109868873 -0.003873009  0.223610755 0.0674445
## duf_ro-d_ro    0.042192257 -0.077101235  0.161485749 0.9786902
## duf_sh-d_ro    0.153476305  0.037178107  0.269774503 0.0017385
## e_ro-d_ro      0.013490713 -0.105802779  0.132784205 0.9999978
## e_sh-d_ro      0.135110118  0.015816626  0.254403610 0.0138828
## w_ro-d_ro      0.044334884 -0.069406998  0.158076765 0.9598888
## w_sh-d_ro      0.150089666  0.036347784  0.263831547 0.0017408
## duf_ro-d_sh   -0.067676616 -0.186970108  0.051616876 0.7114493
## duf_sh-d_sh    0.043607432 -0.072690766  0.159905630 0.9686784
## e_ro-d_sh     -0.096378160 -0.215671652  0.022915332 0.2250689
## e_sh-d_sh      0.025241245 -0.094052247  0.144534737 0.9995522
## w_ro-d_sh     -0.065533989 -0.179275871  0.048207892 0.6929216
## w_sh-d_sh      0.040220793 -0.073521089  0.153962674 0.9787184
## duf_sh-duf_ro  0.111284048 -0.010449236  0.233017332 0.1036241
## e_ro-duf_ro   -0.028701544 -0.153299533  0.095896444 0.9991129
## e_sh-duf_ro    0.092917861 -0.031680128  0.217515849 0.3297289
## w_ro-duf_ro    0.002142627 -0.117150865  0.121436118 1.0000000
## w_sh-duf_ro    0.107897409 -0.011396083  0.227190901 0.1118948
## e_ro-duf_sh   -0.139985592 -0.261718876 -0.018252308 0.0115926
## e_sh-duf_sh   -0.018366187 -0.140099471  0.103367097 0.9999734
## w_ro-duf_sh   -0.109141421 -0.225439619  0.007156777 0.0850487
## w_sh-duf_sh   -0.003386639 -0.119684837  0.112911559 1.0000000
## e_sh-e_ro      0.121619405 -0.002978584  0.246217394 0.0617750
## w_ro-e_ro      0.030844171 -0.088449321  0.150137663 0.9978054
## w_sh-e_ro      0.136598953  0.017305461  0.255892445 0.0121978
## w_ro-e_sh     -0.090775234 -0.210068726  0.028518258 0.3019000
## w_sh-e_sh      0.014979548 -0.104313944  0.134273040 0.9999945
## w_sh-w_ro      0.105754782 -0.007987100  0.219496664 0.0913441
P8 = Output$All.ID2[,'p adj']
stat.test<- multcompLetters(P8)
stat.test
## col_sh   d_ro   d_sh duf_ro duf_sh   e_ro   e_sh   w_ro   w_sh col_ro 
##    "a"    "b" "bcde"  "bcd"  "ace"   "bd" "acde"  "bcd"  "ace"   "ae"
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] "sh"
#test$info[[1]][3]

test$Accession <- "none"
test$Tissue<- "none"
test
for(i in 1:nrow(test)){
  test$Accession[i] <- test$info[[i]][1]
  test$Tissue[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Accession
test2$group2 <- test2$Accession


ICP_wd
ICP_wd6 <- subset(ICP_wd, ICP_wd$Na.K.ratio < 0.6)
ICP_wd6$Accession <- factor(ICP_wd6$Accession, levels = c("col", "duf", "w", "d","e"))


Nak_ratio_wd <- ggplot(data = ICP_wd6, mapping = aes(x = Accession, y = Na.K.ratio, colour = Accession)) 
Nak_ratio_wd <- Nak_ratio_wd + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Nak_ratio_wd <- Nak_ratio_wd + facet_grid(~Tissue, scales = "free_y")

Nak_ratio_wd <- Nak_ratio_wd + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Nak_ratio_wd <- Nak_ratio_wd + scale_color_manual(values = c("blue", "plum", "rosybrown1", "hotpink","red"))
Nak_ratio_wd <- Nak_ratio_wd + ylab("Na+/K+ ratio") + xlab("")+stat_pvalue_manual(test2, label = "Tukey", y.position = 0.65)
Nak_ratio_wd <- Nak_ratio_wd + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Nak_ratio_wd <- Nak_ratio_wd + rremove("legend")
Nak_ratio_wd

aov(DW.mg ~ All.ID2, data = ICP_wd)
## Call:
##    aov(formula = DW.mg ~ All.ID2, data = ICP_wd)
## 
## Terms:
##                   All.ID2 Residuals
## Sum of Squares  10266.256  5453.984
## Deg. of Freedom         9       102
## 
## Residual standard error: 7.312348
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(DW.mg ~ All.ID2, data = ICP_wd))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = DW.mg ~ All.ID2, data = ICP_wd)
## 
## $All.ID2
##                      diff        lwr        upr     p adj
## col_sh-col_ro  21.9545455  12.080698  31.828393 0.0000000
## d_ro-col_ro    -0.1083333  -9.765147   9.548480 1.0000000
## d_sh-col_ro    22.4083333  12.751520  32.065147 0.0000000
## duf_ro-col_ro   1.4400000  -8.688152  11.568152 0.9999840
## duf_sh-col_ro  17.1545455   7.280698  27.028393 0.0000073
## e_ro-col_ro    -0.5100000 -10.638152   9.618152 1.0000000
## e_sh-col_ro    17.3000000   7.171848  27.428152 0.0000110
## w_ro-col_ro    -0.3916667 -10.048480   9.265147 1.0000000
## w_sh-col_ro    14.4416667   4.784853  24.098480 0.0001956
## d_ro-col_sh   -22.0628788 -31.936727 -12.189031 0.0000000
## d_sh-col_sh     0.4537879  -9.420060  10.327636 1.0000000
## duf_ro-col_sh -20.5145455 -30.849838 -10.179253 0.0000002
## duf_sh-col_sh  -4.8000000 -14.886213   5.286213 0.8728478
## e_ro-col_sh   -22.4645455 -32.799838 -12.129253 0.0000000
## e_sh-col_sh    -4.6545455 -14.989838   5.680747 0.9055369
## w_ro-col_sh   -22.3462121 -32.220060 -12.472364 0.0000000
## w_sh-col_sh    -7.5128788 -17.386727   2.360969 0.3019960
## d_sh-d_ro      22.5166667  12.859853  32.173480 0.0000000
## duf_ro-d_ro     1.5483333  -8.579818  11.676485 0.9999703
## duf_sh-d_ro    17.2628788   7.389031  27.136727 0.0000062
## e_ro-d_ro      -0.4016667 -10.529818   9.726485 1.0000000
## e_sh-d_ro      17.4083333   7.280182  27.536485 0.0000095
## w_ro-d_ro      -0.2833333  -9.940147   9.373480 1.0000000
## w_sh-d_ro      14.5500000   4.893186  24.206814 0.0001690
## duf_ro-d_sh   -20.9683333 -31.096485 -10.840182 0.0000001
## duf_sh-d_sh    -5.2537879 -15.127636   4.620060 0.7808952
## e_ro-d_sh     -22.9183333 -33.046485 -12.790182 0.0000000
## e_sh-d_sh      -5.1083333 -15.236485   5.019818 0.8295241
## w_ro-d_sh     -22.8000000 -32.456814 -13.143186 0.0000000
## w_sh-d_sh      -7.9666667 -17.623480   1.690147 0.2007250
## duf_sh-duf_ro  15.7145455   5.379253  26.049838 0.0001412
## e_ro-duf_ro    -1.9500000 -12.528509   8.628509 0.9998560
## e_sh-duf_ro    15.8600000   5.281491  26.438509 0.0001862
## w_ro-duf_ro    -1.8316667 -11.959818   8.296485 0.9998772
## w_sh-duf_ro    13.0016667   2.873515  23.129818 0.0026484
## e_ro-duf_sh   -17.6645455 -27.999838  -7.329253 0.0000108
## e_sh-duf_sh     0.1454545 -10.189838  10.480747 1.0000000
## w_ro-duf_sh   -17.5462121 -27.420060  -7.672364 0.0000041
## w_sh-duf_sh    -2.7128788 -12.586727   7.160969 0.9965099
## e_sh-e_ro      17.8100000   7.231491  28.388509 0.0000155
## w_ro-e_ro       0.1183333 -10.009818  10.246485 1.0000000
## w_sh-e_ro      14.9516667   4.823515  25.079818 0.0002508
## w_ro-e_sh     -17.6916667 -27.819818  -7.563515 0.0000064
## w_sh-e_sh      -2.8583333 -12.986485   7.269818 0.9957306
## w_sh-w_ro      14.8333333   5.176520  24.490147 0.0001150
P5 = Output$All.ID2[,'p adj']
stat.test<- multcompLetters(P5)
stat.test
## col_sh   d_ro   d_sh duf_ro duf_sh   e_ro   e_sh   w_ro   w_sh col_ro 
##    "a"    "b"    "a"    "b"    "a"    "b"    "a"    "b"    "a"    "b"
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] "sh"
#test$info[[1]][3]

test$Accession <- "none"
test$Tissue<- "none"
test
for(i in 1:nrow(test)){
  test$Accession[i] <- test$info[[i]][1]
  test$Tissue[i] <- test$info[[i]][2]
  
}

test2 <- test[,c(5:6,1)]
test2$group1 <- test2$Accession
test2$group2 <- test2$Accession


ICP_wd
ICP_wd7 <- subset(ICP_wd, ICP_wd$DW.mg < 40)
ICP_wd7$Accession <- factor(ICP_wd7$Accession, levels = c("col", "duf", "w", "d","e"))

DW_wd <- ggplot(data = ICP_wd7, mapping = aes(x = Accession, y = DW.mg, colour = Accession)) 
DW_wd <- DW_wd + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)
DW_wd <- DW_wd + facet_grid(~Tissue , scales = "free_y")
DW_wd <- DW_wd + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
DW_wd <- DW_wd + scale_color_manual(values = c("blue", "plum", "rosybrown1", "hotpink","red"))
DW_wd <- DW_wd + ylab("Dry weight, mg") + xlab("")+stat_pvalue_manual(test2, label = "Tukey", y.position = 3)
DW_wd <- DW_wd + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
DW_wd <- DW_wd + rremove("legend")
DW_wd

library(cowplot)
## 
## Attaching package: 'cowplot'
## The following object is masked from 'package:ggpubr':
## 
##     get_legend
pdf("ICP-all.pdf", height = 3, width = 12)
plot_grid(Na_content_wd, k_content_wd, Nak_ratio_wd, ncol=3,
          align = "hv", labels=c("AUTO"), 
          label_size = 24)
dev.off()
## png 
##   2