getwd()
## [1] "C:/Users/Julkowska Lab/Desktop/R codes by Maryam/2025_ICP_tomato_cultivated_accession_from_RSA_screening"
setwd("C:/Users/Julkowska Lab/Desktop/R codes by Maryam/2025_ICP_tomato_cultivated_accession_from_RSA_screening")
list.files(pattern = ".csv")
## [1] "ICP-analyzed-R.csv"
ICP <- read.csv("ICP-analyzed-R.csv")
ICP
colnames(ICP)
## [1] "Accession" "Tissue"
## [3] "DW.g" "DW.mg"
## [5] "K.con..mg.mg.dry.weight" "Na.con.mg.mg.dry.weight"
## [7] "Na.K.ratio"
ICP$All.ID<-paste(ICP$Accession, ICP$Tissue, sep="_")
ICP
library(ggplot2)
library(ggpubr)
library(multcompView)
## Warning: package 'multcompView' was built under R version 4.3.2
library(cowplot)
##
## Attaching package: 'cowplot'
## The following object is masked from 'package:ggpubr':
##
## get_legend
aov(Na.con.mg.mg.dry.weight ~ All.ID, data = ICP)
## Call:
## aov(formula = Na.con.mg.mg.dry.weight ~ All.ID, data = ICP)
##
## Terms:
## All.ID Residuals
## Sum of Squares 6584.217 3894.866
## Deg. of Freedom 15 64
##
## Residual standard error: 7.801107
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Na.con.mg.mg.dry.weight ~ All.ID, data = ICP))
Output
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Na.con.mg.mg.dry.weight ~ All.ID, data = ICP)
##
## $All.ID
## diff lwr upr p adj
## acc1_sh-acc1_ro -6.75874591 -24.3505241 10.8330322 0.9908187
## acc10_ro-acc1_ro -13.82989191 -31.4216701 3.7618862 0.2938755
## acc10_sh-acc1_ro -2.37255020 -19.9643284 15.2192279 1.0000000
## acc11_ro-acc1_ro -6.89446026 -24.4862384 10.6973179 0.9888756
## acc11_sh-acc1_ro 1.53374570 -16.0580325 19.1255239 1.0000000
## acc14_ro-acc1_ro -9.50356448 -27.0953426 8.0882137 0.8539131
## acc14_sh-acc1_ro 1.01541753 -16.5763606 18.6071957 1.0000000
## acc5_ro-acc1_ro -16.91598706 -34.5077652 0.6757911 0.0719774
## acc5_sh-acc1_ro 0.93957751 -16.6522006 18.5313557 1.0000000
## acc8_ro-acc1_ro -9.07789445 -26.6696726 8.5138837 0.8919825
## acc8_sh-acc1_ro -9.39391235 -26.9856905 8.1978658 0.8643655
## la1511_ro-acc1_ro -20.78949109 -38.3812692 -3.1977129 0.0072278
## la1511_sh-acc1_ro -5.73967652 -23.3314547 11.8521016 0.9983184
## m248_ro-acc1_ro -18.25760082 -35.8493790 -0.6658227 0.0343432
## m248_sh-acc1_ro 17.02110043 -0.5706777 34.6128786 0.0680918
## acc10_ro-acc1_sh -7.07114600 -24.6629242 10.5206322 0.9858669
## acc10_sh-acc1_sh 4.38619570 -13.2055824 21.9779739 0.9999296
## acc11_ro-acc1_sh -0.13571435 -17.7274925 17.4560638 1.0000000
## acc11_sh-acc1_sh 8.29249161 -9.2992865 25.8842698 0.9443682
## acc14_ro-acc1_sh -2.74481857 -20.3365967 14.8469596 0.9999999
## acc14_sh-acc1_sh 7.77416343 -9.8176147 25.3659416 0.9671047
## acc5_ro-acc1_sh -10.15724116 -27.7490193 7.4345370 0.7829320
## acc5_sh-acc1_sh 7.69832342 -9.8934547 25.2901016 0.9697379
## acc8_ro-acc1_sh -2.31914854 -19.9109267 15.2726296 1.0000000
## acc8_sh-acc1_sh -2.63516644 -20.2269446 14.9566117 0.9999999
## la1511_ro-acc1_sh -14.03074518 -31.6225233 3.5610330 0.2720957
## la1511_sh-acc1_sh 1.01906939 -16.5727088 18.6108475 1.0000000
## m248_ro-acc1_sh -11.49885491 -29.0906331 6.0929232 0.6035532
## m248_sh-acc1_sh 23.77984634 6.1880682 41.3716245 0.0009309
## acc10_sh-acc10_ro 11.45734170 -6.1344365 29.0491199 0.6094743
## acc11_ro-acc10_ro 6.93543165 -10.6563465 24.5272098 0.9882284
## acc11_sh-acc10_ro 15.36363761 -2.2281405 32.9554158 0.1546372
## acc14_ro-acc10_ro 4.32632742 -13.2654507 21.9181056 0.9999407
## acc14_sh-acc10_ro 14.84530943 -2.7464687 32.4370876 0.1947316
## acc5_ro-acc10_ro -3.08609516 -20.6778733 14.5056830 0.9999993
## acc5_sh-acc10_ro 14.76946942 -2.8223087 32.3612476 0.2011861
## acc8_ro-acc10_ro 4.75199746 -12.8397807 22.3437756 0.9998111
## acc8_sh-acc10_ro 4.43597955 -13.1557986 22.0277577 0.9999189
## la1511_ro-acc10_ro -6.95959918 -24.5513773 10.6321790 0.9878327
## la1511_sh-acc10_ro 8.09021539 -9.5015628 25.6819935 0.9542727
## m248_ro-acc10_ro -4.42770891 -22.0194871 13.1640692 0.9999208
## m248_sh-acc10_ro 30.85099234 13.2592142 48.4427705 0.0000042
## acc11_ro-acc10_sh -4.52191005 -22.1136882 13.0698681 0.9998971
## acc11_sh-acc10_sh 3.90629590 -13.6854822 21.4980741 0.9999839
## acc14_ro-acc10_sh -7.13101428 -24.7227924 10.4607639 0.9847127
## acc14_sh-acc10_sh 3.38796773 -14.2038104 20.9797459 0.9999976
## acc5_ro-acc10_sh -14.54343686 -32.1352150 3.0483413 0.2213324
## acc5_sh-acc10_sh 3.31212771 -14.2796504 20.9039059 0.9999982
## acc8_ro-acc10_sh -6.70534424 -24.2971224 10.8864339 0.9915036
## acc8_sh-acc10_sh -7.02136215 -24.6131403 10.5704160 0.9867731
## la1511_ro-acc10_sh -18.41694088 -36.0087190 -0.8251627 0.0313183
## la1511_sh-acc10_sh -3.36712631 -20.9589045 14.2246518 0.9999977
## m248_ro-acc10_sh -15.88505061 -33.4768288 1.7067275 0.1210461
## m248_sh-acc10_sh 19.39365064 1.8018725 36.9854288 0.0174760
## acc11_sh-acc11_ro 8.42820596 -9.1635722 26.0199841 0.9369328
## acc14_ro-acc11_ro -2.60910422 -20.2008824 14.9826739 0.9999999
## acc14_sh-acc11_ro 7.90987778 -9.6819004 25.5016559 0.9619723
## acc5_ro-acc11_ro -10.02152681 -27.6133050 7.5702513 0.7988168
## acc5_sh-acc11_ro 7.83403777 -9.7577404 25.4258159 0.9649082
## acc8_ro-acc11_ro -2.18343419 -19.7752123 15.4083440 1.0000000
## acc8_sh-acc11_ro -2.49945209 -20.0912302 15.0923261 1.0000000
## la1511_ro-acc11_ro -13.89503083 -31.4868090 3.6967473 0.2866977
## la1511_sh-acc11_ro 1.15478374 -16.4369944 18.7465619 1.0000000
## m248_ro-acc11_ro -11.36314056 -28.9549187 6.2286376 0.6228730
## m248_sh-acc11_ro 23.91556069 6.3237825 41.5073388 0.0008446
## acc14_ro-acc11_sh -11.03731018 -28.6290883 6.5544680 0.6686054
## acc14_sh-acc11_sh -0.51832817 -18.1101063 17.0734500 1.0000000
## acc5_ro-acc11_sh -18.44973276 -36.0415109 -0.8579546 0.0307263
## acc5_sh-acc11_sh -0.59416819 -18.1859463 16.9976100 1.0000000
## acc8_ro-acc11_sh -10.61164015 -28.2034183 6.9801380 0.7260320
## acc8_sh-acc11_sh -10.92765805 -28.5194362 6.6641201 0.6836986
## la1511_ro-acc11_sh -22.32323679 -39.9150149 -4.7314586 0.0025872
## la1511_sh-acc11_sh -7.27342222 -24.8652004 10.3183559 0.9816684
## m248_ro-acc11_sh -19.79134652 -37.3831247 -2.1995684 0.0136653
## m248_sh-acc11_sh 15.48735473 -2.1044234 33.0791329 0.1460755
## acc14_sh-acc14_ro 10.51898201 -7.0727961 28.1107602 0.7380549
## acc5_ro-acc14_ro -7.41242258 -25.0042007 10.1793556 0.9782605
## acc5_sh-acc14_ro 10.44314199 -7.1486362 28.0349201 0.7477455
## acc8_ro-acc14_ro 0.42567004 -17.1661081 18.0174482 1.0000000
## acc8_sh-acc14_ro 0.10965213 -17.4821260 17.7014303 1.0000000
## la1511_ro-acc14_ro -11.28592660 -28.8777048 6.3058515 0.6338072
## la1511_sh-acc14_ro 3.76388797 -13.8278902 21.3556661 0.9999901
## m248_ro-acc14_ro -8.75403634 -26.3458145 8.8377418 0.9163635
## m248_sh-acc14_ro 26.52466492 8.9328868 44.1164431 0.0001230
## acc5_ro-acc14_sh -17.93140459 -35.5231827 -0.3396264 0.0413640
## acc5_sh-acc14_sh -0.07584002 -17.6676182 17.5159381 1.0000000
## acc8_ro-acc14_sh -10.09331197 -27.6850901 7.4984662 0.7904842
## acc8_sh-acc14_sh -10.40932988 -28.0011080 7.1824483 0.7520203
## la1511_ro-acc14_sh -21.80490861 -39.3966868 -4.2131305 0.0036835
## la1511_sh-acc14_sh -6.75509404 -24.3468722 10.8366841 0.9908669
## m248_ro-acc14_sh -19.27301834 -36.8647965 -1.6812402 0.0188123
## m248_sh-acc14_sh 16.00568291 -1.5860952 33.5974611 0.1141746
## acc5_sh-acc5_ro 17.85556457 0.2637864 35.4473427 0.0431687
## acc8_ro-acc5_ro 7.83809262 -9.7536855 25.4298708 0.9647556
## acc8_sh-acc5_ro 7.52207471 -10.0697034 25.1138529 0.9752434
## la1511_ro-acc5_ro -3.87350402 -21.4652822 13.7182741 0.9999856
## la1511_sh-acc5_ro 11.17631055 -6.4154676 28.7680887 0.6492361
## m248_ro-acc5_ro -1.34161375 -18.9333919 16.2501644 1.0000000
## m248_sh-acc5_ro 33.93708750 16.3453093 51.5288657 0.0000004
## acc8_ro-acc5_sh -10.01747196 -27.6092501 7.5743062 0.7992828
## acc8_sh-acc5_sh -10.33348986 -27.9252680 7.2582883 0.7615017
## la1511_ro-acc5_sh -21.72906860 -39.3208467 -4.1372904 0.0038769
## la1511_sh-acc5_sh -6.67925403 -24.2710322 10.9125241 0.9918228
## m248_ro-acc5_sh -19.19717833 -36.7889565 -1.6054002 0.0196997
## m248_sh-acc5_sh 16.08152292 -1.5102552 33.6733011 0.1100191
## acc8_sh-acc8_ro -0.31601791 -17.9077961 17.2757602 1.0000000
## la1511_ro-acc8_ro -11.71159664 -29.3033748 5.8801815 0.5731116
## la1511_sh-acc8_ro 3.33821793 -14.2535602 20.9299961 0.9999980
## m248_ro-acc8_ro -9.17970637 -26.7714845 8.4120718 0.8834959
## m248_sh-acc8_ro 26.09899488 8.5072167 43.6907730 0.0001696
## la1511_ro-acc8_sh -11.39557873 -28.9873569 6.1961994 0.6182657
## la1511_sh-acc8_sh 3.65423584 -13.9375423 21.2460140 0.9999933
## m248_ro-acc8_sh -8.86368847 -26.4554666 8.7280897 0.9085532
## m248_sh-acc8_sh 26.41501279 8.8232346 44.0067909 0.0001336
## la1511_sh-la1511_ro 15.04981457 -2.5419636 32.6415927 0.1780827
## m248_ro-la1511_ro 2.53189027 -15.0598879 20.1236684 1.0000000
## m248_sh-la1511_ro 37.81059152 20.2188134 55.4023697 0.0000000
## m248_ro-la1511_sh -12.51792430 -30.1097025 5.0738539 0.4589695
## m248_sh-la1511_sh 22.76077695 5.1689988 40.3525551 0.0019116
## m248_sh-m248_ro 35.27870125 17.6869231 52.8704794 0.0000001
P6 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P6)
stat.test
## acc1_sh acc10_ro acc10_sh acc11_ro acc11_sh acc14_ro acc14_sh acc5_ro
## "abcd" "abcd" "abc" "abcd" "ae" "abcd" "ae" "bcd"
## acc5_sh acc8_ro acc8_sh la1511_ro la1511_sh m248_ro m248_sh acc1_ro
## "ae" "abcd" "abcd" "d" "abcd" "cd" "e" "abe"
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$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(4:5,1)]
test2$group1 <- test2$Accession
test2$group2 <- test2$Accession
ICP$Accession<- factor(ICP$Accession, levels=c("la1511", "m248", "acc1", "acc5" ,"acc8", "acc10" , "acc11", "acc14" ))
ICP2 <- subset(ICP, ICP$Na.con.mg.mg.dry.weight < 80 & ICP$Na.con.mg.mg.dry.weight > 35)
Na_content <- ggplot(data = ICP2, mapping = aes(x = Accession, y = Na.con.mg.mg.dry.weight, colour = Accession))
Na_content <- Na_content + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)
Na_content <- Na_content + facet_grid(~Tissue , scales = "free_y")
Na_content <- Na_content + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Na_content <- Na_content + scale_color_manual(values = c("blue", "plum", "darkorchid1","cyan1", "darkturquoise","red","hotpink", "darkgoldenrod" ))
Na_content <- Na_content + ylab("Na content, mg/mg dry weight") + xlab("")+stat_pvalue_manual(test2, label = "Tukey", y.position = 40)
Na_content <- Na_content + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Na_content <- Na_content + rremove("legend")
Na_content

aov(K.con..mg.mg.dry.weight ~ All.ID, data = ICP)
## Call:
## aov(formula = K.con..mg.mg.dry.weight ~ All.ID, data = ICP)
##
## Terms:
## All.ID Residuals
## Sum of Squares 4501.008 2643.509
## Deg. of Freedom 15 64
##
## Residual standard error: 6.426883
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(K.con..mg.mg.dry.weight ~ All.ID, data = ICP))
Output
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = K.con..mg.mg.dry.weight ~ All.ID, data = ICP)
##
## $All.ID
## diff lwr upr p adj
## acc1_sh-acc1_ro -2.7037175 -17.1965703 11.7891352 0.9999984
## acc10_ro-acc1_ro -1.8556797 -16.3485324 12.6371731 1.0000000
## acc10_sh-acc1_ro 2.3988394 -12.0940134 16.8916921 0.9999997
## acc11_ro-acc1_ro -10.3290924 -24.8219452 4.1637604 0.4562434
## acc11_sh-acc1_ro -13.1664199 -27.6592726 1.3264329 0.1155138
## acc14_ro-acc1_ro -8.5462022 -23.0390550 5.9466505 0.7565073
## acc14_sh-acc1_ro -7.1843878 -21.6772406 7.3084649 0.9186561
## acc5_ro-acc1_ro -10.8481215 -25.3409743 3.6447312 0.3727280
## acc5_sh-acc1_ro -6.0437962 -20.5366490 8.4490565 0.9801871
## acc8_ro-acc1_ro -9.7055974 -24.1984502 4.7872554 0.5631814
## acc8_sh-acc1_ro -21.2658664 -35.7587192 -6.7730137 0.0002101
## la1511_ro-acc1_ro -6.4264255 -20.9192783 8.0664273 0.9661496
## la1511_sh-acc1_ro -21.7964136 -36.2892664 -7.3035609 0.0001295
## m248_ro-acc1_ro -9.1546853 -23.6475381 5.3381674 0.6582024
## m248_sh-acc1_ro -24.6777472 -39.1705999 -10.1848944 0.0000086
## acc10_ro-acc1_sh 0.8480379 -13.6448149 15.3408906 1.0000000
## acc10_sh-acc1_sh 5.1025569 -9.3902959 19.5954097 0.9961978
## acc11_ro-acc1_sh -7.6253749 -22.1182276 6.8674779 0.8768914
## acc11_sh-acc1_sh -10.4627023 -24.9555551 4.0301504 0.4341004
## acc14_ro-acc1_sh -5.8424847 -20.3353375 8.6503681 0.9854777
## acc14_sh-acc1_sh -4.4806703 -18.9735231 10.0121825 0.9990784
## acc5_ro-acc1_sh -8.1444040 -22.6372568 6.3484488 0.8141200
## acc5_sh-acc1_sh -3.3400787 -17.8329314 11.1527741 0.9999740
## acc8_ro-acc1_sh -7.0018799 -21.4947326 7.4909729 0.9327909
## acc8_sh-acc1_sh -18.5621489 -33.0550017 -4.0692961 0.0022417
## la1511_ro-acc1_sh -3.7227080 -18.2155607 10.7701448 0.9998980
## la1511_sh-acc1_sh -19.0926961 -33.5855488 -4.5998433 0.0014301
## m248_ro-acc1_sh -6.4509678 -20.9438206 8.0418850 0.9650468
## m248_sh-acc1_sh -21.9740296 -36.4668824 -7.4811769 0.0001100
## acc10_sh-acc10_ro 4.2545190 -10.2383337 18.7473718 0.9994920
## acc11_ro-acc10_ro -8.4734127 -22.9662655 6.0194400 0.7674551
## acc11_sh-acc10_ro -11.3107402 -25.8035930 3.1821126 0.3051777
## acc14_ro-acc10_ro -6.6905226 -21.1833753 7.8023302 0.9528482
## acc14_sh-acc10_ro -5.3287082 -19.8215609 9.1641446 0.9940639
## acc5_ro-acc10_ro -8.9924419 -23.4852946 5.5004109 0.6853955
## acc5_sh-acc10_ro -4.1881165 -18.6809693 10.3047362 0.9995774
## acc8_ro-acc10_ro -7.8499177 -22.3427705 6.6429350 0.8514826
## acc8_sh-acc10_ro -19.4101867 -33.9030395 -4.9173340 0.0010886
## la1511_ro-acc10_ro -4.5707458 -19.0635986 9.9221069 0.9988464
## la1511_sh-acc10_ro -19.9407339 -34.4335867 -5.4478812 0.0006859
## m248_ro-acc10_ro -7.2990057 -21.7918584 7.1938471 0.9088444
## m248_sh-acc10_ro -22.8220675 -37.3149203 -8.3292147 0.0000501
## acc11_ro-acc10_sh -12.7279318 -27.2207845 1.7649210 0.1486569
## acc11_sh-acc10_sh -15.5652592 -30.0581120 -1.0724065 0.0236503
## acc14_ro-acc10_sh -10.9450416 -25.4378944 3.5478112 0.3579777
## acc14_sh-acc10_sh -9.5832272 -24.0760800 4.9096256 0.5844634
## acc5_ro-acc10_sh -13.2469609 -27.7398137 1.2458919 0.1101292
## acc5_sh-acc10_sh -8.4426356 -22.9354883 6.0502172 0.7720203
## acc8_ro-acc10_sh -12.1044368 -26.5972895 2.3884160 0.2078790
## acc8_sh-acc10_sh -23.6647058 -38.1575585 -9.1718530 0.0000226
## la1511_ro-acc10_sh -8.8252649 -23.3181176 5.6675879 0.7127549
## la1511_sh-acc10_sh -24.1952530 -38.6881057 -9.7024002 0.0000137
## m248_ro-acc10_sh -11.5535247 -26.0463775 2.9393281 0.2728154
## m248_sh-acc10_sh -27.0765865 -41.5694393 -12.5837338 0.0000008
## acc11_sh-acc11_ro -2.8373275 -17.3301802 11.6555253 0.9999970
## acc14_ro-acc11_ro 1.7828902 -12.7099626 16.2757429 1.0000000
## acc14_sh-acc11_ro 3.1447046 -11.3481482 17.6375573 0.9999881
## acc5_ro-acc11_ro -0.5190291 -15.0118819 13.9738236 1.0000000
## acc5_sh-acc11_ro 4.2852962 -10.2075566 18.7781490 0.9994476
## acc8_ro-acc11_ro 0.6234950 -13.8693578 15.1163478 1.0000000
## acc8_sh-acc11_ro -10.9367740 -25.4296268 3.5560787 0.3592242
## la1511_ro-acc11_ro 3.9026669 -10.5901859 18.3955197 0.9998181
## la1511_sh-acc11_ro -11.4673212 -25.9601740 3.0255316 0.2840498
## m248_ro-acc11_ro 1.1744071 -13.3184457 15.6672598 1.0000000
## m248_sh-acc11_ro -14.3486548 -28.8415075 0.1441980 0.0550407
## acc14_ro-acc11_sh 4.6202177 -9.8726351 19.1130704 0.9986989
## acc14_sh-acc11_sh 5.9820320 -8.5108207 20.4748848 0.9819483
## acc5_ro-acc11_sh 2.3182983 -12.1745544 16.8111511 0.9999998
## acc5_sh-acc11_sh 7.1226237 -7.3702291 21.6154764 0.9236426
## acc8_ro-acc11_sh 3.4608225 -11.0320303 17.9536752 0.9999591
## acc8_sh-acc11_sh -8.0994465 -22.5922993 6.3934062 0.8201074
## la1511_ro-acc11_sh 6.7399944 -7.7528584 21.2328472 0.9499897
## la1511_sh-acc11_sh -8.6299937 -23.1228465 5.8628590 0.7436539
## m248_ro-acc11_sh 4.0117345 -10.4811182 18.5045873 0.9997464
## m248_sh-acc11_sh -11.5113273 -26.0041801 2.9815255 0.2782791
## acc14_sh-acc14_ro 1.3618144 -13.1310384 15.8546672 1.0000000
## acc5_ro-acc14_ro -2.3019193 -16.7947721 12.1909335 0.9999998
## acc5_sh-acc14_ro 2.5024060 -11.9904467 16.9952588 0.9999994
## acc8_ro-acc14_ro -1.1593952 -15.6522479 13.3334576 1.0000000
## acc8_sh-acc14_ro -12.7196642 -27.2125170 1.7731886 0.1493467
## la1511_ro-acc14_ro 2.1197767 -12.3730760 16.6126295 0.9999999
## la1511_sh-acc14_ro -13.2502114 -27.7430641 1.2426414 0.1099162
## m248_ro-acc14_ro -0.6084831 -15.1013359 13.8843697 1.0000000
## m248_sh-acc14_ro -16.1315449 -30.6243977 -1.6386922 0.0155743
## acc5_ro-acc14_sh -3.6637337 -18.1565865 10.8291191 0.9999163
## acc5_sh-acc14_sh 1.1405916 -13.3522611 15.6334444 1.0000000
## acc8_ro-acc14_sh -2.5212096 -17.0140623 11.9716432 0.9999994
## acc8_sh-acc14_sh -14.0814786 -28.5743313 0.4113742 0.0655584
## la1511_ro-acc14_sh 0.7579623 -13.7348904 15.2508151 1.0000000
## la1511_sh-acc14_sh -14.6120258 -29.1048785 -0.1191730 0.0461445
## m248_ro-acc14_sh -1.9702975 -16.4631503 12.5225553 1.0000000
## m248_sh-acc14_sh -17.4933593 -31.9862121 -3.0005066 0.0053978
## acc5_sh-acc5_ro 4.8043253 -9.6885274 19.2971781 0.9979993
## acc8_ro-acc5_ro 1.1425241 -13.3503286 15.6353769 1.0000000
## acc8_sh-acc5_ro -10.4177449 -24.9105976 4.0751079 0.4415078
## la1511_ro-acc5_ro 4.4216960 -10.0711567 18.9145488 0.9992074
## la1511_sh-acc5_ro -10.9482921 -25.4411448 3.5445607 0.3574882
## m248_ro-acc5_ro 1.6934362 -12.7994166 16.1862890 1.0000000
## m248_sh-acc5_ro -13.8296256 -28.3224784 0.6632271 0.0770133
## acc8_ro-acc5_sh -3.6618012 -18.1546540 10.8310516 0.9999169
## acc8_sh-acc5_sh -15.2220702 -29.7149230 -0.7292174 0.0302432
## la1511_ro-acc5_sh -0.3826293 -14.8754820 14.1102235 1.0000000
## la1511_sh-acc5_sh -15.7526174 -30.2454702 -1.2597646 0.0206306
## m248_ro-acc5_sh -3.1108891 -17.6037419 11.3819636 0.9999897
## m248_sh-acc5_sh -18.6339510 -33.1268037 -4.1410982 0.0021104
## acc8_sh-acc8_ro -11.5602690 -26.0531218 2.9325838 0.2719485
## la1511_ro-acc8_ro 3.2791719 -11.2136808 17.7720247 0.9999795
## la1511_sh-acc8_ro -12.0908162 -26.5836690 2.4020366 0.2093402
## m248_ro-acc8_ro 0.5509121 -13.9419407 15.0437648 1.0000000
## m248_sh-acc8_ro -14.9721498 -29.4650025 -0.4792970 0.0360419
## la1511_ro-acc8_sh 14.8394409 0.3465882 29.3322937 0.0395092
## la1511_sh-acc8_sh -0.5305472 -15.0234000 13.9623056 1.0000000
## m248_ro-acc8_sh 12.1111811 -2.3816717 26.6040339 0.2071582
## m248_sh-acc8_sh -3.4118808 -17.9047335 11.0809720 0.9999659
## la1511_sh-la1511_ro -15.3699881 -29.8628409 -0.8771354 0.0272209
## m248_ro-la1511_ro -2.7282598 -17.2211126 11.7645929 0.9999982
## m248_sh-la1511_ro -18.2513217 -32.7441744 -3.7584689 0.0029056
## m248_ro-la1511_sh 12.6417283 -1.8511245 27.1345810 0.1559714
## m248_sh-la1511_sh -2.8813336 -17.3741863 11.6115192 0.9999963
## m248_sh-m248_ro -15.5230618 -30.0159146 -1.0302091 0.0243837
P5 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P5)
stat.test
## acc1_sh acc10_ro acc10_sh acc11_ro acc11_sh acc14_ro acc14_sh acc5_ro
## "ab" "ab" "a" "abcde" "bcde" "abcd" "abd" "abcde"
## acc5_sh acc8_ro acc8_sh la1511_ro la1511_sh m248_ro m248_sh acc1_ro
## "ab" "abcd" "cde" "ab" "ce" "abcd" "e" "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] "sh"
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(4:5,1)]
test2$group1 <- test2$Accession
test2$group2 <- test2$Accession
ICP3 <- subset(ICP, ICP$K.con..mg.mg.dry.weight < 50 )
k_content <- ggplot(data = ICP3, mapping = aes(x = Accession, y = K.con..mg.mg.dry.weight, colour = Accession))
k_content <- k_content + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)
k_content <- k_content + facet_grid(~Tissue , scales = "free_y")
k_content <- k_content + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
k_content <- k_content + scale_color_manual(values = c("blue", "plum", "darkorchid1","cyan1", "darkturquoise","red","hotpink", "darkgoldenrod" ))
k_content <- k_content + ylab("K content, mg/mg dry weight") + xlab("")+stat_pvalue_manual(test2, label = "Tukey", y.position = 65)
k_content <- k_content + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
k_content <- k_content + rremove("legend")
k_content

aov(Na.K.ratio ~ All.ID, data = ICP)
## Call:
## aov(formula = Na.K.ratio ~ All.ID, data = ICP)
##
## Terms:
## All.ID Residuals
## Sum of Squares 66.64539 12.77661
## Deg. of Freedom 15 64
##
## Residual standard error: 0.4468047
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Na.K.ratio ~ All.ID, data = ICP))
Output
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Na.K.ratio ~ All.ID, data = ICP)
##
## $All.ID
## diff lwr upr p adj
## acc1_sh-acc1_ro 0.012652075 -0.99490872 1.02021287 1.0000000
## acc10_ro-acc1_ro -0.264834046 -1.27239484 0.74272675 0.9998646
## acc10_sh-acc1_ro -0.097272284 -1.10483308 0.91028851 1.0000000
## acc11_ro-acc1_ro 0.289969629 -0.71759117 1.29753043 0.9995974
## acc11_sh-acc1_ro 0.878895695 -0.12866510 1.88645649 0.1559375
## acc14_ro-acc1_ro 0.098103539 -0.90945726 1.10566434 1.0000000
## acc14_sh-acc1_ro 0.429538937 -0.57802186 1.43709973 0.9758850
## acc5_ro-acc1_ro 0.001437951 -1.00612285 1.00899875 1.0000000
## acc5_sh-acc1_ro 0.295961283 -0.71159951 1.30352208 0.9994884
## acc8_ro-acc1_ro 0.192363486 -0.81519731 1.19992428 0.9999978
## acc8_sh-acc1_ro 1.129062275 0.12150148 2.13662307 0.0143475
## la1511_ro-acc1_ro -0.338857039 -1.34641784 0.66870376 0.9976610
## la1511_sh-acc1_ro 1.418491895 0.41093110 2.42605269 0.0004557
## m248_ro-acc1_ro -0.168893232 -1.17645403 0.83866756 0.9999996
## m248_sh-acc1_ro 3.466045941 2.45848514 4.47360674 0.0000000
## acc10_ro-acc1_sh -0.277486121 -1.28504692 0.73007468 0.9997614
## acc10_sh-acc1_sh -0.109924359 -1.11748516 0.89763644 1.0000000
## acc11_ro-acc1_sh 0.277317554 -0.73024324 1.28487835 0.9997632
## acc11_sh-acc1_sh 0.866243620 -0.14131718 1.87380442 0.1722812
## acc14_ro-acc1_sh 0.085451464 -0.92210933 1.09301226 1.0000000
## acc14_sh-acc1_sh 0.416886862 -0.59067394 1.42444766 0.9815460
## acc5_ro-acc1_sh -0.011214124 -1.01877492 0.99634667 1.0000000
## acc5_sh-acc1_sh 0.283309208 -0.72425159 1.29087001 0.9996942
## acc8_ro-acc1_sh 0.179711411 -0.82784939 1.18727221 0.9999991
## acc8_sh-acc1_sh 1.116410200 0.10884940 2.12397100 0.0164492
## la1511_ro-acc1_sh -0.351509114 -1.35906991 0.65605168 0.9965448
## la1511_sh-acc1_sh 1.405839820 0.39827902 2.41340062 0.0005355
## m248_ro-acc1_sh -0.181545307 -1.18910610 0.82601549 0.9999990
## m248_sh-acc1_sh 3.453393866 2.44583307 4.46095466 0.0000000
## acc10_sh-acc10_ro 0.167561762 -0.83999904 1.17512256 0.9999997
## acc11_ro-acc10_ro 0.554803675 -0.45275712 1.56236447 0.8354821
## acc11_sh-acc10_ro 1.143729741 0.13616894 2.15129054 0.0122232
## acc14_ro-acc10_ro 0.362937585 -0.64462321 1.37049838 0.9951828
## acc14_sh-acc10_ro 0.694372983 -0.31318781 1.70193378 0.5142416
## acc5_ro-acc10_ro 0.266271997 -0.74128880 1.27383279 0.9998553
## acc5_sh-acc10_ro 0.560795329 -0.44676547 1.56835613 0.8244274
## acc8_ro-acc10_ro 0.457197532 -0.55036327 1.46475833 0.9589928
## acc8_sh-acc10_ro 1.393896321 0.38633552 2.40145712 0.0006231
## la1511_ro-acc10_ro -0.074022993 -1.08158379 0.93353780 1.0000000
## la1511_sh-acc10_ro 1.683325941 0.67576514 2.69088674 0.0000134
## m248_ro-acc10_ro 0.095940814 -0.91161998 1.10350161 1.0000000
## m248_sh-acc10_ro 3.730879987 2.72331919 4.73844078 0.0000000
## acc11_ro-acc10_sh 0.387241913 -0.62031888 1.39480271 0.9907868
## acc11_sh-acc10_sh 0.976167980 -0.03139282 1.98372878 0.0672815
## acc14_ro-acc10_sh 0.195375823 -0.81218497 1.20293662 0.9999973
## acc14_sh-acc10_sh 0.526811221 -0.48074958 1.53437202 0.8819293
## acc5_ro-acc10_sh 0.098710235 -0.90885056 1.10627103 1.0000000
## acc5_sh-acc10_sh 0.393233567 -0.61432723 1.40079436 0.9893117
## acc8_ro-acc10_sh 0.289635770 -0.71792503 1.29719657 0.9996028
## acc8_sh-acc10_sh 1.226334559 0.21877376 2.23389536 0.0047967
## la1511_ro-acc10_sh -0.241584755 -1.24914555 0.76597604 0.9999569
## la1511_sh-acc10_sh 1.515764179 0.50820338 2.52332498 0.0001287
## m248_ro-acc10_sh -0.071620948 -1.07918175 0.93593985 1.0000000
## m248_sh-acc10_sh 3.563318225 2.55575743 4.57087902 0.0000000
## acc11_sh-acc11_ro 0.588926066 -0.41863473 1.59648686 0.7677891
## acc14_ro-acc11_ro -0.191866090 -1.19942689 0.81569471 0.9999979
## acc14_sh-acc11_ro 0.139569308 -0.86799149 1.14713011 1.0000000
## acc5_ro-acc11_ro -0.288531678 -1.29609248 0.71902912 0.9996203
## acc5_sh-acc11_ro 0.005991654 -1.00156914 1.01355245 1.0000000
## acc8_ro-acc11_ro -0.097606143 -1.10516694 0.90995465 1.0000000
## acc8_sh-acc11_ro 0.839092646 -0.16846815 1.84665344 0.2116318
## la1511_ro-acc11_ro -0.628826668 -1.63638746 0.37873413 0.6766309
## la1511_sh-acc11_ro 1.128522266 0.12096147 2.13608306 0.0144319
## m248_ro-acc11_ro -0.458862861 -1.46642366 0.54869794 0.9577545
## m248_sh-acc11_ro 3.176076312 2.16851551 4.18363711 0.0000000
## acc14_ro-acc11_sh -0.780792156 -1.78835295 0.22676864 0.3162886
## acc14_sh-acc11_sh -0.449356758 -1.45691756 0.55820404 0.9644693
## acc5_ro-acc11_sh -0.877457745 -1.88501854 0.13010305 0.1577328
## acc5_sh-acc11_sh -0.582934412 -1.59049521 0.42462638 0.7804657
## acc8_ro-acc11_sh -0.686532209 -1.69409301 0.32102859 0.5337337
## acc8_sh-acc11_sh 0.250166580 -0.75739422 1.25772738 0.9999332
## la1511_ro-acc11_sh -1.217752734 -2.22531353 -0.21019194 0.0052992
## la1511_sh-acc11_sh 0.539596199 -0.46796460 1.54715700 0.8618034
## m248_ro-acc11_sh -1.047788928 -2.05534972 -0.04022813 0.0336271
## m248_sh-acc11_sh 2.587150245 1.57958945 3.59471104 0.0000000
## acc14_sh-acc14_ro 0.331435398 -0.67612540 1.33899619 0.9981608
## acc5_ro-acc14_ro -0.096665588 -1.10422639 0.91089521 1.0000000
## acc5_sh-acc14_ro 0.197857744 -0.80970305 1.20541854 0.9999968
## acc8_ro-acc14_ro 0.094259947 -0.91330085 1.10182074 1.0000000
## acc8_sh-acc14_ro 1.030958736 0.02339794 2.03851953 0.0397829
## la1511_ro-acc14_ro -0.436960578 -1.44452138 0.57060022 0.9719961
## la1511_sh-acc14_ro 1.320388356 0.31282756 2.32794915 0.0015576
## m248_ro-acc14_ro -0.266996771 -1.27455757 0.74056403 0.9998504
## m248_sh-acc14_ro 3.367942402 2.36038160 4.37550320 0.0000000
## acc5_ro-acc14_sh -0.428100986 -1.43566178 0.57945981 0.9765881
## acc5_sh-acc14_sh -0.133577654 -1.14113845 0.87398314 1.0000000
## acc8_ro-acc14_sh -0.237175451 -1.24473625 0.77038535 0.9999659
## acc8_sh-acc14_sh 0.699523338 -0.30803746 1.70708414 0.5015058
## la1511_ro-acc14_sh -0.768395976 -1.77595677 0.23916482 0.3419547
## la1511_sh-acc14_sh 0.988952958 -0.01860784 1.99651375 0.0597031
## m248_ro-acc14_sh -0.598432169 -1.60599297 0.40912863 0.7470671
## m248_sh-acc14_sh 3.036507004 2.02894621 4.04406780 0.0000000
## acc5_sh-acc5_ro 0.294523332 -0.71303746 1.30208413 0.9995166
## acc8_ro-acc5_ro 0.190925535 -0.81663526 1.19848633 0.9999980
## acc8_sh-acc5_ro 1.127624324 0.12006353 2.13518512 0.0145732
## la1511_ro-acc5_ro -0.340294990 -1.34785579 0.66726581 0.9975520
## la1511_sh-acc5_ro 1.417053944 0.40949315 2.42461474 0.0004641
## m248_ro-acc5_ro -0.170331183 -1.17789198 0.83722961 0.9999996
## m248_sh-acc5_ro 3.464607990 2.45704719 4.47216879 0.0000000
## acc8_ro-acc5_sh -0.103597797 -1.11115859 0.90396300 1.0000000
## acc8_sh-acc5_sh 0.833100992 -0.17445981 1.84066179 0.2211193
## la1511_ro-acc5_sh -0.634818322 -1.64237912 0.37274248 0.6621570
## la1511_sh-acc5_sh 1.122530612 0.11496981 2.13009141 0.0153994
## m248_ro-acc5_sh -0.464854515 -1.47241531 0.54270628 0.9530746
## m248_sh-acc5_sh 3.170084658 2.16252386 4.17764545 0.0000000
## acc8_sh-acc8_ro 0.936698789 -0.07086201 1.94425959 0.0960712
## la1511_ro-acc8_ro -0.531220525 -1.53878132 0.47634027 0.8751989
## la1511_sh-acc8_ro 1.226128409 0.21856761 2.23368921 0.0048082
## m248_ro-acc8_ro -0.361256718 -1.36881752 0.64630408 0.9954073
## m248_sh-acc8_ro 3.273682455 2.26612166 4.28124325 0.0000000
## la1511_ro-acc8_sh -1.467919314 -2.47548011 -0.46035852 0.0002409
## la1511_sh-acc8_sh 0.289429620 -0.71813118 1.29699042 0.9996061
## m248_ro-acc8_sh -1.297955507 -2.30551630 -0.29039471 0.0020475
## m248_sh-acc8_sh 2.336983666 1.32942287 3.34454446 0.0000000
## la1511_sh-la1511_ro 1.757348934 0.74978814 2.76490973 0.0000048
## m248_ro-la1511_ro 0.169963807 -0.83759699 1.17752460 0.9999996
## m248_sh-la1511_ro 3.804902980 2.79734218 4.81246378 0.0000000
## m248_ro-la1511_sh -1.587385127 -2.59494592 -0.57982433 0.0000495
## m248_sh-la1511_sh 2.047554046 1.03999325 3.05511484 0.0000001
## m248_sh-m248_ro 3.634939173 2.62737838 4.64249997 0.0000000
P7 = Output$All.ID[,'p adj']
stat.test<- multcompLetters(P7)
stat.test
## acc1_sh acc10_ro acc10_sh acc11_ro acc11_sh acc14_ro acc14_sh acc5_ro
## "ab" "a" "ab" "abc" "bcd" "ab" "abcd" "ab"
## acc5_sh acc8_ro acc8_sh la1511_ro la1511_sh m248_ro m248_sh acc1_ro
## "abc" "abc" "cd" "a" "d" "a" "e" "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] "sh"
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(4:5,1)]
test2$group1 <- test2$Accession
test2$group2 <- test2$Accession
ICP4 <- subset(ICP, ICP$Na.K.ratio < 5.8 )
ratio <- ggplot(data = ICP4, mapping = aes(x = Accession, y = Na.K.ratio, colour = Accession))
ratio <- ratio + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)
ratio <- ratio + facet_grid(~Tissue , scales = "free_y")
ratio <- ratio + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
ratio <- ratio + scale_color_manual(values = c("blue", "plum", "darkorchid1","cyan1", "darkturquoise","red","hotpink", "darkgoldenrod" ))
ratio <- ratio + ylab("Na/K ratio, mg/mg dry weight") + xlab("")+stat_pvalue_manual(test2, label = "Tukey", y.position = 1)
ratio <- ratio + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
ratio <- ratio + rremove("legend")
ratio

pdf("all-ICP-cultivated.pdf", height = 8, width = 12)
plot_grid(Na_content, k_content, ratio, ncol=2,
align = "hv", labels=c("AUTO"),
label_size = 24)
dev.off()
## png
## 2