Interactive differential expression analysis with volcano3D

[This article was first published on Stories by Katriona Goldmann on Medium, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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:

Gif showing interactive volcano3D plot

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:

PEAC RNAseq Shiny website
PEAC RNAseq website hosted using R Shiny and featuring volcano3D plots

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 set up a polar object, using the polar_coords function, which maps the expression and p-values to polar coordinates using:

For more information on how to create p-values data frames see the pvalue generator vignette.

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)

This creates a 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
volcano plots for each comparison
volcano plots showing differential expression for each comparison

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"))
Gif of interactive radial plot showing the differential expression of probes between all three groups.
Interactive radial plot showing the differential expression of probes between all three groups.

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")
Using ggplot2 for a static radial plot

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)
Boxplots showing the differential expression for a specific probe or gene

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
Interactive volcano3D showing differential expression between points

There are also supplementary vignettes for further information on:

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

???? r-bloggers (r-blogger link not yet live, to be updated soon)

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! ????


Interactive differential expression analysis with volcano3D was originally published in Towards Data Science on Medium, where people are continuing the conversation by highlighting and responding to this story.

To leave a comment for the author, please follow the link and comment on their blog: Stories by Katriona Goldmann on Medium.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)