knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 4,
  fig.height = 4
)
devtools::load_all(".")

Installation

Make sure you have the latest version of R and R Studio installed.

First you need to install some perquisites:

install.packages(c('knitr', 'rmarkdown', 'jpeg', 'png', 'devtools'))

After installing all prerequisites you can install rootdetectR from github using the devtools package.

library(devtools)
# install from github
install_github("PhilippJanitza/rootdetectR", build_vignettes = TRUE)

After the installation the package can be loaded within R.

library(rootdetectR)

Introduction

This vignette describes how rootdetectR can be used to conduct analysis of physiological root or hypocotyl elongation assays. It was designed to work in companion with Rootdetection, an automated tool for evaluating photographs of plant roots. To be able to run this script the input data must fulfill some criteria (also check the example data included in this script):

Simple Data Analysis

First we need to set the working directory and read in the data table (e.g. output from Rootdetection).

# set your working directory and read in your data
setwd('/paht/to/your/workingdir')

# read in your rootdetection output table
my_dataset <- read.csv(file = '/path/to/rootdetection/output.csv')

First we need to check if the data meets the criteria of Rootdetection standard Output. The function is_root_output() helps to check the structure of the input data set. Then we need to clean your data and transform the measured pixels to millimeter as unit. Therefore length standard measurements are used. In this example we measured one centimeter of an ruler with the same camera (zoom) settings as used for the rest of the plant pictures.

In the next step we can calculate relative data, which are the length values of grouping variable 2 (Factor2) treatments relative to the median of grouping variable 2 (Factor2) control.

# In this example we will use an example data set included in rootdetectR
my_dataset <- root_output

# check input data
is_root_output(my_dataset)

# remove measurements with length 0
my_dataset <- my_dataset[!my_dataset$LengthPx == 0, ]
# calculate LengthMM by length standard 10mm
# break up the label in 2 factors according to the delimiter (";")
my_dataset <- norm_10mm_standard(my_dataset)
# calculate relative data
my_dataset_rel <- rel_data(my_dataset, control = "20")
# calculate summary satistics
s_stat <- summary_stat(my_dataset)
# show summary statistics
s_stat

We will save all the created data as *.csv tables.

# save the created tables to working dir
write.csv(my_dataset, file = 'absolute_data.csv')
write.csv(my_dataset_rel, file = 'relative_data.csv')
write.csv(s_stat, file = 'summary_statistics.csv')

After normalizing and cleaning the data we can check the distribution and test for normality. Green histogram plots indicate a normal distribution tested by Shapiro-Wilk-test (p > 0.05).

plot_hist(my_dataset, draw_out = F)



histograms.pdf

rootdetectR can perform several ANOVA + Tukey post-hoc analysis and print the p-values as matrix plots in pdf files.

# One-way Anova over Factor1
ow_anova_factor1 <- onefacaov_fac1(my_dataset, draw_out = T)



1fac_ANOVA_factor1_20.pdf



1fac_ANOVA_factor1_28.pdf



# One-way Anova over Factor2 control treatment combinations
ow_anova_factor2 <- onefacaov_fac2(my_dataset, control = '20', draw_out = T)



1fac_ANOVA_factor2_28.pdf



# Two-Way ANOVA all vs all
tw_anova <- twofacaov(my_dataset, label_delim = ';', draw_out = T)



2fac_ANOVA_all_vs_all.pdf



# Two-Way ANOVA of Interaction Effect
tw_anova_interaction <- interaction_twofacaov(my_dataset, label_delim = ';', 
                                              control = '20', draw_out = T)




2fac_ANOVA_BH_corrected_20_vs_28.pdf



At least we will produce plots of absolute and relative data. Here only the standard plots are shown but there is a lot of customization possible. For more information check out the manual by typing ?plot_abs or ?plot_rel in your R console.

# plot absolute data as jitter plot
absolute_plot <- plot_abs(my_dataset,
  plot_significance = T, label_delim = ";",
  height_letter = 5, plot_colours = c("cornflowerblue", "indianred")
)
absolute_plot
# save absolute plot as pdf
pdf(absolute_plot.pdf)
absolute_plot
dev.off()
# plot relative data as jitter plot
relative_plot <- plot_rel(my_dataset,
  plot_significance = T,
  control = "20", size_jitter_dot = 3
)
relative_plot
# save relative plot as pdf
pdf(relative_plot.pdf)
relative_plot
dev.off()


PhilippJanitza/rootdetectR documentation built on Feb. 24, 2024, 6:46 a.m.