R Package

Installation

Prerequisites

R wrapper for ivis is provided via the reticulate library. Prior to installation, ensure that reticulate is available on your machine.

install.packages("reticulate")

Next, install virtualenv as it will be used to safely interface with the ivis Python package.

Note

Windows Installation. Note that virtual environment functions in the reticulate library are not supported on Windows. Instead, conda environment is recommended.

Finally, the easiest way to install ivis is using the devtools package:

Running install

devtools::install_github("beringresearch/ivis/R-package")
library(ivis)
install_ivis()

After ivis is installed, restart your R session.

Note

Newer versions of Keras use tensorflow as the default backend, however if for some reason this isn’t the case, add the following line to your environment variables:

export KERAS_BACKEND=tensorflow

Quickstart

library(ivis)
library(ggplot2)

model <- ivis(k = 3)

X <- data.matrix(iris[, 1:4])
X <- scale(X)
model <- model$fit(X)

xy <- model$transform(X)

dat <- data.frame(x=xy[,1], y=xy[,2], species=iris$Species)

ggplot(dat, aes(x=x, y=y)) + geom_point(aes(color=species)) + theme_classic()

Vignette

The ivis package includes a vignette that demonstrates an example workflow using single-cell RNA-sequencing data.

To compile and install this vignette on your system, you need to first have a working installation of ivis. For this, please follow the instructions above.

Once you have a working installation of ivis, you can reinstall the package including the compiled vignette using the following command:

devtools::install_github("beringresearch/ivis/R-package", build_vignettes = TRUE, force=TRUE)