knitr::opts_chunk$set( #collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of interactmapper is to make analyzing dimension reduction plots more intuitive and user-friendly, by allowing users to overlay features of interest of the dataset onto the plot via color
You can install the released version of interactmapper from CRAN with:
install.packages("interactmapper")
And the development version from GitHub with:
# install.packages("devtools") devtools::install_github("octaviamd/interactmapper")
Here is a walkthrough of how to use the different functions in the interactmapper package. For greater ease, the iris
dataset will be used to show how the functions can be used. Illustrative gifs showing the kinds of interactive plots that can be generated will be provided soon!
The interact_qual
function is best suited to represent qualitative features of your data (ex: race/ethnicity of patients, smoker status, treatment groups, cell types, etc...). In the example below, the dimension reduction method UMAP
is applied to the iris
dataset, which is plotted and color coded based on iris$Species
, representing the Species of each iris represented in the dataset. Upon mouse hover, the qualitative feature of interest is presented in a text box, as well as the sample name.
library(interactmapper) #interactmapper::interact_qual(iris[,1:4], iris$Species, "UMAP")
The plot generated by interact_qual
also has a helpful side-bar that displays all of the variant options of your qualitative feature of interest, and allows you to select which variant(s) you want represented on your plot. By clicking on the feature option names, you can either show or hide the points associated with those features. In the UMAP plot below, setosa and versicolor have been hidden in order to have a better look at the virginica irises.
Here is an example of applying PCA instead of UMAP to the same data, looking at the same feature, iris$Species
.
#interactmapper::interact_qual(iris[,1:4], iris$Species, "PCA")
The interact_quant
function is used to represent features that are quantitative in nature (gene expression, DNA methylation, height, etc...).
#interact_quant(iris[,1:4], "Petal Width", iris[,4], "UMAP")
Below you can see an example of the interact_quant function being applied to color the datapoints of the plot based on the feature of interest, the petal width of the irises. Upon hovering over a point, a pop-up box displaying the Sample Name and the feature of interest appears.
The color palette used can be chosen from a range of available palettes from the package colourvalues displayed below based on your preferences to best suit your data and how to display it:
The default palette option is "matlablike_2". Here is the same plot, only with the palette "viridis".
#interactmapper::interact_quant(iris[,1:4], "Petal Width", iris[,4], "UMAP", "viridis")
You’ll still need to render README.Rmd
regularly, to keep README.md
up-to-date.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.