PHATE is a tool for visualizing high dimensional single-cell data with natural progressions or trajectories. PHATE uses a novel conceptual framework for learning and visualizing the manifold inherent to biological systems in which smooth transitions mark the progressions of cells from one state to another. To see how PHATE can be applied to single-cell RNA-seq datasets from hematopoietic stem cells, human embryonic stem cells, and bone marrow samples, check out our preprint on bioRxiv at < http://biorxiv.org/content/early/2017/03/24/120378>.
This R package provides an implementation of the PHATE dimensionality reduction and visualization method.
For a thorough overview of the PHATE visualization method, please see the bioRxiv preprint
For our Python and Matlab implementations, please see KrishnaswamyLab/PHATE.
In order to use PHATE in R, you must also install the Python package.
pip are not installed, you will need to install them.
We recommend Miniconda3 to install
pip together, or otherwise you can install
phateR from CRAN by running the following code in R:
phate in Python by running the following code from a terminal:
pip install --user phate
The development version of PHATE can be installed directly from R with
if (!suppressWarnings(require(devtools))) install.packages("devtools")devtools::install_github("KrishnaswamyLab/phateR")
If you have the development version of
reticulate, you can also
phate in Python by running the following code in R:
The latest source version of PHATE can be accessed by running the following in a terminal:
git clone --recursive git://github.com/KrishnaswamyLab/PHATE.gitcd PHATE/phateRR CMD INSTALLcd ../Pythonpython setup.py install --user
phateR folder is empty, you have may forgotten to use the
--recursive option for
git clone. You can rectify this by running
the following in a terminal:
cd PHATEgit submodule initgit submodule updatecd phateRR CMD INSTALLcd ../Pythonpython setup.py install --user
This is a basic example running
phate on a highly branched example
dataset that is included with the package. You can read a tutorial on
running PHATE on single-cell RNA-seq at
First, let’s load the tree data and examine it with PCA.
library(phateR)#> Loading required package: Matrixdata(tree.data)plot(prcomp(tree.data$data)$x, col=tree.data$branches)
Now we run PHATE on the data. We’ll just go ahead and try with the default parameters.
# runs phatetree.phate <- phate(tree.data$data)summary(tree.phate)#> PHATE embedding#> k = 5, alpha = 40, t = auto#> Data: (3000, 100)#> Embedding: (3000, 2)
Let’s plot the results.
# plot embeddingpalette(rainbow(10))plot(tree.phate, col = tree.data$branches)
Good news! Our branches separate nicely. However, most of the
interesting activity seems to be concentrated into one region of the
plot - in this case we should try the square root potential instead by
gamma=0. We can also try increasing
t to make the structure a
little clearer - in this case, because synthetic data in unusually
structured, we can use a very large value, like 120, but in biological
data the automatic
t selection is generally very close to ideal. Note
here that if we pass our previous result in with the argument
won’t have to recompute the diffusion operator.
# runs phate with different parameterstree.phate <- phate(tree.data$data, gamma=0, t=120, init=tree.phate)# plot embeddingpalette(rainbow(10))plot(tree.phate, col = tree.data$branches)
We can also pass the PHATE object directly to
ggplot, if it is
library(ggplot2)#> Warning: package 'ggplot2' was built under R version 3.5.1ggplot(tree.phate, aes(x=PHATE1, y=PHATE2, color=tree.data$branches)) +geom_point()
Please let us know of any issues at the GitHub
repo. If you have any
questions or require assistance using PHATE, please read the documentation
help(phateR::phate) or contact us at