This is root system architecture analysis and ICP-MS results for root of LA1511 treated on plate with or without salt. at d5 the seedlings were transferred to +/- salt, while their shoot that are exposed to outside of plates being sprayed +/- IAA for 5 days. after 10 days at salt, seedlings were harvested for ICPMS.and we only analyzed /traced RSA for d9. 3 replicates for each condition.

getwd()
## [1] "C:/Users/Julkowska Lab/Desktop/R codes by Maryam/20230526_RSA_and _ICP-MS_for_LA1511_IAA_100mM_Salt_shoot_application_d9_only"
list.files(pattern = ".csv")
## [1] "d9-IAA-shoot-spray-root-corrected.csv"
## [2] "Eric06142023NaK-analyzed.csv"
d9<-read.csv("d9-IAA-shoot-spray-root-corrected.csv")

d9$day <- 9
head(d9)
Main_root <- subset(d9, d9$root_order == 0)
Main_root
colnames(Main_root)
##  [1] "image"                 "root_name"             "root"                 
##  [4] "length"                "vector_length"         "surface"              
##  [7] "volume"                "direction"             "diameter"             
## [10] "root_order"            "root_ontology"         "parent_name"          
## [13] "parent"                "insertion_position"    "insertion_angle"      
## [16] "n_child"               "child_density"         "first_child"          
## [19] "insertion_first_child" "last_child"            "insertion_last_child" 
## [22] "day"
MR_data <- Main_root[,c(1:4,10,16,17,19:22)]
MR_data
Lateral_root <- subset(d9, d9$root_order != 0)
Lateral_root
unique(Lateral_root$root_order)
## [1] 1
MR_data_2 <- subset(MR_data, MR_data$n_child >0)
temporary <- subset(Lateral_root, Lateral_root$parent == MR_data_2$root[1])
temporary
temporary <- subset(temporary, temporary$day == MR_data_2$day[3])
temporary
dim(temporary)
## [1] 27 22
dim(temporary)[1]
## [1] 27
dim(temporary)[2]
## [1] 22
total_LRL <- sum(temporary$length)
LR_number <- dim(temporary)[1]
total_LRL
## [1] 32.21086
LR_number
## [1] 27
MR_data_2$LRL <- 0
MR_data_2$LRno <- 0
MR_data_2
MR_data_2$LRL[1] <- total_LRL
MR_data_2$LRno[1] <- LR_number
MR_data_2
MR_data_noChild <- subset(MR_data, MR_data$n_child == 0)
MR_data_noChild
length(MR_data_2$root)
## [1] 18
for(i in 2:18){
  temporary <- subset(Lateral_root, Lateral_root$parent == MR_data_2$root[i])
  temporary <- subset(temporary, temporary$day == MR_data_2$day[i])
  total_LRL <- sum(temporary$length)
  LR_number <- dim(temporary)[1]
  MR_data_2$LRL[i] <- total_LRL
  MR_data_2$LRno[i] <- LR_number
}

MR_data_2$check <- MR_data_2$n_child - MR_data_2$LRno
MR_data_2
unique(MR_data_2$check)
## [1] 0 2
MR_data_Child2 <- MR_data_2[,1:13]
MR_data_Child2
MR_data_Child2$root_name[10]
## [1] " LA-S-MOCK"
text <- strsplit(x = MR_data_Child2$root_name[10], split = "-")
text
## [[1]]
## [1] " LA"  "S"    "MOCK"
genotype <- text[[1]][1]
genotype <- gsub(" ", "", genotype)
genotype
## [1] "LA"
cond <- text[[1]][2:3]
cond
## [1] "S"    "MOCK"
dim(MR_data_Child2)
## [1] 18 13
for(i in 1:18){
  text <- strsplit(x = MR_data_Child2$root_name[i], split = "-")
  genotype <- text[[1]][1]
  cond <- paste(text[[1]][2], text[[1]][3], sep="_")
  
   
  MR_data_Child2$genotype[i] <- genotype
  MR_data_Child2$condition[i] <- cond
  }

MR_data_Child2
MR_data_Child2$TRS <- MR_data_Child2$length + MR_data_Child2$LRL

for(i in 1:nrow(MR_data_Child2)){
  if(MR_data_Child2$LRno[i] == 0){
    MR_data_Child2$aLRL[i] <- 0
  } else {
  MR_data_Child2$aLRL[i] <- MR_data_Child2$LRL[i]/ MR_data_Child2$LRno[i]  
  }
}


MR_data_Child2$MRpLRL <- MR_data_Child2$length / MR_data_Child2$LRL
MR_data_Child2
length(unique(MR_data_Child2$root_name))
## [1] 7
unique(MR_data_Child2$day)
## [1] 9
18/7
## [1] 2.571429
unique(MR_data_Child2$root_name)
## [1] " LA-C-IAA"                             
## [2] " LA-S-IAA"                             
## [3] " LA-C-MOCK                            "
## [4] " LA-C-MOCK"                            
## [5] " LA-S-MOCK"                            
## [6] " LA-C-ONLY"                            
## [7] " LA-S-ONLY"
unique(MR_data_Child2$genotype)
## [1] " LA"
MR_data_Child2$genotype <- gsub( " ", "", MR_data_Child2$genotype)
MR_data_Child2$root_name <- gsub( " ", "", MR_data_Child2$root_name)
good_stuff <- c("LA")
funk <- subset(MR_data_Child2, !(MR_data_Child2$genotype %in% good_stuff))
funk
good_stuff2<- c("C-ONLY",  "C-MOCK",  "C-IAA", "S-ONLY" ,"S-MOCK" , "S-IAA")
funk2 <- subset(MR_data_Child2, !(MR_data_Child2$condition %in% good_stuff2))
funk
unique(MR_data_Child2$genotype)
## [1] "LA"
unique(MR_data_Child2$condition)
## [1] "C_IAA"                              "S_IAA"                             
## [3] "C_MOCK                            " "C_MOCK"                            
## [5] "S_MOCK"                             "C_ONLY"                            
## [7] "S_ONLY"
unique(MR_data_Child2$condition)
## [1] "C_IAA"                              "S_IAA"                             
## [3] "C_MOCK                            " "C_MOCK"                            
## [5] "S_MOCK"                             "C_ONLY"                            
## [7] "S_ONLY"
MR_data_Child2$condition <- gsub( "C_MOCK                            ", "C_MOCK" , MR_data_Child2$condition)
MR_data_Child2$root_name <- gsub( "C_MOCK                            ", "C_MOCK", MR_data_Child2$root_name)
unique(MR_data_Child2$condition)
## [1] "C_IAA"  "S_IAA"  "C_MOCK" "S_MOCK" "C_ONLY" "S_ONLY"
library(ggplot2)
library(ggpubr)
MR_data_Child2$condition<- factor(MR_data_Child2$condition, levels=c("C_ONLY", "C_MOCK", "C_IAA",  "S_ONLY", "S_MOCK", "S_IAA"))


histogram_TRS_IAA_SH <- ggdensity(MR_data_Child2, x = "TRS",
                           add = "mean", rug = TRUE, facet.by = "day",
                           color = "condition", fill = "condition")
                           

histogram_TRS_IAA_SH

histogram_LRno_IAA_SH <- ggdensity(MR_data_Child2, x = "LRno",
                           add = "mean", rug = TRUE, facet.by = "day",
                           color = "condition", fill = "condition")
                           

histogram_LRno_IAA_SH

TRS_graph <- ggerrorplot(MR_data_Child2, y = "TRS", x = "condition", fill="condition", color="condition", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "genotype", palette = "jco",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Total Root Size (cm)") 
TRS_graph<- TRS_graph + rremove("legend") + stat_compare_means(method="t.test", ref.group = "C_ONLY", 
                                                              label = "p.signif", hide.ns = T)
TRS_graph <- TRS_graph + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
TRS_graph

MR_graph <- ggerrorplot(MR_data_Child2, y = "length", x = "condition", fill="condition", color="condition", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "genotype", palette = "jco",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Main Root Length (cm)") 
MR_graph<- MR_graph + rremove("legend") + stat_compare_means(method="t.test", ref.group = "C_ONLY", 
                                                              label = "p.signif", hide.ns = T)
MR_graph <- MR_graph + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
MR_graph

LRno_graph <- ggerrorplot(MR_data_Child2, y = "LRno", x = "condition", fill="condition", color="condition", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "genotype", palette = "jco",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Lateral root number") 
LRno_graph<- LRno_graph + rremove("legend") + stat_compare_means(method="t.test", ref.group = "C_ONLY", 
                                                              label = "p.signif", hide.ns = T)
LRno_graph <- LRno_graph + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
LRno_graph

LRL_graph <- ggerrorplot(MR_data_Child2, y = "LRL", x = "condition", fill="condition", color="condition", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "genotype", palette = "jco",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Lateral root length (cm)") 
LRL_graph<- LRL_graph + rremove("legend") + stat_compare_means(method="t.test", ref.group = "C_ONLY", 
                                                              label = "p.signif", hide.ns = T)
LRL_graph <- LRL_graph + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
LRL_graph

aLRL_graph <- ggerrorplot(MR_data_Child2, y = "aLRL", x = "condition", fill="condition", color="condition", 
                        desc_stat = "mean_sd", add = "jitter", facet.by = "genotype", palette = "jco",
                        add.params = list(color = "darkgray"),
                        xlab="", ylab="Average lateral root length (cm)") 
aLRL_graph<- aLRL_graph + rremove("legend") + stat_compare_means(method="t.test", ref.group = "C_ONLY", 
                                                              label = "p.signif", hide.ns = T)
aLRL_graph <- aLRL_graph + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
aLRL_graph