I am pleased to present volcano3D, an R package which is now available on CRAN! The volcano3D package enables exploration of probes differentially expressed between three groups. Its main purpose is for the visualisation of differentially expressed genes in a three-dimensional volcano plot. These plots can be converted to interactive visualisations using plotly:
Here I will explore a case study from the PEAC rheumatoid arthritis trial (Pathobiology of Early Arthritis Cohort). The methodology has been published in Lewis, Myles J., et al. Molecular portraits of early rheumatoid arthritis identify clinical and treatment response phenotypes. Cell reports 28.9 (2019): 2455–2470. (DOI: 10.1016/j.celrep.2019.07.091) with an accompanying interactive website available at https://peac.hpc.qmul.ac.uk:
This tool acts as a searchable interface to examine relationships between individual synovial and blood gene transcript levels and histological, clinical, and radiographic parameters, and clinical response at 6 months. An interactive interface allows the gene module analysis to be explored for relationships between modules and clinical parameters. The PEAC interactive web tool was creating as an R Shiny app and deployed to the web using a server.
Getting Started
Prerequisites
Install from CRAN
install.packages("volcano3D")
library(volcano3D)
Install from Github
library(devtools)
install_github("KatrionaGoldmann/volcano3D")
library(volcano3D)
volcano3D data
The sample data can then also be installed either from source or using:
install_github("KatrionaGoldmann/volcano3Ddata")
library(volcano3Ddata)
data("syn_data")
Samples in this cohort fall into three pathotype groups:
table(syn_metadata$Pathotype)
╔═══════════╦═══════╗
║ Pathotype ║ Count ║
╠═══════════╬═══════╣
║ Fibroid ║ 16 ║
║ Lymphoid ║ 45 ║
║ Myeloid ║ 20 ║
╚═══════════╩═══════╝
In this example we are interested in genes that are differentially expressed between each of these groups.
First we will map the expression data to cartesian coordinates, using the polar_coords function. This calculates x and y from the mean scaled z-score, Z, for each group:
and then converts to polar coordinates by:
This function uses inputs:
For more information on how to create these p-value data frames see the pvalue generator vignette. The polar_coords function is implemented by:
syn_polar <- polar_coords(sampledata = syn_metadata,
contrast = "Pathotype",
pvalues = syn_pvalues,
expression = syn_rld,
p_col_suffix = "pvalue",
padj_col_suffix = "padj",
fc_col_suffix = "log2FoldChange",
multi_group_prefix = "LRT",
non_sig_name = "Not Significant",
significance_cutoff = 0.01,
label_column = NULL,
fc_cutoff = 0.1)
and outputs an S4 polar class object with slots for: sampledata, contrast, pvalues, multi_group_test, expression, polar and non_sig_name. The pvalues slot which should have a data frame with at least two statistics for each comparison – p-value and adjusted p-value – and an optional logarithmic fold change statistic.
If there is a fold change column previously provided, we can now investigate the comparisons between pathotypes using the volcano_trio function. This creates three ggplot outputs:
syn_plots <-
volcano_trio(
polar = syn_polar,
sig_names = c("not significant","significant",
"not significant","significant"),
colours = rep(c("grey60", "slateblue1"), 2),
text_size = 9,
marker_size=1,
shared_legend_size = 0.9,
label_rows = c("SLAMF6", "PARP16", "ITM2C"),
fc_line = FALSE,
share_axes = FALSE)
syn_plots$All
Radial Plots
The differential expression can now be visualised on an interactive radar plot using radial_plotly. The labelRows
variable allows any markers of interest to be labelled.
radial_plotly(polar = syn_polar,
label_rows = c("SLAMF6", "PARP16", "ITM2C"))
By hovering over certain points you can also determine genes for future interrogation.
Similarly we can create a static ggplot image using radial_ggplot:
radial_ggplot(polar = syn_polar,
label_rows = c("SLAMF6", "FMOD"),
marker_size = 2.3,
legend_size = 10) +
theme(legend.position = "right")
Boxplots
We can then interrogate any one specific variable as a boxplot, to investigate these differences. This is built using either ggplot2 or plotly so can easily be edited by the user to add features.
plot1 <- boxplot_trio(syn_polar,
value = "FAM92B",
text_size = 7,
test = "polar_padj",
levels_order = c("Lymphoid", "Myeloid", "Fibroid"),
box_colours = c("blue", "red", "green3"),
step_increase = 0.1)
plot2 <- boxplot_trio(syn_polar,
value = "SLAMF6",
text_size = 7,
test = "polar_multi_padj",
levels_order = c("Lymphoid", "Myeloid", "Fibroid"),
box_colours = c("blue", "red", "green3"))
plot3 <- boxplot_trio(syn_polar,
value = "PARP16",
text_size = 7,
stat_size=2.5,
test = "t.test",
levels_order = c("Myeloid", "Fibroid"),
box_colours = c("pink", "gold"))
ggarrange(plot1, plot2, plot3, ncol=3)
Three Dimensional Volcano Plots
The final thing we can look at is the 3D volcano plot which projects differential gene expression onto cylindrical coordinates.
p <- volcano3D(syn_polar,
label_rows = c("SLAMF6", "PARP16", "ITM2C"),
label_size = 10,
colour_code_labels = F,
label_colour = "black",
xy_aspectratio = 1,
z_aspectratio = 0.9,
plot_height = 800)
p
There are also supplementary vignettes for further information on:
- setting up the input pvalues data frame
- using the volcano3D package to create and deploy a shiny app
References
If you use this package please cite as:
citation("volcano3D")
##
## To cite package 'volcano3D' in publications use:
##
## Katriona Goldmann and Myles Lewis (2020). volcano3D: Interactive
## Plotting of Three-Way Differential Expression Analysis.
## https://katrionagoldmann.github.io/volcano3D/index.html,
## https://github.com/KatrionaGoldmann/volcano3D.
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {volcano3D: Interactive Plotting of Three-Way Differential Expression
## Analysis},
## author = {Katriona Goldmann and Myles Lewis},
## year = {2020},
## note = {https://katrionagoldmann.github.io/volcano3D/index.html,
## https://github.com/KatrionaGoldmann/volcano3D},
## }
or:
Lewis, Myles J., et al. Molecular portraits of early rheumatoid arthritis identify clinical and treatment response phenotypes. Cell reports 28.9 (2019): 2455–2470.
Links
The source code can be found at: KatrionaGoldmann/volcano3D
To report a bugs or make suggestions visit: volcano3D/issues
Download from CRAN
For similar R posts visit r-bloggers
Developers
volcano3D was developed by the Bioinformatics team from the Experimental Medicine & Rheumatology department and Centre for Translational Bioinformatics at Queen Mary University London:
Thanks for reading, I hope you enjoy!