During March of 2021, we grew 8 DUF mutant lines on 1/2 MS plates with no salt/salt. We imaged the plates every other day from March 22 through March 30. Then, we traced the root structures using the Smart Root plugin on ImageJ. This is an analysis for the main root lengths, lateral root lengths, and total root size.
###Loading the data
# getwd()
# setwd("C:/Users/J Lab/Desktop/RSA_analysis/")
#list.files()
RSA_march2021 <- read.csv("AT_salt_stress_set1_again.csv")
Let’s isolate date into its own column
RSA_march2021$info <- strsplit(RSA_march2021$image, "_")
RSA_march2021$info[1]
## [[1]]
## [1] "20210322" "Arabidopsis" "other" "dufs" "d5001.rsml"
dim(RSA_march2021)
## [1] 2543 22
RSA_march2021$info[1]
## [[1]]
## [1] "20210322" "Arabidopsis" "other" "dufs" "d5001.rsml"
RSA_march2021$info[[1200]][1]
## [1] "20210328"
RSA_march2021$info[[1]][2]
## [1] "Arabidopsis"
RSA_march2021$day <- 0
RSA_march2021$dayalt <- 0
for(i in 1:nrow(RSA_march2021)){
RSA_march2021$day[i] <- RSA_march2021$info[[i]][1]
RSA_march2021$dayalt[i] <- RSA_march2021$info[[i]][5]
}
RSA_march2021
unique(RSA_march2021$day)
## [1] "20210322" "20210326" "20210328" "20210330"
for(i in 1:nrow(RSA_march2021)){
RSA_march2021$dayalt[i] <- substr(RSA_march2021$dayalt[i], 1, 2)
}
unique(RSA_march2021$dayalt)
## [1] "d5" "d7" "d8" "d1"
unique(RSA_march2021$day)
## [1] "20210322" "20210326" "20210328" "20210330"
RSA_march2021
We need to adjust the date to day of experiment
dayalt d5 -> day 5 dayalt d7 -> day 7 day 20210326 -> day 9 day 20210328 -> day 11 day 20210330 -> day 13
RSA_march2021$time <- 0
d5 <- subset(RSA_march2021, RSA_march2021$dayalt == "d5")
d5
d7 <- subset(RSA_march2021, RSA_march2021$dayalt == "d7")
d7
d9 <- subset(RSA_march2021, RSA_march2021$day == "20210326")
d9
d11 <- subset(RSA_march2021, RSA_march2021$day == "20210328")
d11
d13 <- subset(RSA_march2021, RSA_march2021$day == "20210330")
d13
dim(RSA_march2021)
## [1] 2543 25
dim(d5)
## [1] 322 25
dim(d7)
## [1] 327 25
dim(d9)
## [1] 473 25
dim(d11)
## [1] 904 25
dim(d13)
## [1] 517 25
d5$time <- 5
d7$time <- 7
d9$time <- 9
d11$time <- 11
d13$time <- 13
RSA_dc <- rbind(d5, d7)
RSA_dc <- rbind(RSA_dc, d9)
RSA_dc <- rbind(RSA_dc, d11)
RSA_dc <- rbind(RSA_dc, d13)
dim(RSA_dc)
## [1] 2543 25
dim(RSA_march2021)
## [1] 2543 25
RSA_dc
###Manipulating data to get desired columns and align LRs with MR subset between main root and lateral roots
RSA_march2021_MR <- subset(RSA_dc, RSA_dc$root_order == 0)
RSA_march2021_LR <- subset(RSA_dc, RSA_dc$root_order != 0)
dim(RSA_march2021_MR)
## [1] 1507 25
dim(RSA_march2021_LR)
## [1] 1036 25
subset between main root with and without lateral roots
RSA_march2021_MR_noLR <- subset(RSA_march2021_MR, RSA_march2021_MR$n_child == 0)
RSA_march2021_MR_LR <- subset(RSA_march2021_MR, RSA_march2021_MR$n_child != 0)
Match MR that HAVE lateral roots with the belonging LRs match the MR “root id” with the LR “parent ID”…manually first, then automate it
RSA_march2021_MR_LR$root[1]
## [1] " 1e180bff-9bac-408b-94db-40de791190f3"
RSA_march2021_LR$parent[1]
## [1] " 1e180bff-9bac-408b-94db-40de791190f3"
RSA_march2021_LR$parent[2]
## [1] " 123c6c61-3326-41be-a7f2-428dcba5bf34"
temp <- subset(RSA_march2021_LR, RSA_march2021_LR$parent == RSA_march2021_MR_LR$root[200])
temp <- subset(temp, temp$time == RSA_march2021_MR_LR$time[200])
temp
Calculate the total lateral root length and lateral root number
LRL <- sum(temp$length)
temp$LRno <- 1
sum(temp$LRno)
## [1] 1
LRL
## [1] 0.04103441
dim(temp)
## [1] 1 26
LRno <- dim(temp)[1]
LRno
## [1] 1
Now add new columns and the values to the file RSA_march2021_MR_LR
RSA_march2021_MR_LR$LRL <- 0
RSA_march2021_MR_LR$LRno <- 0
RSA_march2021_MR_LR$LRL[1] <- LRL
RSA_march2021_MR_LR$LRno[1] <- LRno
Now, loop it to add this value to all of the plants that have lateral roots!
for(i in 1:nrow(RSA_march2021_MR_LR)){
temp <- subset(RSA_march2021_LR, RSA_march2021_LR$parent == RSA_march2021_MR_LR$root[i])
temp <- subset(temp, temp$time == RSA_march2021_MR_LR$time[i])
RSA_march2021_MR_LR$LRL[i] <- sum(temp$length)
RSA_march2021_MR_LR$LRno[i] <- dim(temp)[1]
}
RSA_march2021_MR_LR
select desired columns: image, root_name, length, insertion_first_child, insertion_last_child, day, LRL, LRno
RSA_march2021_MR_LR2 <- RSA_march2021_MR_LR[,c(1:2, 4, 19, 21, 25:27)]
colnames(RSA_march2021_MR_LR2)
## [1] "image" "root_name" "length"
## [4] "insertion_first_child" "insertion_last_child" "time"
## [7] "LRL" "LRno"
RSA_march2021_MR_LR2
Fuse this with the main root data without LRs. First, must add the new columns to that data frame
RSA_march2021_MR_noLR$LRL <- 0
RSA_march2021_MR_noLR$LRno <- 0
dim(RSA_march2021_MR_noLR)
## [1] 1144 27
colnames(RSA_march2021_MR_noLR)
## [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] "info" "day" "dayalt"
## [25] "time" "LRL" "LRno"
RSA_march2021_MR_noLR2 <- RSA_march2021_MR_noLR[,c(1:2, 4, 19, 21, 25:27)]
RSA_march2021_MR_noLR2$insertion_first_child <- 0
RSA_march2021_MR_noLR2$insertion_last_child <- 0
RSA_march2021_MR <- rbind(RSA_march2021_MR_noLR2, RSA_march2021_MR_LR2)
dim(RSA_march2021_MR_noLR2)
## [1] 1144 8
dim(RSA_march2021_MR_LR2)
## [1] 363 8
dim(RSA_march2021_MR)
## [1] 1507 8
RSA_march2021_MR$insertion_first_child <- as.numeric(as.character(RSA_march2021_MR$insertion_first_child))
RSA_march2021_MR$insertion_last_child <- as.numeric(as.character(RSA_march2021_MR$insertion_last_child))
colnames(RSA_march2021_MR)[3] <- "MRL"
colnames(RSA_march2021_MR)[6] <- "Day"
RSA_march2021_MR$Branched <- RSA_march2021_MR$insertion_last_child - RSA_march2021_MR$insertion_first_child
RSA_march2021_MR$Basal <- RSA_march2021_MR$MRL - RSA_march2021_MR$insertion_last_child
RSA_march2021_MR$Apical <- RSA_march2021_MR$insertion_first_child
RSA_march2021_MR
#clean up columns again
RSA_march2021_MR2 <- RSA_march2021_MR[,c(1,6,2:3,7:11)]
RSA_march2021_MR2
Lastly, calculate total root size (TRS)
RSA_march2021_MR2$TRS <- RSA_march2021_MR2$MRL + RSA_march2021_MR2$LRL
RSA_march2021_MR2
checkd5 <- subset(RSA_march2021_MR2, RSA_march2021_MR2$Day == 5)
dim(checkd5)
## [1] 321 10
###Decoding the plant information
RSA_march2021_MR2$info <- strsplit(RSA_march2021_MR2$root_name, "_")
RSA_march2021_MR2$info[1]
## [[1]]
## [1] " Pl1" "0mM" "p.4" "G1"
RSA_march2021_MR2$plate <- "NA"
RSA_march2021_MR2$plant <- "NA"
RSA_march2021_MR2$treatment <- "NA"
RSA_march2021_MR2$genotype <- "NA"
for(i in 1:nrow(RSA_march2021_MR2)){
RSA_march2021_MR2$plate[i] <- RSA_march2021_MR2$info[[i]][1]
RSA_march2021_MR2$plant[i] <- RSA_march2021_MR2$info[[i]][2]
RSA_march2021_MR2$treatment[i] <- RSA_march2021_MR2$info[[i]][3]
RSA_march2021_MR2$genotype[i] <- RSA_march2021_MR2$info[[i]][4]
}
colnames(RSA_march2021_MR2)[13] <- "treatment"
colnames(RSA_march2021_MR2)[14] <- "plant"
NOTE FROM 1-14-2022: having issues with making the plant info uniform. When checking for unique, I see ones that don’t belong, but when I try to subset out the weird ones to take a closer look R says there are 0 rows in the subset. Update 1-22-2022: Solved it by using the na.omit command
#check formatting for all plant info
#unique(RSA_march2021_MR2$genotype)
# suspecting LR being classified accidentally as MR. Lets remove ALL MR length < 1
AT some point, dimensions of d5 goes from ~322 (what it is in the original csv) to 139. It seems like this problem is occurring from the conversions made between MR2 and MR3 as dim(checkd5mr3) is 139 while dim(checkd5), which uses MR2, is 321. To fix, we changed the subsetting of MRL to >0.1 instead of >1
RSA_march2021_MR3 <- subset(RSA_march2021_MR2, RSA_march2021_MR2$MRL > 0.1)
checkd5mr3 <- subset(RSA_march2021_MR3, RSA_march2021_MR3$Day == 5)
dim(checkd5mr3)
## [1] 321 15
#unique(RSA_march2021_MR3$genotype)
RSA_march2021_MR4 <- na.omit(RSA_march2021_MR3)
RSA_march2021_MR4$plate <- gsub("Pl", "", RSA_march2021_MR4$plate)
RSA_march2021_MR4$plate <- gsub("P", "", RSA_march2021_MR4$plate)
RSA_march2021_MR4$plant <- gsub("p.", "", RSA_march2021_MR4$plant)
unique(RSA_march2021_MR4$genotype)
## [1] "G1" "GC" "G2" "G3" "G4" "G6" "G5" "G7" "G8"
unique(RSA_march2021_MR4$plate)
## [1] " 1" " 2" " 3" " 4" " 6" " 7" " 8" " 9" " 10" " 11" " 12" " 13"
## [13] " 14" " 15" " 16" " 17" " 18" " 19" " 20" " 21" " 22" " 23" " 24" " 25"
## [25] " 26" " 27" " 5"
unique(RSA_march2021_MR4$plant)
## [1] "4" "3" "2" "1"
unique(RSA_march2021_MR4$treatment)
## [1] "0mM" "75mM" "125mM"
#remove letters/punctuation, convert G# to DUF name
RSA_march2021_MR4$genotype <- gsub("GC", "Col-0", RSA_march2021_MR4$genotype)
RSA_march2021_MR4$genotype <- gsub("G1", "120-2E", RSA_march2021_MR4$genotype)
RSA_march2021_MR4$genotype <- gsub("G2", "140-1C", RSA_march2021_MR4$genotype)
RSA_march2021_MR4$genotype <- gsub("G3", "140-2B", RSA_march2021_MR4$genotype)
RSA_march2021_MR4$genotype <- gsub("G4", "140-3F", RSA_march2021_MR4$genotype)
RSA_march2021_MR4$genotype <- gsub("G5", "150-1B", RSA_march2021_MR4$genotype)
RSA_march2021_MR4$genotype <- gsub("G6", "150-3B", RSA_march2021_MR4$genotype)
RSA_march2021_MR4$genotype <- gsub("G7", "170-1B", RSA_march2021_MR4$genotype)
RSA_march2021_MR4$genotype <- gsub("G8", "170-2A", RSA_march2021_MR4$genotype)
RSA_march2021_MR4$treatment <- gsub("0mM", "0", RSA_march2021_MR4$treatment)
RSA_march2021_MR4$treatment <- gsub("75mM", "75", RSA_march2021_MR4$treatment)
RSA_march2021_MR4$treatment <- gsub("125mM", "125", RSA_march2021_MR4$treatment)
unique(RSA_march2021_MR4$Day)
## [1] 5 7 9 11 13
#change Day chr >> numeric; treatment chr >> numeric; plate chr >> numeric
RSA_march2021_MR4$plate <- as.numeric(as.factor(RSA_march2021_MR4$plate))
RSA_march2021_MR4
library(ggplot2)
library(ggpubr)
Day5 <- subset(RSA_march2021_MR4, RSA_march2021_MR4$Day == 5)
Day5$treatment <- factor(Day5$treatment, level = c(0, 75, 125))
Day5$genotype <- factor(Day5$genotype, level = c("Col-0", "120-2E", "140-1C", "140-2B", "140-3F", "150-1B", "150-3B", "170-1B", "170-2A"))
Day7 <- subset(RSA_march2021_MR4, RSA_march2021_MR4$Day == 7)
Day7$treatment <- factor(Day7$treatment, level = c(0, 75, 125))
Day7$genotype <- factor(Day7$genotype, level = c("Col-0", "120-2E", "140-1C", "140-2B", "140-3F", "150-1B", "150-3B", "170-1B", "170-2A"))
Day9 <- subset(RSA_march2021_MR4, RSA_march2021_MR4$Day == 9)
Day9$treatment <- factor(Day9$treatment, level = c(0, 75, 125))
Day9$genotype <- factor(Day9$genotype, level = c("Col-0", "120-2E", "140-1C", "140-2B", "140-3F", "150-1B", "150-3B", "170-1B", "170-2A"))
Day11 <- subset(RSA_march2021_MR4, RSA_march2021_MR4$Day == 11)
Day11$treatment <- factor(Day11$treatment, level = c(0, 75, 125))
Day11$genotype <- factor(Day11$genotype, level = c("Col-0", "120-2E", "140-1C", "140-2B", "140-3F", "150-1B", "150-3B", "170-1B", "170-2A"))
Day13 <- subset(RSA_march2021_MR4, RSA_march2021_MR4$Day == 13)
Day13$treatment <- factor(Day13$treatment, level = c(0, 75, 125))
Day13$genotype <- factor(Day13$genotype, level = c("Col-0", "120-2E", "140-1C", "140-2B", "140-3F", "150-1B", "150-3B", "170-1B", "170-2A"))
##Boxplots: Plotting Total Root Size (TRS), MRL, LRL, Apex, Basal, Branched definitions: TRS: MRL + LRL (plot for all days) MRL: length of main root (plot for all days) LRL: length of all lateral roots (plot for days 11 and 13) Apical: distance from beginning of root to first lateral root (plot for days 11 and 13) Basal: distance from final lateral root to end of main root (plot for days 11 and 13) Branched: distance along main root from first to last lateral root (plot for days 11 and 13)
TRS_d5 <- ggplot(Day5, aes(x = genotype, y = TRS))
TRS_d5 <- TRS_d5 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
TRS_d5 <- TRS_d5 + facet_grid(~ treatment)
TRS_d5 <- TRS_d5 + ggtitle("TRS - Day 5")
TRS_d5
TRS_d7 <- ggplot(Day7, aes(x = genotype, y = TRS))
TRS_d7 <- TRS_d7 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
TRS_d7 <- TRS_d7 + facet_grid(~ treatment)
TRS_d7 <- TRS_d7 + ggtitle("TRS - Day 7")
TRS_d7
TRS_d9 <- ggplot(Day9, aes(x = genotype, y = TRS))
TRS_d9 <- TRS_d9 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
TRS_d9 <- TRS_d9 + facet_grid(~ treatment)
TRS_d9 <- TRS_d9 + ggtitle("TRS - Day 9")
TRS_d9
TRS_d11 <- ggplot(Day11, aes(x = genotype, y = TRS))
TRS_d11 <- TRS_d11 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
TRS_d11 <- TRS_d11 + facet_grid(~ treatment)
TRS_d11 <- TRS_d11 + ggtitle("TRS - Day 11")
TRS_d11
TRS_d13 <- ggplot(Day13, aes(x = genotype, y = TRS))
TRS_d13 <- TRS_d13 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
TRS_d13 <- TRS_d13 + facet_grid(~ treatment)
TRS_d13 <- TRS_d13 + ggtitle("TRS - Day 13")
TRS_d13
MRL_d5 <- ggplot(Day5, aes(x = genotype, y = MRL))
MRL_d5 <- MRL_d5 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
MRL_d5 <- MRL_d5 + facet_grid(~ treatment)
MRL_d5 <- MRL_d5 + ggtitle("MRL - Day 5")
MRL_d5
MRL_d7 <- ggplot(Day7, aes(x = genotype, y = MRL))
MRL_d7 <- MRL_d7 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
MRL_d7 <- MRL_d7 + facet_grid(~ treatment)
MRL_d7 <- MRL_d7 + ggtitle("MRL - Day 7")
MRL_d7
MRL_d9 <- ggplot(Day9, aes(x = genotype, y = MRL))
MRL_d9 <- MRL_d9 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
MRL_d9 <- MRL_d9 + facet_grid(~ treatment)
MRL_d9 <- MRL_d9 + ggtitle("MRL - Day 9")
MRL_d9
MRL_d11 <- ggplot(Day11, aes(x = genotype, y = MRL))
MRL_d11 <- MRL_d11 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
MRL_d11 <- MRL_d11 + facet_grid(~ treatment)
MRL_d11 <- MRL_d11 + ggtitle("MRL - Day 11")
MRL_d11
MRL_d13 <- ggplot(Day13, aes(x = genotype, y = MRL))
MRL_d13 <- MRL_d13 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
MRL_d13 <- MRL_d13 + facet_grid(~ treatment)
MRL_d13 <- MRL_d13 + ggtitle("MRL - Day 13")
MRL_d13
LRL_d9 <- ggplot(Day9, aes(x = genotype, y = LRL))
LRL_d9 <- LRL_d9 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
LRL_d9 <- LRL_d9 + facet_grid(~ treatment)
LRL_d9 <- LRL_d9 + ggtitle("LRL - Day 9")
LRL_d9
LRL_d11 <- ggplot(Day11, aes(x = genotype, y = LRL))
LRL_d11 <- LRL_d11 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
LRL_d11 <- LRL_d11 + facet_grid(~ treatment)
LRL_d11 <- LRL_d11 + ggtitle("LRL - Day 11")
LRL_d11
LRL_d13 <- ggplot(Day13, aes(x = genotype, y = LRL))
LRL_d13 <- LRL_d13 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
LRL_d13 <- LRL_d13 + facet_grid(~ treatment)
LRL_d13 <- LRL_d13 + ggtitle("LRL - Day 13")
LRL_d13
Apical_d9 <- ggplot(Day9, aes(x = genotype, y = Apical))
Apical_d9 <- Apical_d9 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
Apical_d9 <- Apical_d9 + facet_grid(~ treatment)
Apical_d9 <- Apical_d9 + ggtitle("Apical Distance - Day 9")
Apical_d9
Apical_d11 <- ggplot(Day11, aes(x = genotype, y = Apical))
Apical_d11 <- Apical_d11 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
Apical_d11 <- Apical_d11 + facet_grid(~ treatment)
Apical_d11 <- Apical_d11 + ggtitle("Apical Distance - Day 11")
Apical_d11
Apical_d13 <- ggplot(Day13, aes(x = genotype, y = Apical))
Apical_d13 <- Apical_d13 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
Apical_d13 <- Apical_d13 + facet_grid(~ treatment)
Apical_d13 <- Apical_d13 + ggtitle("Apical Distance - Day 13")
Apical_d13
Basal_d9 <- ggplot(Day9, aes(x = genotype, y = Basal))
Basal_d9 <- Basal_d9 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
Basal_d9 <- Basal_d9 + facet_grid(~ treatment)
Basal_d9 <- Basal_d9 + ggtitle("Basal Distance - Day 9")
Basal_d9
Basal_d11 <- ggplot(Day11, aes(x = genotype, y = Basal))
Basal_d11 <- Basal_d11 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
Basal_d11 <- Basal_d11 + facet_grid(~ treatment)
Basal_d11 <- Basal_d11 + ggtitle("Basal Distance - Day 11")
Basal_d11
Basal_d13 <- ggplot(Day13, aes(x = genotype, y = Basal))
Basal_d13 <- Basal_d13 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
Basal_d13 <- Basal_d13 + facet_grid(~ treatment)
Basal_d13 <- Basal_d13 + ggtitle("Basal Distance - Day 13")
Basal_d13
Branched_d9 <- ggplot(Day9, aes(x = genotype, y = Branched))
Branched_d9 <- Branched_d9 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
Branched_d9 <- Branched_d9 + facet_grid(~ treatment)
Branched_d9 <- Branched_d9 + ggtitle("Branched Distance - Day 9")
Branched_d9
Branched_d11 <- ggplot(Day11, aes(x = genotype, y = Branched))
Branched_d11 <- Branched_d11 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
Branched_d11 <- Branched_d11 + facet_grid(~ treatment)
Branched_d11 <- Branched_d11 + ggtitle("Branched Distance - Day 11")
Branched_d11
Branched_d13 <- ggplot(Day13, aes(x = genotype, y = Branched))
Branched_d13 <- Branched_d13 + geom_boxplot() + theme(axis.text.x = element_text(angle = 90))
Branched_d13 <- Branched_d13 + facet_grid(~ treatment)
Branched_d13 <- Branched_d13 + ggtitle("Branched Distance - Day 13")
Branched_d13
###Comparing each genotype to Col
RSA_march2021_MR4
length(unique(RSA_march2021_MR4$genotype))
## [1] 9
Col_data <- subset(RSA_march2021_MR4, RSA_march2021_MR4$genotype == "Col-0")
Col_data
Col1 <- Col_data
Col1$facet <- unique(RSA_march2021_MR4$genotype)[1]
Col2 <- Col_data
Col2$facet <- unique(RSA_march2021_MR4$genotype)[2]
Col3 <- Col_data
Col3$facet <- unique(RSA_march2021_MR4$genotype)[3]
Col4 <- Col_data
Col4$facet <- unique(RSA_march2021_MR4$genotype)[4]
Col5 <- Col_data
Col5$facet <- unique(RSA_march2021_MR4$genotype)[5]
Col6 <- Col_data
Col6$facet <- unique(RSA_march2021_MR4$genotype)[6]
Col7 <- Col_data
Col7$facet <- unique(RSA_march2021_MR4$genotype)[7]
Col8 <- Col_data
Col8$facet <- unique(RSA_march2021_MR4$genotype)[8]
Col9 <- Col_data
Col9$facet <- unique(RSA_march2021_MR4$genotype)[9]
RSA_march2021_MR4$facet <- RSA_march2021_MR4$genotype
RSA_comp <- rbind(RSA_march2021_MR4, Col1)
RSA_comp <- rbind(RSA_comp, Col2)
RSA_comp <- rbind(RSA_comp, Col3)
RSA_comp <- rbind(RSA_comp, Col4)
RSA_comp <- rbind(RSA_comp, Col5)
RSA_comp <- rbind(RSA_comp, Col6)
RSA_comp <- rbind(RSA_comp, Col7)
RSA_comp <- rbind(RSA_comp, Col8)
RSA_comp <- rbind(RSA_comp, Col9)
unique(RSA_comp$facet)
## [1] "120-2E" "Col-0" "140-1C" "140-2B" "140-3F" "150-3B" "150-1B" "170-1B"
## [9] "170-2A"
RSA_comp
RSA_comp$Day <- as.numeric(as.character(RSA_comp$Day))
RSA_comp$Day <- as.factor(RSA_comp$Day)
RSA_comp$treatment <- factor(RSA_comp$treatment, levels = c("0", "75", "125"))
RSA_comp <- subset(RSA_comp, RSA_comp$facet != "Col-0")
RSA_comp
RSA_MRL_lgraph <- ggplot(data = RSA_comp, aes(x = Day, y = MRL, group = root_name, color = genotype)) + theme_classic()
RSA_MRL_lgraph <- RSA_MRL_lgraph + geom_line(alpha = 0.1)
RSA_MRL_lgraph <- RSA_MRL_lgraph + facet_grid(facet ~ treatment)
RSA_MRL_lgraph <- RSA_MRL_lgraph + stat_summary(fun.data = mean_se, geom = "ribbon", linetype = 0, aes(group = genotype), alpha = 0.3) + stat_summary(fun = mean, aes(group = genotype), size = 0.7, geom = "line", linetype = "solid")
RSA_MRL_lgraph <- RSA_MRL_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = F, label.y = 5)
RSA_MRL_lgraph <- RSA_MRL_lgraph + xlab("Days After Germination") + ylab("Main Root Length") + rremove("legend")
RSA_MRL_lgraph
# pdf("RSA_MRL_lgraph.pdf", 20, 20)
# plot(RSA_TRS_lgraph)
# dev.off()
#Here I went through each genotype to observe if data is missing and if that could be why for some stat_compare_means is failing. I found that 140-1C 75mM, d5 has no data and 150-1 B 125 mM all days are failing
# unique(RSA_comp$facet)
# temp <- subset(RSA_comp, RSA_comp$facet == "150-1B")
# temp
# unique(temp$root_name)
#
# RSA_MRL_lgraph <- ggplot(data = temp, aes(x = Day, y = MRL, group = root_name, color = genotype)) + theme_classic()
# RSA_MRL_lgraph <- RSA_MRL_lgraph + geom_line(alpha = 0.1)
# RSA_MRL_lgraph <- RSA_MRL_lgraph + facet_grid(facet ~ treatment)
# RSA_MRL_lgraph <- RSA_MRL_lgraph + stat_summary(fun.data = mean_se, geom = "ribbon", linetype = 0, aes(group = genotype), alpha = 0.3) + stat_summary(fun = mean, aes(group = genotype), size = 0.7, geom = "line", linetype = "solid")
# RSA_MRL_lgraph <- RSA_MRL_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = F)
# RSA_MRL_lgraph <- RSA_MRL_lgraph + xlab("Days After Germination") + ylab("Main Root Length") + rremove("legend")
# RSA_MRL_lgraph
#
# library(plotly)
# ggplotly(RSA_MRL_lgraph)
RSA_TRS_lgraph <- ggplot(data = RSA_comp, aes(x = Day, y = TRS, group = root_name, color = genotype)) + theme_classic()
RSA_TRS_lgraph <- RSA_TRS_lgraph + geom_line(alpha = 0.1)
RSA_TRS_lgraph <- RSA_TRS_lgraph + facet_grid(facet ~ treatment)
RSA_TRS_lgraph <- RSA_TRS_lgraph + stat_summary(fun.data = mean_se, geom = "ribbon", linetype = 0, aes(group = genotype), alpha = 0.3) + stat_summary(fun = mean, aes(group = genotype), size = 0.7, geom = "line", linetype = "solid")
RSA_TRS_lgraph <- RSA_TRS_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = F, label.y = 5)
RSA_TRS_lgraph <- RSA_TRS_lgraph + xlab("Days After Germination") + ylab("Total Root Size (cm)") + rremove("legend")
RSA_TRS_lgraph
RSA_comp$Day <- as.numeric(as.character(RSA_comp$Day))
RSA_comp$treatment <- factor(RSA_comp$treatment, levels = c("0", "75", "125"))
RSA_comp <- subset(RSA_comp, RSA_comp$facet != "Col-0")
RSA_LRL_lgraph <- ggplot(data = RSA_comp, aes(x = Day, y = LRL, group = root_name, color = genotype)) + theme_classic()
RSA_LRL_lgraph <- RSA_LRL_lgraph + geom_line(alpha = 0.1)
RSA_LRL_lgraph <- RSA_LRL_lgraph + facet_grid(facet ~ treatment)
RSA_LRL_lgraph <- RSA_LRL_lgraph + stat_summary(fun.data = mean_se, geom = "ribbon", linetype = 0, aes(group = genotype), alpha = 0.3) + stat_summary(fun = mean, aes(group = genotype), size = 0.7, geom = "line", linetype = "solid")
RSA_LRL_lgraph <- RSA_LRL_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = F, label.y = 5)
RSA_LRL_lgraph <- RSA_LRL_lgraph + xlab("Days After Germination") + ylab("Lateral Root Length") + rremove("legend")
RSA_LRL_lgraph
RSA_comp$Day <- as.numeric(as.character(RSA_comp$Day))
RSA_comp$treatment <- factor(RSA_comp$treatment, levels = c("0", "75", "125"))
RSA_comp <- subset(RSA_comp, RSA_comp$facet != "Col-0")
RSA_basal_lgraph <- ggplot(data = RSA_comp, aes(x = Day, y = Basal, group = root_name, color = genotype)) + theme_classic()
RSA_basal_lgraph <- RSA_basal_lgraph + geom_line(alpha = 0.1)
RSA_basal_lgraph <- RSA_basal_lgraph + facet_grid(facet ~ treatment)
RSA_basal_lgraph <- RSA_basal_lgraph + stat_summary(fun.data = mean_se, geom = "ribbon", linetype = 0, aes(group = genotype), alpha = 0.3) + stat_summary(fun = mean, aes(group = genotype), size = 0.7, geom = "line", linetype = "solid")
RSA_basal_lgraph <- RSA_basal_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = F, label.y = 5)
RSA_basal_lgraph <- RSA_basal_lgraph + xlab("Days After Germination") + ylab("Basal Distance") + rremove("legend")
RSA_basal_lgraph
RSA_apical_lgraph <- ggplot(data = RSA_comp, aes(x = Day, y = Apical, group = root_name, color = genotype)) + theme_classic()
RSA_apical_lgraph <- RSA_apical_lgraph + geom_line(alpha = 0.1)
RSA_apical_lgraph <- RSA_apical_lgraph + facet_grid(facet ~ treatment)
RSA_apical_lgraph <- RSA_apical_lgraph + stat_summary(fun.data = mean_se, geom = "ribbon", linetype = 0, aes(group = genotype), alpha = 0.3) + stat_summary(fun = mean, aes(group = genotype), size = 0.7, geom = "line", linetype = "solid")
RSA_apical_lgraph <- RSA_apical_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = F, label.y = 2)
RSA_apical_lgraph <- RSA_apical_lgraph + xlab("Days After Germination") + ylab("Apical Distance") + rremove("legend")
RSA_apical_lgraph
RSA_branched_lgraph <- ggplot(data = RSA_comp, aes(x = Day, y = Branched, group = root_name, color = genotype)) + theme_classic()
RSA_branched_lgraph <- RSA_branched_lgraph + geom_line(alpha = 0.1)
RSA_branched_lgraph <- RSA_branched_lgraph + facet_grid(facet ~ treatment)
RSA_branched_lgraph <- RSA_branched_lgraph + stat_summary(fun.data = mean_se, geom = "ribbon", linetype = 0, aes(group = genotype), alpha = 0.3) + stat_summary(fun = mean, aes(group = genotype), size = 0.7, geom = "line", linetype = "solid")
RSA_branched_lgraph <- RSA_branched_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = F, label.y = 2)
RSA_branched_lgraph <- RSA_branched_lgraph + xlab("Days After Germination") + ylab("Branched Distance") + rremove("legend")
RSA_branched_lgraph
##Error plots
library(ggpubr)
TRS_D5_errorplot <- ggerrorplot(Day5, y="TRS", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Total Root Size (cm)", main = "Day 5") + theme(axis.text.x = element_text(angle = 90))
TRS_D5_errorplot <- TRS_D5_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
TRS_D5_errorplot
TRS_D7_errorplot <- ggerrorplot(Day7, y="TRS", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Total Root Size (cm)", main = "Day 7") + theme(axis.text.x = element_text(angle = 90))
TRS_D7_errorplot <- TRS_D7_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
TRS_D7_errorplot
TRS_D9_errorplot <- ggerrorplot(Day9, y="TRS", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Total Root Size (cm)", main = "Day 9") + theme(axis.text.x = element_text(angle = 90))
TRS_D9_errorplot <- TRS_D9_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
TRS_D9_errorplot
TRS_D11_errorplot <- ggerrorplot(Day11, y="TRS", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Total Root Size (cm)", main = "Day 11") + theme(axis.text.x = element_text(angle = 90))
TRS_D11_errorplot <- TRS_D11_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
TRS_D11_errorplot
TRS_D13_errorplot <- ggerrorplot(Day13, y="TRS", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Total Root Size (cm)", main = "Day 13") + theme(axis.text.x = element_text(angle = 90))
TRS_D13_errorplot <- TRS_D13_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
TRS_D13_errorplot
#main root size
MRL_D5_errorplot <- ggerrorplot(Day5, y="MRL", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Main Root Size (cm)", main = "Day 5") + theme(axis.text.x = element_text(angle = 90))
MRL_D5_errorplot <- MRL_D5_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
MRL_D5_errorplot
MRL_D7_errorplot <- ggerrorplot(Day7, y="MRL", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Main Root Size (cm)", main = "Day 7") + theme(axis.text.x = element_text(angle = 90))
MRL_D7_errorplot <- MRL_D7_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
MRL_D7_errorplot
MRL_D9_errorplot <- ggerrorplot(Day9, y="MRL", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Main Root Size (cm)", main = "Day 9") + theme(axis.text.x = element_text(angle = 90))
MRL_D9_errorplot <- MRL_D9_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
MRL_D9_errorplot
MRL_D11_errorplot <- ggerrorplot(Day11, y="MRL", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Main Root Size (cm)", main = "Day 11") + theme(axis.text.x = element_text(angle = 90))
MRL_D11_errorplot <- MRL_D11_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
MRL_D11_errorplot
MRL_D13_errorplot <- ggerrorplot(Day13, y="MRL", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Main Root Size (cm)", main = "Day 13") + theme(axis.text.x = element_text(angle = 90))
MRL_D13_errorplot <- MRL_D13_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
MRL_D13_errorplot
#lateral root size days 9, 11 & 13
LRL_D9_errorplot <- ggerrorplot(Day9, y="LRL", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Lateral Root Size (cm)", main = "Day 9") + theme(axis.text.x = element_text(angle = 90))
LRL_D9_errorplot <- LRL_D9_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
LRL_D9_errorplot
LRL_D11_errorplot <- ggerrorplot(Day11, y="LRL", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Lateral Root Size (cm)", main = "Day 11") + theme(axis.text.x = element_text(angle = 90))
LRL_D11_errorplot <- LRL_D11_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
LRL_D11_errorplot
LRL_D13_errorplot <- ggerrorplot(Day13, y="LRL", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Lateral Root Size (cm)", main = "Day 13") + theme(axis.text.x = element_text(angle = 90))
LRL_D13_errorplot <- LRL_D13_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
LRL_D13_errorplot
#Apical distance days 9, 11 & 13
Apical_D9_errorplot <- ggerrorplot(Day9, y="Apical", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Apical Distance (cm)", main = "Day 9") + theme(axis.text.x = element_text(angle = 90))
Apical_D9_errorplot <- Apical_D9_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
Apical_D9_errorplot
Apical_D11_errorplot <- ggerrorplot(Day11, y="Apical", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Apical Distance (cm)", main = "Day 11") + theme(axis.text.x = element_text(angle = 90))
Apical_D11_errorplot <- Apical_D11_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
Apical_D11_errorplot
Apical_D13_errorplot <- ggerrorplot(Day13, y="Apical", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Apical Distance (cm)", main = "Day 13") + theme(axis.text.x = element_text(angle = 90))
Apical_D13_errorplot <- Apical_D13_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
Apical_D13_errorplot
#Basal distance days 9, 11 & 13
Basal_D9_errorplot <- ggerrorplot(Day9, y="Basal", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Basal Distance (cm)", main = "Day 9") + theme(axis.text.x = element_text(angle = 90))
Basal_D9_errorplot <- Basal_D9_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
Basal_D9_errorplot
Basal_D11_errorplot <- ggerrorplot(Day11, y="Basal", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Basal Distance (cm)", main = "Day 11") + theme(axis.text.x = element_text(angle = 90))
Basal_D11_errorplot <- Basal_D11_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
Basal_D11_errorplot
Basal_D13_errorplot <- ggerrorplot(Day13, y="Basal", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Basal Distance (cm)", main = "Day 13") + theme(axis.text.x = element_text(angle = 90))
Basal_D13_errorplot <- Basal_D13_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
Basal_D13_errorplot
#Branched distance days 9, 11 & 13
Branched_D9_errorplot <- ggerrorplot(Day9, y="Branched", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Branched Distance (cm)", main = "Day 9") + theme(axis.text.x = element_text(angle = 90))
Branched_D9_errorplot <- Branched_D9_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
Branched_D9_errorplot
Branched_D11_errorplot <- ggerrorplot(Day11, y="Branched", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Branched Distance (cm)", main = "Day 11") + theme(axis.text.x = element_text(angle = 90))
Branched_D11_errorplot <- Branched_D11_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
Branched_D11_errorplot
Branched_D11_errorplot <- ggerrorplot(Day13, y="Branched", x="genotype", fill="genotype", ncol = 3, facet.by = "treatment",
desc_stat = "mean_sd", add="jitter", add.params = list(color = "darkgray"),
xlab="", ylab="Branched Distance (cm)", main = "Day 13") + theme(axis.text.x = element_text(angle = 90))
Branched_D11_errorplot <- Branched_D11_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif")
Branched_D11_errorplot
###Over time graphs
RSA_march2021_MR4$treatment <- as.factor(as.numeric(RSA_march2021_MR4$treatment))
unique(RSA_march2021_MR4$treatment)
## [1] 0 75 125
## Levels: 0 75 125
RSA_march2021_MR4$treatment <- factor(RSA_march2021_MR4$treatment, levels = c("0", "75", "125"))
RSA_march2021_MR4
TRS_over_time_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = TRS, group = root_name, color = treatment)) + theme_classic()
TRS_over_time_s1 <- TRS_over_time_s1 + geom_line(alpha=0.1)
TRS_over_time_s1<-TRS_over_time_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
TRS_over_time_s1 <- TRS_over_time_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
TRS_over_time_s1 <- TRS_over_time_s1 + xlab("Day of Treatment") + ylab("Total Root Length (cm)") + ggtitle("Total Root Size Over Time")
TRS_over_time_s1
TRS_by_geno_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = TRS, group = root_name, color = treatment)) +theme_classic()
TRS_by_geno_s1 <- TRS_by_geno_s1 + geom_line(alpha=0.1) + facet_wrap(~genotype)
TRS_by_geno_s1 <- TRS_by_geno_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
TRS_by_geno_s1 <- TRS_by_geno_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
TRS_by_geno_s1 <- TRS_by_geno_s1 + xlab("Day of Treatment") + ylab("Total Root Length (cm)") + ggtitle("Total Root Size Over Time")
TRS_by_geno_s1
MRL_over_time_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = MRL, group = root_name, color = treatment)) + theme_classic()
MRL_over_time_s1 <- MRL_over_time_s1 + geom_line(alpha=0.1)
MRL_over_time_s1<-MRL_over_time_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
MRL_over_time_s1 <- MRL_over_time_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
MRL_over_time_s1 <- MRL_over_time_s1 + xlab("Day of Treatment") + ylab("Main Root Length (cm)") + ggtitle("Main Root Length Over Time")
MRL_over_time_s1
MRL_by_geno_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = MRL, group = root_name, color = treatment)) +theme_classic()
MRL_by_geno_s1 <- MRL_by_geno_s1 + geom_line(alpha=0.1) + facet_wrap(~genotype)
MRL_by_geno_s1 <- MRL_by_geno_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
MRL_by_geno_s1 <- MRL_by_geno_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
MRL_by_geno_s1 <- MRL_by_geno_s1 + xlab("Day of Treatment") + ylab("Main Root Length (cm)") + ggtitle("Main Root Length Over Time")
MRL_by_geno_s1
Basal_over_time_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = Basal, group = root_name, color = treatment)) + theme_classic()
Basal_over_time_s1 <- Basal_over_time_s1 + geom_line(alpha=0.1)
Basal_over_time_s1 <- Basal_over_time_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
Basal_over_time_s1 <- Basal_over_time_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
Basal_over_time_s1 <- Basal_over_time_s1 + xlab("Day of Treatment") + ylab("Basal Distance (cm)") + ggtitle("Basal Distance Over Time")
Basal_over_time_s1
Basal_by_geno_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = Basal, group = root_name, color = treatment)) +theme_classic()
Basal_by_geno_s1 <- Basal_by_geno_s1 + geom_line(alpha=0.1) + facet_wrap(~genotype)
Basal_by_geno_s1 <- Basal_by_geno_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
Basal_by_geno_s1 <- Basal_by_geno_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
Basal_by_geno_s1 <- Basal_by_geno_s1 + xlab("Day of Treatment") + ylab("Basal Distance (cm)") + ggtitle("Basal Distance Over Time")
Basal_by_geno_s1
Apical_over_time_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = Apical, group = root_name, color = treatment)) + theme_classic()
Apical_over_time_s1 <- Apical_over_time_s1 + geom_line(alpha=0.1)
Apical_over_time_s1 <- Apical_over_time_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
Apical_over_time_s1 <- Apical_over_time_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
Apical_over_time_s1 <- Apical_over_time_s1 + xlab("Day of Treatment") + ylab("Apical Distance (cm)") + ggtitle("Apical Distance Over Time")
Apical_over_time_s1
Apical_by_geno_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = Apical, group = root_name, color = treatment)) +theme_classic()
Apical_by_geno_s1 <- Apical_by_geno_s1 + geom_line(alpha=0.1) + facet_wrap(~genotype)
Apical_by_geno_s1 <- Apical_by_geno_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
Apical_by_geno_s1 <- Apical_by_geno_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
Apical_by_geno_s1 <- Apical_by_geno_s1 + xlab("Day of Treatment") + ylab("Apical Distance (cm)") + ggtitle("Apical Distance Over Time")
Apical_by_geno_s1
Branched_over_time_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = Branched, group = root_name, color = treatment)) + theme_classic()
Branched_over_time_s1 <- Branched_over_time_s1 + geom_line(alpha=0.1)
Branched_over_time_s1 <- Branched_over_time_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
Branched_over_time_s1 <- Branched_over_time_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
Branched_over_time_s1 <- Branched_over_time_s1 + xlab("Day of Treatment") + ylab("Branched Distance (cm)") + ggtitle("Branched Distance Over Time")
Branched_over_time_s1
Branched_by_geno_s1 <- ggplot(RSA_march2021_MR4, aes(x = Day, y = Branched, group = root_name, color = treatment)) +theme_classic()
Branched_by_geno_s1 <- Branched_by_geno_s1 + geom_line(alpha=0.1) + facet_wrap(~genotype)
Branched_by_geno_s1 <- Branched_by_geno_s1 + stat_summary(fun=mean, aes(group= treatment),size=0.8, geom="line", linetype="dashed")
Branched_by_geno_s1 <- Branched_by_geno_s1 + scale_color_manual(labels=c("0 mM", "75 mM", "125 mM"), values=c("limegreen", "red4", "midnightblue"))
Branched_by_geno_s1 <- Branched_by_geno_s1 + xlab("Day of Treatment") + ylab("Branched Distance (cm)") + ggtitle("Branched Distance Over Time")
Branched_by_geno_s1
###Growth Rate calculations and plotting
root_names <- read.csv("root_names.csv")
dim(root_names)
## [1] 322 1
LOR <- unique(RSA_march2021_MR4$root_name)
length(LOR)
## [1] 322
root_names$root_name <- unique(RSA_march2021_MR4$root_name)
temporary <- subset(RSA_march2021_MR4, RSA_march2021_MR4$root_name == LOR[1])
temporary
plot(temporary$MRL ~ temporary$Day)
model <- lm(temporary$MRL ~ temporary$Day)
summary(model)
##
## Call:
## lm(formula = temporary$MRL ~ temporary$Day)
##
## Residuals:
## 1 2 3 4
## 0.3231 -0.3807 -0.2078 0.2654
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.39831 0.79124 -4.295 0.0502 .
## temporary$Day 0.91126 0.09525 9.567 0.0108 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.426 on 2 degrees of freedom
## Multiple R-squared: 0.9786, Adjusted R-squared: 0.9679
## F-statistic: 91.52 on 1 and 2 DF, p-value: 0.01075
summary(model)$coefficients[2]
## [1] 0.9112563
Main root growth rate
root_names$MR_GrowthRate <- 0
root_names$MR_GrowthRate[1] <- summary(model)$coefficients[2]
root_names
for (i in 1:nrow(root_names)){
temporary <- subset(RSA_march2021_MR4, RSA_march2021_MR4$root_name == LOR[i])
model <- lm(temporary$MRL ~ temporary$Day)
root_names$MR_GrowthRate[i] <- summary(model)$coefficients[2]
}
root_names
RSA_march2021_MR4
##Lateral root number growth rate. First, we need to select for roots that will eventually grow lateral roots. To generate list of Root Names - we will look at last day - and subset for LRno >0
unique(RSA_march2021_MR4$Day)
## [1] 5 7 9 11 13
unique(RSA_march2021_MR4$treatment)
## [1] 0 75 125
## Levels: 0 75 125
RSA_march2021_MR4$treatment <- as.factor(as.character(RSA_march2021_MR4$treatment))
head(RSA_march2021_MR4)
ld_0mM <- subset(RSA_march2021_MR4, RSA_march2021_MR4$treatment == 0)
ld_0mM <- subset(ld_0mM, ld_0mM$Day == 11)
ld_0mM <- subset(ld_0mM, ld_0mM$LRno > 0)
root_names_0mM <- unique(ld_0mM$root_name)
ld_75mM <- subset(RSA_march2021_MR4, RSA_march2021_MR4$treatment == 75)
ld_75mM <- subset(ld_75mM, ld_75mM$Day == 13)
ld_75mM <- subset(ld_75mM, ld_75mM$LRno > 0)
root_names_75mM <- unique(ld_75mM$root_name)
ld_125mM <- subset(RSA_march2021_MR4, RSA_march2021_MR4$treatment == 125)
ld_125mM <- subset(ld_125mM, ld_125mM$Day == 13)
ld_125mM <- subset(ld_125mM, ld_125mM$LRno > 0)
root_names_125mM <- unique(ld_125mM$root_name)
roots_with_LR_set1 <- c(root_names_0mM, root_names_75mM, root_names_125mM)
LR_only_set1 <- subset(RSA_march2021_MR4, RSA_march2021_MR4$root_name %in% roots_with_LR_set1)
LR_only_set1
temp3 <- subset(LR_only_set1, LR_only_set1$root_name == LOR[1])
temp3
plot(temp3$LRno ~ temp3$Day)
model3 <- lm(temp3$LRno ~ temp3$Day)
summary(model3)
##
## Call:
## lm(formula = temp3$LRno ~ temp3$Day)
##
## Residuals:
## 1 2 3 4
## 0.8 -0.4 -1.6 1.2
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -8.8000 2.8775 -3.058 0.0923 .
## temp3$Day 1.6000 0.3464 4.619 0.0438 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.549 on 2 degrees of freedom
## Multiple R-squared: 0.9143, Adjusted R-squared: 0.8714
## F-statistic: 21.33 on 1 and 2 DF, p-value: 0.04382
summary(model3)$coefficients[2]
## [1] 1.6
##Lateral root number growth rate
root_names$LRno_GrowthRate <- 0
root_names$LRno_GrowthRate[1] <- summary(model3)$coefficients[2]
root_names
Loop through to add LRno_GrowthRate for all
for (i in 2:nrow(root_names)){
temp3 <- subset(LR_only_set1, LR_only_set1$root_name == LOR[i])
if(dim(temp3)[1] < 1){
root_names$LRno_GrowthRate[i] <- 0
} else {
model3 <- lm(temp3$LRno ~ temp3$Day)
root_names$LRno_GrowthRate[i] <- summary(model3)$coefficients[2]
}
}
## Warning in summary.lm(model3): essentially perfect fit: summary may be
## unreliable
root_names
Add average LR length to LR_only_set1 df
LR_only_set1$LRL_avg <- 0
for (i in 1:nrow(LR_only_set1)){
if(LR_only_set1$LRL[i] > 0){
LR_only_set1$LRL_avg[i] <- LR_only_set1$LRL[i] / LR_only_set1$LRno[i]
}
else{
LR_only_set1$LRL_avg[i] <- 0
}
}
LR_only_set1
LRL_avg growth rate
root_names$LRLavg_GrowthRate <- 0
temp4 <- subset(LR_only_set1, LR_only_set1$root_name == LOR[1])
temp4
plot(temp4$LRL_avg ~ temp4$Day)
model4 <- lm(temp4$LRL_avg ~ temp4$Day)
summary(model4)$coefficients[2]
## [1] 0.1357783
root_names$LRLavg_GrowthRate[1] <- summary(model4)$coefficients[2]
root_names
for (i in 1:nrow(root_names)){
temp4 <- subset(LR_only_set1, LR_only_set1$root_name == LOR[i])
temp4
if(dim(temp4)[1] > 0){
model4 <- lm(temp4$LRL_avg ~ temp4$Day)
root_names$LRLavg_GrowthRate[i] <- summary(model4)$coefficients[2]
} else{
root_names$LRLavg_GrowthRate[i] <- 0
}
}
root_names
##Adding root info
root_names$info <- strsplit(root_names$root_name, "_")
root_names$info[1]
## [[1]]
## [1] " Pl1" "0mM" "p.4" "G1"
root_names$plate <- "NA"
root_names$treatment <- "NA"
root_names$plant <- "NA"
root_names$genotype <- "NA"
for(i in 1:nrow(root_names)){
root_names$plate[i] <- root_names$info[[i]][1]
root_names$treatment[i] <- root_names$info[[i]][2]
root_names$plant[i] <- root_names$info[[i]][3]
root_names$genotype[i] <- root_names$info[[i]][4]
}
root_names
unique(root_names$genotype)
## [1] "G1" "GC" "G2" "G3" "G4" "G6" "G5" "G7" "G8"
unique(root_names$plate)
## [1] " Pl1" " Pl2" " Pl3" " Pl4" " Pl6" " Pl7" " Pl8" " Pl9" " P10"
## [10] " P11" " P12" " Pl13" " Pl14" " Pl15" " Pl16" " Pl17" " Pl18" " Pl19"
## [19] " Pl20" " Pl21" " Pl22" " Pl23" " Pl24" " Pl25" " Pl26" " Pl27" " Pl5"
## [28] " Pl10" " Pl11" " Pl12"
unique(root_names$plant)
## [1] "p.4" "p.3" "p.2" "p.1"
unique(root_names$treatment)
## [1] "0mM" "75mM" "125mM"
root_names$plate2 <- gsub(" Pl", "", root_names$plate)
root_names$plate2 <- as.numeric(as.character(root_names$plate2))
## Warning: NAs introduced by coercion
root_names
# same for genotype
root_names$genotype <- gsub("GC", "Col-0", root_names$genotype)
root_names$genotype <- gsub("G1", "120-2E", root_names$genotype)
root_names$genotype <- gsub("G2", "140-1C", root_names$genotype)
root_names$genotype <- gsub("G3", "140-2B", root_names$genotype)
root_names$genotype <- gsub("G4", "140-3F", root_names$genotype)
root_names$genotype <- gsub("G5", "150-1B", root_names$genotype)
root_names$genotype <- gsub("G6", "150-3B", root_names$genotype)
root_names$genotype <- gsub("G7", "170-1B", root_names$genotype)
root_names$genotype <- gsub("G8", "170-2A", root_names$genotype)
# same for treatment
root_names$treatment <- gsub("mM", "", root_names$treatment)
root_names$treatment <- as.factor(as.character(root_names$treatment))
root_names$treatment <- factor(root_names$treatment, level = c(0, 75, 125))
#same for plant
root_names$plant <- gsub("P.", "", root_names$plant)
#check
unique(root_names$genotype)
## [1] "120-2E" "Col-0" "140-1C" "140-2B" "140-3F" "150-3B" "150-1B" "170-1B"
## [9] "170-2A"
unique(root_names$plate)
## [1] " Pl1" " Pl2" " Pl3" " Pl4" " Pl6" " Pl7" " Pl8" " Pl9" " P10"
## [10] " P11" " P12" " Pl13" " Pl14" " Pl15" " Pl16" " Pl17" " Pl18" " Pl19"
## [19] " Pl20" " Pl21" " Pl22" " Pl23" " Pl24" " Pl25" " Pl26" " Pl27" " Pl5"
## [28] " Pl10" " Pl11" " Pl12"
unique(root_names$plant)
## [1] "p.4" "p.3" "p.2" "p.1"
unique(root_names$treatment)
## [1] 0 75 125
## Levels: 0 75 125
root_names
#re-order and select columns
colnames(root_names)
## [1] "root_name" "MR_GrowthRate" "LRno_GrowthRate"
## [4] "LRLavg_GrowthRate" "info" "plate"
## [7] "treatment" "plant" "genotype"
## [10] "plate2"
GR_df <- root_names[,c(1, 6:10, 2:4)]
GR_df
GR_df$genotype <- factor(GR_df$genotype, level = c("Col-0", "120-2E", "140-1C", "140-2B", "140-3F", "150-1B", "150-3B", "170-1B", "170-2A"))
##Plotting Growth Rates
#Scatterplot of growth rates. Compare lines and facet by treatment
MR_gr_errorplot <- ggerrorplot(GR_df, y = "MR_GrowthRate", x = "genotype", na.rm = TRUE, fill = "genotype", color = "genotype",
facet.by = c("treatment"), ncol = 4,
desc_stat = "mean_sd", add = "jitter",
add.params = list(color = "darkgray"),
xlab = "DUF Mutant Line", ylab = "Main Root Growth Rate")
MR_gr_errorplot <- MR_gr_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif", hide.ns = TRUE)
MR_gr_errorplot <- MR_gr_errorplot + theme(axis.text.x = element_text(angle = 90))
MR_gr_errorplot <- MR_gr_errorplot + scale_colour_manual(values = c("midnightblue", "firebrick3", "forestgreen", "forestgreen", "forestgreen", "orchid", "orchid", "orange", "orange"))
MR_gr_errorplot
jpeg("MR_GRset_errorplot.jpg")
plot(MR_gr_errorplot)
dev.off()
## png
## 2
#Scatterplot of growth rates. Compare lines and facet by treatment
LRno_gr_errorplot <- ggerrorplot(GR_df, y = "LRno_GrowthRate", x = "genotype", na.rm = TRUE, fill = "genotype",
color = "genotype",
facet.by = c("treatment"), ncol = 4,
desc_stat = "mean_sd", add = "jitter",
add.params = list(color = "darkgray"),
xlab = "DUF Mutant Line", ylab = "Lateral Root number Growth Rate")
LRno_gr_errorplot <- LRno_gr_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif", hide.ns = TRUE)
LRno_gr_errorplot <- LRno_gr_errorplot + theme(axis.text.x = element_text(angle = 90))
LRno_gr_errorplot <- LRno_gr_errorplot + scale_colour_manual(values = c("midnightblue", "firebrick3", "forestgreen", "forestgreen", "forestgreen", "orchid", "orchid", "orange", "orange"))
LRno_gr_errorplot
#Scatterplot of growth rates. Compare lines and facet by treatment
LRLavg_gr_errorplot <- ggerrorplot(GR_df, y = "LRLavg_GrowthRate", x = "genotype", na.rm = TRUE, fill = "genotype", color = "genotype",
facet.by = c("treatment"), ncol = 4,
desc_stat = "mean_sd", add = "jitter",
add.params = list(color = "darkgray"),
xlab = "DUF Mutant Line", ylab = "Lateral Root average length Growth Rate")
LRLavg_gr_errorplot <- LRLavg_gr_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif", hide.ns = TRUE)
LRLavg_gr_errorplot <- LRLavg_gr_errorplot + theme(axis.text.x = element_text(angle = 90))
LRLavg_gr_errorplot <- LRLavg_gr_errorplot + scale_colour_manual(values = c("midnightblue", "firebrick3", "forestgreen", "forestgreen", "forestgreen", "orchid", "orchid", "orange", "orange"))
LRLavg_gr_errorplot
##Relative Growth Rate steps: find average GR of each genotype under control.
#install.packages("doBy")
library(doBy)
## Warning: package 'doBy' was built under R version 4.1.2
GR_df
sum_GR <- summaryBy(MR_GrowthRate + LRno_GrowthRate + LRLavg_GrowthRate ~ genotype + treatment, data = GR_df)
sum_GR
sum_GRC <- subset(sum_GR, sum_GR$treatment == "0")
sum_GRC
remove treatment column and rename all other columns as “Control.avg”:
sum_GRC <- sum_GRC[,c(1,3:5)]
colnames(sum_GRC) <- gsub(".mean", ".C.avg", colnames(sum_GRC))
sum_GRC
merge this with the original GR file:
GR_STI <- merge(GR_df, sum_GRC, by = "genotype", all = TRUE)
dim(GR_df)
## [1] 322 9
dim(GR_STI)
## [1] 322 12
GR_STI
Calculate RELATIVE GRs per each genotype
GR_STI$MR.STI <- GR_STI$MR_GrowthRate / GR_STI$MR_GrowthRate.C.avg
GR_STI$LRno.STI <- GR_STI$LRno_GrowthRate / GR_STI$LRno_GrowthRate.C.avg
GR_STI$aLRL.STI <- GR_STI$LRLavg_GrowthRate / GR_STI$LRLavg_GrowthRate.C.avg
GR_STI
MR_STI_errorplot <- ggerrorplot(GR_STI, y = "MR.STI", x = "genotype", na.rm = TRUE, fill = "genotype", color = "genotype",
facet.by = c("treatment"), ncol = 4,
desc_stat = "mean_sd", add = "jitter",
add.params = list(color = "darkgray"),
xlab = "DUF Mutant Line", ylab = "Main Root Salt Tolerance Index")
MR_STI_errorplot <- MR_STI_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif", hide.ns = TRUE)
MR_STI_errorplot <- MR_STI_errorplot + theme(axis.text.x = element_text(angle = 90))
MR_STI_errorplot <- MR_STI_errorplot + scale_colour_manual(values = c("midnightblue", "firebrick3", "forestgreen", "forestgreen", "forestgreen", "orchid", "orchid", "orange", "orange"))
MR_STI_errorplot
jpeg("MR_STIset1_errorplot.jpg")
plot(MR_STI_errorplot)
dev.off()
## png
## 2
LRno_STI_errorplot <- ggerrorplot(GR_STI, y = "LRno.STI", x = "genotype", na.rm = TRUE, fill = "genotype", color = "genotype",
facet.by = c("treatment"), ncol = 4,
desc_stat = "mean_sd", add = "jitter",
add.params = list(color = "darkgray"),
xlab = "DUF Mutant Line", ylab = "Lateral Root Number Salt Tolerance Index")
LRno_STI_errorplot <- LRno_STI_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif", hide.ns = TRUE)
LRno_STI_errorplot <- LRno_STI_errorplot + theme(axis.text.x = element_text(angle = 90))
LRno_STI_errorplot <- LRno_STI_errorplot + scale_colour_manual(values = c("midnightblue", "firebrick3", "forestgreen", "forestgreen", "forestgreen", "orchid", "orchid", "orange", "orange"))
LRno_STI_errorplot
aLRL_STI_errorplot <- ggerrorplot(GR_STI, y = "aLRL.STI", x = "genotype", na.rm = TRUE, fill = "genotype", color = "genotype",
facet.by = c("treatment"), ncol = 4,
desc_stat = "mean_sd", add = "jitter",
add.params = list(color = "darkgray"),
xlab = "DUF Mutant Line", ylab = "Average Lateral Root Salt Tolerance Index")
aLRL_STI_errorplot <- aLRL_STI_errorplot + rremove("legend") + stat_compare_means(method = "t.test", ref.group = "Col-0", label = "p.signif", hide.ns = TRUE)
aLRL_STI_errorplot <- aLRL_STI_errorplot + theme(axis.text.x = element_text(angle = 90))
aLRL_STI_errorplot <- aLRL_STI_errorplot + scale_colour_manual(values = c("midnightblue", "firebrick3", "forestgreen", "forestgreen", "forestgreen", "orchid", "orchid", "orange", "orange"))
aLRL_STI_errorplot