library("Ramf") library("BiocStyle")
The package is meant to help scientists to compute the degree of arbuscular mycorrhizal colonization, producing tables, robust statistics and different kind of plots.
All the functions of the package work independently of the colonization scoring system.
The data should be provided in a csv table like the follow one:
| samples | replicates | Total | Hyphopodia | IntrHyphae | Arbuscule | Vesicle | |:---------:|:----------:|:-----:|:----------:|:----------:|:---------:|:-------:| | WT | A | 30 | 3 | 30 | 30 | 10 | | WT | A | 24 | 5 | 24 | 24 | 7 | | WT | B | 20 | 2 | 20 | 20 | 5 | | WT | B | 15 | 2 | 15 | 15 | 3 | | cyclops-3 | A | 18 | 6 | 18 | 9 | 0 | | cyclops-3 | A | 16 | 10 | 10 | 0 | 0 | | cyclops-3 | B | 20 | 12 | 20 | 0 | 0 | | cyclops-3 | B | 14 | 4 | 14 | 0 | 0 | | ... | ... | ... | ... | ... | ... | ... |
The table contains:
7 columns with specific headers
The first 2 columns (samples and replicates) must be present
The last 5 columns (Total, Hyphopodia, IntHyphae, Arbuscule and Vesicle) could not be all present
If the headers are not the same of the ones in the example table the software will not be able to read the table
As many row as you need
The first element of column "samples" will be used as control for the statistical analysis (in this example "WT" will be used as control)
| samples | replicates | scoring | |:-------:|:----------:|:-------:| | Lys11 | A | 1A3 | | Lys11 | A | 5A3 | | Lys11 | A | 0A0 | | Lys11 | B | 3A2 | | Lys11 | B | 3A3 | | Lys11 | B | 4A3 | | GiFu | A | 0A0 | | GiFu | A | 0A0 | | GiFu | A | 1A3 | | GiFu | B | 3A3 | | GiFu | B | 0A0 | | GiFu | B | 0A0 | | ... | ... | ... |
To load data in, use the follow command:
readData(file.csv, type = c("grid", "trouvelot"))
# Grid f <- dir(system.file("extdata", package = "Ramf"), full.names = TRUE, pattern = "grid.csv") gr <- readData(f, type = "grid") # Grid incomplete f <- dir(system.file("extdata", package = "Ramf"), full.names = TRUE, pattern = "grid_incomplete.csv") gri <- readData(f, type = "grid") # Trouvelot f <- dir(system.file("extdata", package = "Ramf"), full.names = TRUE, pattern = "trouvelot.csv") tr <- readData(f, type = "trouvelot")
It is very important the order of the samples in the csv file. The first sample will be considered the control.
To summarise the data and export the scoring results in a tabular format use the follow command:
am_summary
grs <- am_summary(gr) gris <- am_summary(gri) trs <- am_summary(tr) grs gris trs
The statistical analysis is performed using the kruskal
function from agricolae
package.
To read more about the statatical framework, refer to this link.
am_stat
grst <- am_stat(gr) grist <- am_stat(gri) trst <- am_stat(tr) grst grist trst
By default, the correction method is "none", but it is possible to select between: Bonferroni, Holm, Hochberg, Bonferroni, Benjamini-Hochberg, Benjamini-Yekutieli or fdr adjustment. For more details refer to agricolae package.
am_stat(gr, method = "BH") am_stat(gri, method = "BH") am_stat(tr, method = "fdr")
To summarise the data in a graphical way the package provide 3 plot types:
am_barplot am_barplo2
am_boxplot am_boxplot2
am_dotplot am_dotplot2
It is possible to plot a simple plot.
am_barplot(gr) am_boxplot(gr) am_dotplot(gr) am_barplot(tr) am_boxplot(tr) am_dotplot(tr) am_barplot2(gr) am_boxplot2(gr) am_dotplot2(gr) am_barplot2(tr) am_boxplot2(tr) am_dotplot2(tr)
The plot fuctions take a set of option to customize your plot.
am_barplot(gr)
The plot can use different color palettes. We advise to use Colorbrewer or Colorgorical.
am_barplot(gr, cbPalette = c('#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696')) am_dotplot(gr, cbPalette = rep("black", 4)) am_barplot(gr, cbPalette = c('#ca0020', '#f4a582', '#92c5de', '#0571b0')) am_boxplot(gr, cbPalette = c("#b4ddd4", "#02531d", "#34debb", "#d10f55")) am_barplot(gri, cbPalette = c('#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696')) am_dotplot(gri, cbPalette = rep("black", 4)) am_barplot(gri, cbPalette = c('#ca0020', '#f4a582', '#92c5de', '#0571b0')) am_boxplot(gri, cbPalette = c("#b4ddd4", "#02531d", "#34debb", "#d10f55"))
The title of the plot can be changed
am_barplot(gr, main = "Grid plot") am_barplot(gri, main = "Grid incomplete plot") am_barplot(tr, main = "Trouvelot plot")
The plotting system is based on ggplot2, so is possible to change some parameters
library(ggplot2) am_barplot(gr, main = "Grid plot") + theme(plot.title = element_text(hjust = .5)) am_barplot(tr, main = "Trouvelot plot") + theme(plot.title = element_text(hjust = 1)) am_barplot(gr, main = "Grid plot") + theme(panel.grid.major.y = element_line(size = 3, colour = "grey80")) am_barplot(gr, main = "Grid plot") + theme(text=element_text(family="Avenir")) am_barplot(gr, main = "Grid plot") + theme(axis.text = element_text(size = 18))
It is also possible to include the statistical results under the plot with the appropriate alpha
am_barplot(gr, annot = "asterisks", alpha = 0.05) am_barplot(gri, annot = "asterisks", alpha = 0.05) am_dotplot(tr, annot = "asterisks", alpha = 0.01) am_boxplot(tr, annot = "asterisks", alpha = 0.01)
The asterisks above the plot show which sample is significant different from the control. The control is always the first element of the list.
It is also possible to include the statistical correction for the pvalues.
am_barplot(gr, annot = "asterisks", method = "BH")
The asterisks allow to grafically dispay the statistical difference between the control sample and the other samples. If you want show the statistical difference between all the samples, you can add "letters" to the plot. Letters group the samples accordingly to they statistical difference.
am_barplot(gr, annot = "letters", alpha = 0.05) am_barplot(gri, annot = "letters", alpha = 0.05) am_dotplot(tr, annot = "letters", alpha = 0.01)
To export the data, a "save data" function is provided.
Summary data: the function exports both the summary per replicate and the summary per sample in two distinct csv files.
Statistical data: the function exports a csv file
Plots: the function exports the plots and useful options can be used to export a pubblication ready image.
# Save the summary am_save(grs) # Two files will be saved: Summary_per_Replicate.csv and Summary_per_Sample.csv am_save(trs, "Trouvelot") # Two files will be saved: Trouvelot_per_Replicate.csv and Trouvelot_per_Sample.csv # Save the statisticas am_save(am_stat(gr)) # One file called Summary_Stat.csv will be saved am_save(am_stat(tr, method = "BH"), "Trouvelot") # One file called Trouvelot_stat.csv will be saved # Save the plots am_save(am_barplot(gr), "barplor_grid.pdf") p1 <- am_barplot(gr, cbPalette = c('#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696'), main = "Trouvelot", annot = "letters", method = "BH") am_save(p1, "dotplor_trouvelot.pdf", width = 21, height = 21, units = "cm", dpi = 300) # Save jpg plot am_save(p1, "dotplor_trouvelot.jpg")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.