this is the ion leakage analysis for the duf160-5 and col plants grown on soil for salt experiment. 2 weeks old seedlings were treated with either water or 200 mM salt (known as 2wk here), and the other tray treated with 200 mM salt at week 3 after germination( known as 3wk here).the experiment period was almost 4 weeks: 2wk ctrl+ 2wk salt, then harvested AND 3 wk ctrl + 1 wk salt, then harvested.so the ion leakage performed by time of harvesting ~ 4 weeks old plants by collecting 3 equal sizes leaf disc into 2 ml deionized water, incubate at RT overnight, followed by measuring initial conductivity. then samples were boiled at 80 centigrade degrees for 2 hr in water batch, followed by overnight cooling at RT with gentle shaking. final conductivity was measured following day. to calculate the conductivity, initial conductivity/final conductivity*100.

getwd()
## [1] "C:/Users/Julkowska Lab/Desktop/R codes by Maryam/20211213_duf-5_soil_grown_ion_leakage"
setwd("C:/Users/Julkowska Lab/Desktop/R codes by Maryam/20211213_duf-5_soil_grown_ion_leakage/")
list.files(pattern = ".csv")
## [1] "20211213_duf-5_soil_grown_ion_leakage.csv"
IL<-read.csv("20211213_duf-5_soil_grown_ion_leakage.csv")
IL
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.5
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.0.5
library(RColorBrewer)
library(ggridges)
library(gapminder)
library(ggbeeswarm)
IL$Total.conductivity<- c((IL$Initial.conductivity/IL$Final.conductivity)*100)
head(IL)
colnames(IL)
## [1] "ï..Condition"         "Geno"                 "Initial.conductivity"
## [4] "Final.conductivity"   "Initial.Final.100"    "Total.conductivity"
IL_graph <-ggplot(data=IL,mapping = aes(x = Geno, y = Total.conductivity, colour=Geno)) +geom_quasirandom(alpha = 0.6)+facet_wrap(~ï..Condition)+stat_summary(fun.y=mean, geom="point", shape=95, size=10, color="black", fill="black")+labs(y = "Ion leakage, %", x = "", title = "Shoot Ion Leakage")+stat_compare_means(ref.group = "col", method = "t.test", label = "p.signif", hide.ns = TRUE)+theme(legend.position = "none")+theme(axis.text.x = element_text(angle = 0, vjust = 0.5, hjust=1))
## Warning: `fun.y` is deprecated. Use `fun` instead.
IL_graph

IL_graph2<- IL
IL_graph2$ï..Condition<-factor(IL_graph2$ï..Condition, levels=c("ctrl", "2wk" , "3wk"))
IL_graph3 <-ggplot(data=IL_graph2,mapping = aes(x = Geno, y = Total.conductivity, colour=Geno)) +geom_quasirandom(alpha = 0.6)+facet_wrap(~ï..Condition)+stat_summary(fun.y=mean, geom="point", shape=95, size=10, color="black", fill="black")+labs(y = "Ion leakage, %", x = "", title = "Shoot Ion Leakage")+stat_compare_means(ref.group = "col", method = "t.test", label = "p.signif", hide.ns = TRUE)+theme(legend.position = "none")+theme(axis.text.x = element_text(angle = 0, vjust = 0.5, hjust=1))
## Warning: `fun.y` is deprecated. Use `fun` instead.
IL_graph3

library(multcompView)
## Warning: package 'multcompView' was built under R version 4.0.5
IL$GenoCond <- paste(IL$ï..Condition, "_", IL$Geno, sep="")
IL$GenoCond <- gsub("-", ".", IL$GenoCond)
head(IL)
unique(IL$GenoCond)
## [1] "ctrl_col"   "ctrl_duf.5" "2wk_col"    "2wk_duf.5"  "3wk_col"   
## [6] "3wk_duf.5"
Output <- TukeyHSD(aov(Total.conductivity ~ GenoCond, data = IL))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Total.conductivity ~ GenoCond, data = IL)
## 
## $GenoCond
##                            diff        lwr       upr     p adj
## 2wk_duf.5-2wk_col    -10.190655 -31.311415 10.930106 0.6659762
## 3wk_col-2wk_col        4.787579 -16.333181 25.908339 0.9792080
## 3wk_duf.5-2wk_col     13.929205  -7.191555 35.049965 0.3456523
## ctrl_col-2wk_col     -12.118648 -33.239408  9.002112 0.4933062
## ctrl_duf.5-2wk_col   -12.709687 -34.972923  9.553549 0.4986723
## 3wk_col-2wk_duf.5     14.978234  -4.934610 34.891077 0.2194507
## 3wk_duf.5-2wk_duf.5   24.119860   4.207016 44.032704 0.0117283
## ctrl_col-2wk_duf.5    -1.927994 -21.840837 17.984850 0.9996140
## ctrl_duf.5-2wk_duf.5  -2.519033 -23.639793 18.601728 0.9989392
## 3wk_duf.5-3wk_col      9.141626 -10.771217 29.054470 0.7092187
## ctrl_col-3wk_col     -16.906227 -36.819071  3.006616 0.1280384
## ctrl_duf.5-3wk_col   -17.497266 -38.618026  3.623494 0.1442616
## ctrl_col-3wk_duf.5   -26.047853 -45.960697 -6.135010 0.0058513
## ctrl_duf.5-3wk_duf.5 -26.638893 -47.759653 -5.518132 0.0082038
## ctrl_duf.5-ctrl_col   -0.591039 -21.711799 20.529721 0.9999992
P6 <- Output$GenoCond[,'p adj']
P6
##    2wk_duf.5-2wk_col      3wk_col-2wk_col    3wk_duf.5-2wk_col 
##          0.665976218          0.979207958          0.345652337 
##     ctrl_col-2wk_col   ctrl_duf.5-2wk_col    3wk_col-2wk_duf.5 
##          0.493306244          0.498672285          0.219450692 
##  3wk_duf.5-2wk_duf.5   ctrl_col-2wk_duf.5 ctrl_duf.5-2wk_duf.5 
##          0.011728341          0.999614013          0.998939236 
##    3wk_duf.5-3wk_col     ctrl_col-3wk_col   ctrl_duf.5-3wk_col 
##          0.709218672          0.128038444          0.144261580 
##   ctrl_col-3wk_duf.5 ctrl_duf.5-3wk_duf.5  ctrl_duf.5-ctrl_col 
##          0.005851279          0.008203825          0.999999176
stat.test<- multcompLetters(P6)
stat.test
##  2wk_duf.5    3wk_col  3wk_duf.5   ctrl_col ctrl_duf.5    2wk_col 
##        "a"       "ab"        "b"        "a"        "a"       "ab"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test

well…..I have to modify it…since it does not make sense in this way.

IL_p_geno <- ggerrorplot(IL, y = "Total.conductivity", x = "GenoCond", fill="Geno", 
                                 color="Geno", 
                        desc_stat = "mean_sd", add = "jitter", 
                        add.params = list(color = "darkgray"),
                        xlab="Genotype", ylab="Ion leakage, %") 
IL_p_geno <- IL_p_geno + rremove("legend") 
IL_p_geno <- IL_p_geno + stat_pvalue_manual(test, label = "Tukey", y.position = 11)
IL_p_geno <- IL_p_geno + ggtitle("Shoot Ion Leakage")
IL_p_geno

shoot_ion_leakage_padj <- ggerrorplot(IL_graph2, y = "Total.conductivity", x = "Geno", fill="Geno", 
                                 color="Geno", 
                        desc_stat = "mean_sd", add = "jitter", 
                        add.params = list(color = "darkgray"),
                        xlab="Genotype", ylab="Ion leakage, %") 
shoot_ion_leakage_padj <- shoot_ion_leakage_padj + rremove("legend") 
shoot_ion_leakage_padj <- shoot_ion_leakage_padj + stat_pvalue_manual(test, label = "Tukey", y.position = 11)
shoot_ion_leakage_padj <- shoot_ion_leakage_padj + ggtitle("Shoot Ion Leakage")
shoot_ion_leakage_padj

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.