In this vignette we present the basic features of Glimma. Glimma is an interactive R widget for creating plots for differential expression analysis, created using the Vega and htmlwidgets frameworks. The created plots can be embedded in R Markdown, or exported as standalone HTML documents. The data presented here is slightly modified from the RNAseq123 workflow with only a single contrast has been performed for simplicity. Here we use DESeq2 to fit the model.
To begin, the DGEList object from the workflow has been included with the package as internal data. We will convert this to a DESeq data object.
The multidimensional scaling (MDS) plot is frequently used to explore differences in samples. When data has been MDS transformed, the first two dimensions explain the greatest variance between samples, and the amount of variance decreases monotonically with increasing dimension.
The Glimma MDS contains two main components:
The Glimma MDS allows different dimensions to be plotted against each other, with the proportion of variability explained by each dimension highlighted in the barplot alongside it. The interactive MDS plot can be created simply with a single argument for a DESeqDataSet object. The points in the MDS plot can have their size, colour and shape changed based on the information that is stored in the colData of the DESeqDataSet.
In the plot above, try:
Some helpful customisations to the plot include:
glimmaMDS(dds, width=1200, height=1200)
, which will adjust the dimensions in pixels of the created widget - default width and height is 920px.glimmaMDS(dds, continuous.color=TRUE)
, which specifies that continuous colour schemes should be used - useful for when a large number of differential selections are required.glimmaMDS(dds, groups=[vector or data frame])
, which allows changing the associated sample information such as experimental groups - this information is displayed in mouseover tooltips and can be used to adjust the plot using scale_by
, colour_by
and shape_by
.The MA plot is a visualisation that plots the log-fold-change between experimental groups (M) against the mean expression across all the samples (A) for each gene.
The Glimma MA plot contains two main components:
The second plot shows gene expression from the last selected sample, which can be selected from the table or directly from the summary plot.
To create the MA plot we first need to run differential expression (DE) analysis for our data using the DESeq
function.
The MA plot can then be created using the dds
object that now contains fitted results.
In the plot above, try:
Some customisations to the plot include:
glimmaMA(dds, width=1200, height=1200)
, which will adjust the dimensions in pixels of the created widget
glimmaMA(dds, continuous.color=TRUE)
, which specifies that continuous colour schemes should be used
glimmaMA(dds, groups=[vector or data frame])
, which allows changing the associated sample information such as experimental groups
glimmaMA(dds, status.cols=c("powderblue", "seashell", "salmon")
, which customises the colours associated with the status of each gene
glimmaMA(dds, sample.cols=colours)
, which colours each sample based on the character vector of valid CSS colour strings colours
ncol(dge$counts)
or ncol(counts)
if specified.The plots created are automatically embedded into Rmarkdown reports, but having many interactive plots can significantly slow down the page. It is instead recommended to save the plots using htmlwidgets::saveWidget
and linking to it via markdown hyperlinks.
sessionInfo()
#> R version 4.1.0 (2021-05-18)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.2 LTS
#>
#> Matrix products: default
#> BLAS: /home/biocbuild/bbs-3.13-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.13-bioc/R/lib/libRlapack.so
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_GB LC_COLLATE=C
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] parallel stats4 stats graphics grDevices utils datasets
#> [8] methods base
#>
#> other attached packages:
#> [1] DESeq2_1.32.0 SummarizedExperiment_1.22.0
#> [3] Biobase_2.52.0 MatrixGenerics_1.4.0
#> [5] matrixStats_0.58.0 GenomicRanges_1.44.0
#> [7] GenomeInfoDb_1.28.0 IRanges_2.26.0
#> [9] S4Vectors_0.30.0 BiocGenerics_0.38.0
#> [11] edgeR_3.34.0 limma_3.48.0
#> [13] Glimma_2.2.0
#>
#> loaded via a namespace (and not attached):
#> [1] httr_1.4.2 sass_0.4.0 bit64_4.0.5
#> [4] jsonlite_1.7.2 splines_4.1.0 bslib_0.2.5.1
#> [7] assertthat_0.2.1 blob_1.2.1 GenomeInfoDbData_1.2.6
#> [10] yaml_2.2.1 pillar_1.6.1 RSQLite_2.2.7
#> [13] lattice_0.20-44 glue_1.4.2 digest_0.6.27
#> [16] RColorBrewer_1.1-2 XVector_0.32.0 colorspace_2.0-1
#> [19] htmltools_0.5.1.1 Matrix_1.3-3 pkgconfig_2.0.3
#> [22] XML_3.99-0.6 genefilter_1.74.0 zlibbioc_1.38.0
#> [25] purrr_0.3.4 xtable_1.8-4 scales_1.1.1
#> [28] BiocParallel_1.26.0 tibble_3.1.2 annotate_1.70.0
#> [31] KEGGREST_1.32.0 generics_0.1.0 ggplot2_3.3.3
#> [34] ellipsis_0.3.2 cachem_1.0.5 survival_3.2-11
#> [37] magrittr_2.0.1 crayon_1.4.1 memoise_2.0.0
#> [40] evaluate_0.14 fansi_0.4.2 tools_4.1.0
#> [43] lifecycle_1.0.0 stringr_1.4.0 locfit_1.5-9.4
#> [46] munsell_0.5.0 DelayedArray_0.18.0 AnnotationDbi_1.54.0
#> [49] Biostrings_2.60.0 compiler_4.1.0 jquerylib_0.1.4
#> [52] rlang_0.4.11 grid_4.1.0 RCurl_1.98-1.3
#> [55] htmlwidgets_1.5.3 bitops_1.0-7 rmarkdown_2.8
#> [58] gtable_0.3.0 DBI_1.1.1 R6_2.5.0
#> [61] dplyr_1.0.6 knitr_1.33 utf8_1.2.1
#> [64] fastmap_1.1.0 bit_4.0.4 stringi_1.6.2
#> [67] Rcpp_1.0.6 vctrs_0.3.8 geneplotter_1.70.0
#> [70] png_0.1-7 tidyselect_1.1.1 xfun_0.23