This notebook describes a first attempt to characterize the root growth responses of Arabidopsis mutants +/- PEG8000 on SPIRO setup. The specific At genes have been identfied as homologs of cowpea genes, through GWAS for traits recorded under drought stress. As no drought stress is possible on agar plate, we imposed osmotic stress through PEG.

The plants were germinated on 1/2 MS plates, and transplanted at 4 days after germination to treatment plates, after which the imaging commenced. The experiment was performed by Jade Milton (REU student in Julkowska lab), and Magda Julkowska in BTI’s Growth Chamber 35.

Data import

J1p1 <- read.csv("Jade1_plate1.csv")
J1p3 <- read.csv("Jade1_plate3.csv")
J2p1 <- read.csv("Jade2_plate1.csv")
J2p2 <- read.csv("Jade2_plate2.csv")
J2p3 <- read.csv("Jade2_plate3.csv")
J2p4 <- read.csv("Jade2_plate4.csv")
head(J1p1)

OK - let’s add treatment to each plate - just to not mess it up (we will add genotype info later)

J1p1$treatment <- "Control"
J1p3$treatment <- "Control"
J1p1$SPIRO <- 1
J1p3$SPIRO <- 1
J2p1$treatment <- "PEG"
J2p2$treatment <- "Control"
J2p3$treatment <- "PEG"
J2p4$treatment <- "Control"
J2p1$SPIRO <- 2
J2p2$SPIRO <- 2
J2p3$SPIRO <- 2
J2p4$SPIRO <- 2

OK - now - let’s merge all of the files into one big dataset:

Jdata <- rbind(J1p1, J1p3)
Jdata <- rbind(Jdata, J2p1)
Jdata <- rbind(Jdata, J2p2)
Jdata <- rbind(Jdata, J2p3)
Jdata <- rbind(Jdata, J2p4)
Jdata
Jdata.new <- Jdata[,c(1:4, 20:21)]
Jdata.new
Jdata.new$info <- strsplit(Jdata.new$image, "-")
Jdata.new$info[1]
## [[1]]
## [1] "plate1"    "20230615"  "044412"    "nigh.rsml"
for(i in 1:nrow(Jdata.new)){
  Jdata.new$plate[i] <- Jdata.new$info[i][[1]][1]
  Jdata.new$date[i] <- Jdata.new$info[i][[1]][2]
  Jdata.new$time[i] <- Jdata.new$info[i][[1]][3]
}

unique(Jdata.new$date)
## [1] "20230615" "20230613" "20230614" "20230616" "20230617"
Jdata.new$day <- substr(Jdata.new$date, 7, 8)
Jdata.new$hour <- substr(Jdata.new$time, 1, 2)
Jdata.new$min <- substr(Jdata.new$time, 3, 4)
Jdata.new
temp <- subset(Jdata.new, Jdata.new$date == "20230613")
unique(temp$time)
##  [1] "204354" "234416" "214821" "194822" "174811" "184809" "134815" "114818"
##  [9] "154813" "124816" "144814" "204821" "164812" "144836" "164832" "114844"
## [17] "154833" "214843" "134838" "124837" "174833" "194845" "184832" "204842"
## [25] "204906" "164856" "134901" "214903" "154857" "144858" "194909" "184916"
## [33] "164918" "174917" "194934" "144922" "214927" "204928" "124921" "114937"
## [41] "134923" "154920" "234905"

It seems like 114818 is the first timepoint

OK - lets translate all of these numbers into the actual change in time of the experiment:

Jdata.new$min <- as.numeric(as.character(Jdata.new$min))
Jdata.new$hour <- as.numeric(as.character(Jdata.new$hour))
Jdata.new$day <- as.numeric(as.character(Jdata.new$day))
Jdata.new$TOE <- (Jdata.new$min - 48) + (Jdata.new$hour - 11)*60 + (Jdata.new$day - 13)*24*60
Jdata.new
library(ggplot2)
Jdata.new$ID <- paste(Jdata.new$SPIRO, Jdata.new$plate, Jdata.new$root_name, sep="_")
Jdata.new$ID <- gsub(" ", "", Jdata.new$ID)
Jdata.new$root_name <- gsub(" ", "", Jdata.new$root_name)
Jdata.new$plate_ID <- paste(Jdata.new$SPIRO, Jdata.new$plate, sep="_")

root_lgraph <- ggplot(data=Jdata.new, aes(x= TOE, y=length, group = ID, color = plate_ID)) 
root_lgraph <- root_lgraph + geom_line(alpha = 0.1) 
root_lgraph <- root_lgraph + stat_summary(fun.data = mean_se, geom="ribbon", linetype=0, aes(group=plate_ID), alpha=0.3) + stat_summary(fun=mean, aes(group= plate_ID),  size=0.7, geom="line", linetype = "dashed")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
root_lgraph <- root_lgraph + ylab("Root Length (cm)") + xlab("Minutes After Stress")
root_lgraph

ok - let’s try to decode all of the data now into individual genotypes:

decode <- read.csv("SPIRO_coding - Sheet1.csv")
decode
library(reshape2)
Jdata.new
all_deco <- merge(Jdata.new, decode, by = c("ID"),   all=TRUE)
all_deco

ok - now let’c clean it up :)

colnames(all_deco)
##  [1] "ID"          "image"       "root_name.x" "root"        "length"     
##  [6] "treatment.x" "SPIRO.x"     "info"        "plate.x"     "date"       
## [11] "time"        "day"         "hour"        "min"         "TOE"        
## [16] "plate_ID"    "SPIRO.y"     "plate.y"     "root.number" "genotype"   
## [21] "treatment.y" "root_name.y"
all_deco2 <- all_deco[,c(1:4, 6, 15, 20, 5)]
all_deco2
unique(all_deco2$genotype)
## [1] "GR4.1"  "GR4.2"  "EVT6.1" "Col-0"  NA
want <- unique(all_deco2$genotype)[1:4]
want
## [1] "GR4.1"  "GR4.2"  "EVT6.1" "Col-0"
all_deco3 <- subset(all_deco2, all_deco2$genotype %in% want)
all_deco3

OK - as the plants on PEG plates didnt really grow - lets’ get rid of them:

colnames(all_deco3)[3] <- "root_name"
colnames(all_deco3)[5] <- "treatment"
unique(all_deco3$treatment)
## [1] "Control" "PEG"
all_deco3
all_deco3$treatment <- as.character(all_deco3$treatment)

all_deco4 <- subset(all_deco3, all_deco3$treatment == "Control")
all_deco4

ok - now is the time to curate these data. Let’s have a look at the 1st root throughout time:

temp <- subset(all_deco4, all_deco4$ID == unique(all_deco4$ID)[1])
plot(temp$length ~ temp$TOE)

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
temp2 <- temp %>% arrange(TOE)
temp2$diff <- 0
for(i in 2:nrow(temp2)){
  temp2$diff[i] <- temp2$length[i] - temp2$length[i-1]
}


temp3 <- subset(temp2, temp2$diff < 0.3)
temp4 <- subset(temp3, temp3$diff > 0)
temp4
plot(temp4$length ~ temp4$TOE)

double_cur <- temp4

OK - looks great!

root_IDs <- unique(all_deco4$ID)
length(root_IDs)
## [1] 85
for(i in 2:85){
  temp_root <- subset(all_deco4, all_deco4$ID == root_IDs[i])
  temp2 <- temp_root %>% arrange(TOE)
  temp2$diff <- 0
  for(m in 2:nrow(temp2)){
  temp2$diff[m] <- temp2$length[m] - temp2$length[m-1]
  }
  temp3 <- subset(temp2, temp2$diff < 0.3)
  temp4 <- subset(temp3, temp3$diff > 0)
  temp4 <- temp4 %>% arrange(TOE)
  for(n in 2:nrow(temp4)){
    temp4$diff[n] <- temp4$length[n] - temp4$length[n-1]
  }
  temp5 <- subset(temp4, temp4$diff > 0)
  temp5 <- temp5 %>% arrange(TOE)
  for(o in 2:nrow(temp5)){
    temp5$diff[o] <- temp5$length[o] - temp5$length[o-1]
  }
  temp6 <- subset(temp5, temp5$diff > 0)
  double_cur <- rbind(double_cur, temp6)
}
unique(double_cur$ID)
##  [1] "1_plate1_root_0"  "1_plate1_root_1"  "1_plate1_root_10" "1_plate1_root_11"
##  [5] "1_plate1_root_12" "1_plate1_root_13" "1_plate1_root_14" "1_plate1_root_15"
##  [9] "1_plate1_root_16" "1_plate1_root_17" "1_plate1_root_18" "1_plate1_root_19"
## [13] "1_plate1_root_2"  "1_plate1_root_20" "1_plate1_root_21" "1_plate1_root_3" 
## [17] "1_plate1_root_4"  "1_plate1_root_5"  "1_plate1_root_6"  "1_plate1_root_7" 
## [21] "1_plate1_root_8"  "1_plate1_root_9"  "1_plate3_root_0"  "1_plate3_root_1" 
## [25] "1_plate3_root_10" "1_plate3_root_11" "1_plate3_root_12" "1_plate3_root_13"
## [29] "1_plate3_root_14" "1_plate3_root_15" "1_plate3_root_16" "1_plate3_root_17"
## [33] "1_plate3_root_18" "1_plate3_root_19" "1_plate3_root_2"  "1_plate3_root_20"
## [37] "1_plate3_root_21" "1_plate3_root_22" "1_plate3_root_23" "1_plate3_root_24"
## [41] "1_plate3_root_25" "1_plate3_root_26" "1_plate3_root_27" "1_plate3_root_28"
## [45] "1_plate3_root_29" "1_plate3_root_3"  "1_plate3_root_4"  "1_plate3_root_5" 
## [49] "1_plate3_root_6"  "1_plate3_root_7"  "1_plate3_root_8"  "1_plate3_root_9" 
## [53] "2_plate2_root_0"  "2_plate2_root_1"  "2_plate2_root_10" "2_plate2_root_11"
## [57] "2_plate2_root_12" "2_plate2_root_13" "2_plate2_root_14" "2_plate2_root_15"
## [61] "2_plate2_root_16" "2_plate2_root_17" "2_plate2_root_18" "2_plate2_root_19"
## [65] "2_plate2_root_2"  "2_plate2_root_20" "2_plate2_root_3"  "2_plate2_root_4" 
## [69] "2_plate2_root_5"  "2_plate2_root_6"  "2_plate2_root_7"  "2_plate2_root_8" 
## [73] "2_plate2_root_9"  "2_plate4_root_0"  "2_plate4_root_1"  "2_plate4_root_10"
## [77] "2_plate4_root_11" "2_plate4_root_2"  "2_plate4_root_3"  "2_plate4_root_4" 
## [81] "2_plate4_root_5"  "2_plate4_root_6"  "2_plate4_root_7"  "2_plate4_root_8" 
## [85] "2_plate4_root_9"
double_cur
root_lgraph <- ggplot(data=double_cur, aes(x= TOE, y=length, group = ID,)) 
root_lgraph <- root_lgraph + geom_line(alpha = 0.1) 
#root_lgraph <- root_lgraph + stat_summary(fun.data = mean_se, geom="ribbon", linetype=0, aes(group=plate), alpha=0.3) + stat_summary(fun=mean, aes(group= plate),  size=0.7, geom="line", linetype = "dashed")
root_lgraph <- root_lgraph + ylab("Root Length (cm)") + xlab("Minutes After Stress")
root_lgraph

unique(double_cur$genotype)
## [1] "GR4.1"  "GR4.2"  "EVT6.1" "Col-0"
GR4.1 <- subset(double_cur, double_cur$genotype == "GR4.1")
GR4.2 <- subset(double_cur, double_cur$genotype == "GR4.2")
EVT6.1 <- subset(double_cur, double_cur$genotype == "EVT6.1")
Col.0 <- subset(double_cur, double_cur$genotype == "Col-0")
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
Root_graph <- ggplot(data=GR4.1, aes(x= TOE, y=length, group = ID)) 
Root_graph <- Root_graph + geom_line(alpha = 0.1) 
Root_graph <- Root_graph + ylab("Root length (cm)") + xlab("Time (minutes)")
ggplotly(Root_graph)
Root_graph <- ggplot(data=GR4.2, aes(x= TOE, y=length, group = ID)) 
Root_graph <- Root_graph + geom_line(alpha = 0.1) 
Root_graph <- Root_graph + ylab("Root length (cm)") + xlab("Time (minutes)")
ggplotly(Root_graph)
Root_graph <- ggplot(data=EVT6.1, aes(x= TOE, y=length, group = ID)) 
Root_graph <- Root_graph + geom_line(alpha = 0.1) 
Root_graph <- Root_graph + ylab("Root length (cm)") + xlab("Time (minutes)")
ggplotly(Root_graph)
Root_graph <- ggplot(data=Col.0, aes(x= TOE, y=length, group = ID)) 
Root_graph <- Root_graph + geom_line(alpha = 0.1) 
Root_graph <- Root_graph + ylab("Root length (cm)") + xlab("Time (minutes)")
ggplotly(Root_graph)
bye <- c("1_plate1_root_4", "1_plate1_root_21", "1_plate1_root_20",  "1_plate1_root_13", "2_plate2_root_8", "2_plate2_root_17", "1_plate3_root_9", "1_plate3_root_21", "2_plate4_root_9", "1_plate3_root_13", "1_plate3_root_26", "2_plate4_root_0", "2_plate2_root_13", "1_plate1_root_9", "1_plate1_root_14", "1_plate1_root_16", "1_plate1_root_17", "1_plate3_root_10", "1_plate1_root_6", "1_plate3_root_14")

triple_cur_data <- subset(double_cur, !(double_cur$ID %in% bye))
triple_cur_data
root_lgraph <- ggplot(data=triple_cur_data, aes(x= TOE, y=length, group = ID, color = genotype)) 
root_lgraph <- root_lgraph + geom_line(alpha = 0.1) 
root_lgraph <- root_lgraph + facet_wrap(~ genotype)
#root_lgraph <- root_lgraph + stat_summary(fun=mean, aes(group= genotype),  size=0.7, geom="line", linetype = "dashed")
root_lgraph <- root_lgraph + ylab("Root Length (cm)") + xlab("Minutes After Stress")
root_lgraph

# Smooth spline modeling

temp <- subset(triple_cur_data, triple_cur_data$ID == unique(triple_cur_data$ID)[1])
temp
plot.spl <- with(temp, smooth.spline(TOE, length, df = 10))
plot.spl$fit
## $knot
##  [1] 0.0000000 0.0000000 0.0000000 0.0000000 0.1805138 0.2362879 0.3057163
##  [8] 0.3334876 0.4168017 0.6528581 0.7917149 0.8611433 0.8889146 1.0000000
## [15] 1.0000000 1.0000000 1.0000000
## 
## $nk
## [1] 13
## 
## $min
## [1] 1075
## 
## $range
## [1] 4321
## 
## $coef
##  [1] 0.6203276 0.6677064 0.7296512 0.8605214 0.9103451 0.9975287 1.0835707
##  [8] 1.3414047 1.4421481 1.5407806 1.7408569 1.7561770 1.7685904
## 
## attr(,"class")
## [1] "smooth.spline.fit"
plot(length ~ TOE, data = temp)
lines(plot.spl, col = "blue")

timeline <- seq(0, 5500, 60)
timeline
##  [1]    0   60  120  180  240  300  360  420  480  540  600  660  720  780  840
## [16]  900  960 1020 1080 1140 1200 1260 1320 1380 1440 1500 1560 1620 1680 1740
## [31] 1800 1860 1920 1980 2040 2100 2160 2220 2280 2340 2400 2460 2520 2580 2640
## [46] 2700 2760 2820 2880 2940 3000 3060 3120 3180 3240 3300 3360 3420 3480 3540
## [61] 3600 3660 3720 3780 3840 3900 3960 4020 4080 4140 4200 4260 4320 4380 4440
## [76] 4500 4560 4620 4680 4740 4800 4860 4920 4980 5040 5100 5160 5220 5280 5340
## [91] 5400 5460
plot(length ~ TOE, data = temp)
lines(plot.spl, col = "blue")
lines(predict(plot.spl, timeline), col="red")

names <- c(text="ID", "genotype", "treatment", "TOE", "length.spl")
spline_data <- data.frame()
for (k in names) spline_data[[k]] <- as.character()
spline_data
pred_temp <- predict(plot.spl, timeline)


# make empty dataframe
spline_data[1:92,4] <- pred_temp$x
spline_data[1:92,5] <- pred_temp$y
spline_data[1:92,1] <- temp$ID[1]
spline_data[1:92,2] <- temp$genotype[1]
spline_data[1:92,3] <- temp$treatment[1]

spline_data
final_spline <- spline_data

all_roots <- unique(triple_cur_data$ID)
all_roots
##  [1] "1_plate1_root_0"  "1_plate1_root_1"  "1_plate1_root_10" "1_plate1_root_11"
##  [5] "1_plate1_root_12" "1_plate1_root_15" "1_plate1_root_18" "1_plate1_root_19"
##  [9] "1_plate1_root_2"  "1_plate1_root_3"  "1_plate1_root_5"  "1_plate1_root_7" 
## [13] "1_plate1_root_8"  "1_plate3_root_0"  "1_plate3_root_1"  "1_plate3_root_11"
## [17] "1_plate3_root_12" "1_plate3_root_15" "1_plate3_root_16" "1_plate3_root_17"
## [21] "1_plate3_root_18" "1_plate3_root_19" "1_plate3_root_2"  "1_plate3_root_20"
## [25] "1_plate3_root_22" "1_plate3_root_23" "1_plate3_root_24" "1_plate3_root_25"
## [29] "1_plate3_root_27" "1_plate3_root_28" "1_plate3_root_29" "1_plate3_root_3" 
## [33] "1_plate3_root_4"  "1_plate3_root_5"  "1_plate3_root_6"  "1_plate3_root_7" 
## [37] "1_plate3_root_8"  "2_plate2_root_0"  "2_plate2_root_1"  "2_plate2_root_10"
## [41] "2_plate2_root_11" "2_plate2_root_12" "2_plate2_root_14" "2_plate2_root_15"
## [45] "2_plate2_root_16" "2_plate2_root_18" "2_plate2_root_19" "2_plate2_root_2" 
## [49] "2_plate2_root_20" "2_plate2_root_3"  "2_plate2_root_4"  "2_plate2_root_5" 
## [53] "2_plate2_root_6"  "2_plate2_root_7"  "2_plate2_root_9"  "2_plate4_root_1" 
## [57] "2_plate4_root_10" "2_plate4_root_11" "2_plate4_root_2"  "2_plate4_root_3" 
## [61] "2_plate4_root_4"  "2_plate4_root_5"  "2_plate4_root_6"  "2_plate4_root_7" 
## [65] "2_plate4_root_8"
for(i in 2:65){
  temp <- subset(triple_cur_data, triple_cur_data$ID == all_roots[i])
  plot.spl <- with(temp, smooth.spline(TOE, length, df = 10))
  pred_temp <- predict(plot.spl, timeline)
  spline_data[1:92,4] <- pred_temp$x
  spline_data[1:92,5] <- pred_temp$y
  spline_data[1:92,1] <- temp$ID[1]
  spline_data[1:92,2] <- temp$genotype[1]
  spline_data[1:92,3] <- temp$treatment[1]
  final_spline <- rbind(final_spline, spline_data)
}
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 9

## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 9

## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 9
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 8

## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 8
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 6
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 7
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 8
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 7
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 9
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 5
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 7
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 4
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 8
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 5
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 6

## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 6
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 7
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 8

## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 8
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 6

## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 6

## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 6
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 9
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 6
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 5
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 6
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 4
## Warning in smooth.spline(TOE, length, df = 10): not using invalid df; must have
## 1 < df <= n := #{unique x} = 5
i
## [1] 65
final_spline
final_spline$TOE <- as.numeric(as.character(final_spline$TOE))
final_spline$length.spl <- as.numeric(as.character(final_spline$length.spl))
unique(final_spline$ID)
##  [1] "1_plate1_root_0"  "1_plate1_root_1"  "1_plate1_root_10" "1_plate1_root_11"
##  [5] "1_plate1_root_12" "1_plate1_root_15" "1_plate1_root_18" "1_plate1_root_19"
##  [9] "1_plate1_root_2"  "1_plate1_root_3"  "1_plate1_root_5"  "1_plate1_root_7" 
## [13] "1_plate1_root_8"  "1_plate3_root_0"  "1_plate3_root_1"  "1_plate3_root_11"
## [17] "1_plate3_root_12" "1_plate3_root_15" "1_plate3_root_16" "1_plate3_root_17"
## [21] "1_plate3_root_18" "1_plate3_root_19" "1_plate3_root_2"  "1_plate3_root_20"
## [25] "1_plate3_root_22" "1_plate3_root_23" "1_plate3_root_24" "1_plate3_root_25"
## [29] "1_plate3_root_27" "1_plate3_root_28" "1_plate3_root_29" "1_plate3_root_3" 
## [33] "1_plate3_root_4"  "1_plate3_root_5"  "1_plate3_root_6"  "1_plate3_root_7" 
## [37] "1_plate3_root_8"  "2_plate2_root_0"  "2_plate2_root_1"  "2_plate2_root_10"
## [41] "2_plate2_root_11" "2_plate2_root_12" "2_plate2_root_14" "2_plate2_root_15"
## [45] "2_plate2_root_16" "2_plate2_root_18" "2_plate2_root_19" "2_plate2_root_2" 
## [49] "2_plate2_root_20" "2_plate2_root_3"  "2_plate2_root_4"  "2_plate2_root_5" 
## [53] "2_plate2_root_6"  "2_plate2_root_7"  "2_plate2_root_9"  "2_plate4_root_1" 
## [57] "2_plate4_root_10" "2_plate4_root_11" "2_plate4_root_2"  "2_plate4_root_3" 
## [61] "2_plate4_root_4"  "2_plate4_root_5"  "2_plate4_root_6"  "2_plate4_root_7" 
## [65] "2_plate4_root_8"

Cool - NOW let’s try to compare the averages:

library(ggpubr)

spl_root_lgraph <- ggplot(data=final_spline, aes(x= TOE, y=length.spl, group = ID, color = genotype)) 
spl_root_lgraph <- spl_root_lgraph + geom_line(alpha = 0.1) 
spl_root_lgraph <- spl_root_lgraph + facet_wrap(~ genotype)
spl_root_lgraph <- spl_root_lgraph + stat_summary(fun.data = mean_se, geom="ribbon", linetype=0, aes(group= genotype), alpha=0.3)
spl_root_lgraph <- spl_root_lgraph + stat_summary(fun=mean, aes(group= genotype),  size=0.7, geom="line", linetype = "dashed")
#spl_root_lgraph <- spl_root_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = T)
spl_root_lgraph <- spl_root_lgraph + ylab("Root Length (cm)") + xlab("Minutes After Stress")
spl_root_lgraph

OK - now we need to make a graph where we compare each mutant to Col-0

For this - we need to copy Col-0 three times and fuse it with mutant dataset so they can be compared to Col-0 in pair-wise way:

Col.0 <- subset(final_spline, final_spline$genotype == "Col-0")
mut <- subset(final_spline, final_spline$genotype != "Col-0")
mut$compare <- mut$genotype
Col.1 <- Col.0
Col.2 <- Col.0
Col.3 <- Col.0
Col.1$compare <- "EVT6.1"
Col.2$compare <- "GR4.1"
Col.3$compare <- "GR4.2"

final_spline2 <- rbind(mut, Col.1)
final_spline2 <- rbind(final_spline2, Col.2)
final_spline2 <- rbind(final_spline2, Col.3)

And now let’s plot it:

library(ggsci)
final_spline2$TOE <- as.numeric(as.character(final_spline2$TOE))
spl_root_lgraph <- ggplot(data=final_spline2, aes(x= TOE, y=length.spl, group = ID, color = genotype)) 
spl_root_lgraph <- spl_root_lgraph + geom_line(alpha = 0.1) 
spl_root_lgraph <- spl_root_lgraph + facet_wrap(~ compare)
spl_root_lgraph <- spl_root_lgraph + stat_summary(fun.data = mean_se, geom="ribbon", linetype=0, aes(group= genotype), alpha=0.3)
spl_root_lgraph <- spl_root_lgraph + stat_summary(fun=mean, aes(group= genotype),  size=0.7, geom="line", linetype = "dashed")
#spl_root_lgraph <- spl_root_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = T)
spl_root_lgraph <- spl_root_lgraph + ylab("Root Length (cm)") + xlab("Minutes After Stress") + color_palette("aaas")

ggplotly(spl_root_lgraph)
pdf("Jade_SPIRO_graph.pdf", width = 10, height = 5)
plot(spl_root_lgraph)
dev.off
## function (which = dev.cur()) 
## {
##     if (which == 1) 
##         stop("cannot shut down device 1 (the null device)")
##     .External(C_devoff, as.integer(which))
##     dev.cur()
## }
## <bytecode: 0x7fb1ef9e8d20>
## <environment: namespace:grDevices>

ok - now let’s see what’s significant:

final_spline2$TOE <- as.factor(final_spline2$TOE)

spl_root_lgraph <- ggplot(data=final_spline2, aes(x= TOE, y=length.spl, group = ID, color = genotype)) 
spl_root_lgraph <- spl_root_lgraph + geom_line(alpha = 0.1) 
spl_root_lgraph <- spl_root_lgraph + facet_wrap(~ compare)
spl_root_lgraph <- spl_root_lgraph + stat_summary(fun.data = mean_se, geom="ribbon", linetype=0, aes(group= genotype), alpha=0.3)
spl_root_lgraph <- spl_root_lgraph + stat_summary(fun=mean, aes(group= genotype),  size=0.7, geom="line", linetype = "dashed")
spl_root_lgraph <- spl_root_lgraph + stat_compare_means(aes(group = genotype), label = "p.signif", method = "t.test", hide.ns = T)
spl_root_lgraph <- spl_root_lgraph + ylab("Root Length (cm)") + xlab("Minutes After Stress") + color_palette("aaas") + rremove("legend")
spl_root_lgraph
## Warning: The dot-dot notation (`..p.signif..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(p.signif)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.