Glimma 2.0 is an interactive R widget for creating plots for differential expression analysis, created using the Vega and htmlwidgets frameworks. It's an update/reimplementation of Glimma 1.0! New features include:
- 🧬 multiple gene selections
- 📓 full integration with Quarto and R markdown
- 🎨 support for interactive switching between contrasts in limma-style objects
- 🖼 exporting plots to PNG/SVG/CSV formats
Available on Bioconductor.
Feedback is welcome, please feel free to open an issue for any enhancements you would like to see in future.
| Function | Example |
|---|---|
| glimmaMA: MA plot | |
| glimmaVolcano: Volcano plot | |
| glimmaMDS: Multidimensional scaling plot |
You can install the development version of GlimmaV2 using devtools from the R command line.
devtools::install_github("mritchielab/GlimmaV2")You now can interactively switch between multiple contrasts within limma style objects:
| Y-axis | Jitter |
|---|---|
You can fix the y-axis when switching between genes by specifying Y min and Y max values: |
Jitter can be interactively applied when samples are overlying each other: |
The default mapping between the status vector and color of the gene is given below:
-1 (downreg) => blue
0 (not DE) => silver
1 (upreg) => red
Accordingly, the default status.colours argument is c("dodgerblue", "silver", "firebrick"). If no status vector is provided, all genes are given a status value of 0. The colour mapping can be changed by varying the status.colours argument which must be a vector of three valid CSS strings (for example: #f304d3, #fff, rgb(253, 12, 134), steelblue):
glimmaMA(fit, dge=rnaseq, status.colours=c("#3977db","#3d3f42","#db0d4e"))glimmaVolcano(fit, dge=rnaseq, status.colours=c("blue", "darkgrey", "red"))glimmaXY(x=fit$coef, y=fit$lod, dge=rnaseq, status=dtFit, status.colours=c("cyan", "grey", "hotpink"))Gene symbol text will be displayed above selected points if there is a symbol column (case-insensitive) within the gene annotation supplied as per the example plots shown above. The gene annotation is the anno argument.
- for the glimmaVolcano and glimmaMA functions,
annodefaults tox$genesfor DGELRT/DGEExact and MArrayLM objects and defaults toNULLfor DESeqDataSet objects - see?glimmaMA,?glimmaVolcanofor further detail - for glimmaXY,
annois alwaysNULLby default
The scale_by dropdown menu contains numeric features provided the groups dataframe, while the shape_by dropdown contains discrete features provided by the groups dataframe. The colour_by dropdown contains discrete features by default but can be altered to take numeric features such as library size by setting continuous.colour=TRUE:
glimmaMDS(rnaseq, groups=groups, continuous.colour=TRUE)The test used to distinguish numeric vs discrete features in the groups dataframe is sapply(groups, is.numeric), so the appropriate coercions can be used toggle ambiguous features between numeric/discrete.
Specifying a filename using the html argument (including the extension) in any of the GlimmaV2 functions will export the widget to a standalone single HTML file, rather than displaying/returning the widget in R Markdown.
glimmaMA(fit, dge=rnaseq, html="MA_plot.html")If more flexibility is required (ex. varying the background colour, whether or not the file should be standalone), the user can call htmlwidgets::saveWidget() on instantiated widgets which has further options.
glMA <- glimmaMA(fit, dge=rnaseq)
htmlwidgets::saveWidget(glMA, file="glimmaV2Example.html")The width and height parameters can be adjusted to change the dimensions of the widget in pixels in the RStudio viewer and in knitted HTML:
glimmaMA(fit, dge=rnaseq, width=1200, height=1200)All GlimmaV2 functions take optional width/height arguments. The default glimmaMA/glimmaXY width and height are both 920px, so they should be modified in a 1:1 ratio if preserving the original scale is desired.