Skip to content

Commit

Permalink
Merge pull request #46 from KrishnaswamyLab/dev
Browse files Browse the repository at this point in the history
phateR v1.0.4
  • Loading branch information
scottgigante authored Jun 8, 2020
2 parents 15706f1 + 04c09bf commit e1946ef
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 21 deletions.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,17 @@ You can do this with `R -e 'reticulate::py_discover_config(required_module = "ph

</details>

Output of `phateR::check_pyphate_version()`:

<details>

```
Please run `phateR::check_pyphate_version()` and paste the results here.
You can do this with `R -e 'phateR::check_pyphate_version()'`
```

</details>

**Additional context**
Add any other context about the problem here.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.Rproj.user
.Rhistory
.RData
phateR_*.tar.gz

5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: phateR
Title: PHATE - Potential of Heat-Diffusion for Affinity-Based Transition Embedding
Version: 1.0.0.999
Version: 1.0.4
Authors@R: c(person("Krishnan", "Srinivasan", email = "[email protected]", role = c("aut")),
person(given = 'Scott', family = 'Gigante', email = '[email protected]', role = 'cre', comment = c(ORCID = '0000-0002-4544-2764')))
Description: PHATE is a tool for visualizing high dimensional single-cell data
Expand All @@ -21,7 +21,8 @@ Imports:
stats,
graphics,
reticulate (>= 1.8),
ggplot2
ggplot2,
memoise
Suggests:
gridGraphics,
cowplot
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export(library.size.normalize)
export(phate)
import(Matrix)
importFrom(ggplot2,ggplot)
importFrom(memoise,memoise)
importFrom(reticulate,py_discover_config)
importFrom(utils,packageVersion)
4 changes: 2 additions & 2 deletions R/phate.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ phate <- function(data, ndim = 2, knn = 5,
}
}
if (is.null(operator)) {
operator <- pyphate$PHATE(n_components = ndim,
operator <- pyphate()$PHATE(n_components = ndim,
knn = knn,
decay = decay,
t = t,
Expand All @@ -256,7 +256,7 @@ phate <- function(data, ndim = 2, knn = 5,
out <- operator$von_neumann_entropy(t_max = t.max)
t <- out[[1]]
h <- out[[2]]
t.opt <- pyphate$vne$find_knee_point(h, t)
t.opt <- pyphate()$vne$find_knee_point(h, t)
graphics::plot(t, h,
type = "l",
xlab = "t", ylab = "Von Neumann Entropy",
Expand Down
15 changes: 6 additions & 9 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,11 @@ failed_pyphate_import <- function(e) {
}

load_pyphate <- function() {
py_config <- try(reticulate::py_discover_config(required_module = "phate"))
delay_load = list(on_load=check_pyphate_version, on_error=failed_pyphate_import)
# load
if (is.null(pyphate)) {
# first time load
result <- try(pyphate <<- reticulate::import("phate", delay_load = delay_load))
} else {
# already loaded
result <- try(reticulate::import("phate", delay_load = delay_load))
}
pyphate <- try(reticulate::import("phate", delay_load = delay_load))
pyphate
}

#' Install PHATE Python Package
Expand Down Expand Up @@ -106,7 +102,8 @@ install.phate <- function(envname = "r-reticulate", method = "auto",

pyphate <- NULL

#' @importFrom reticulate py_discover_config
#' @importFrom memoise memoise
.onLoad <- function(libname, pkgname) {
py_config <- reticulate::py_discover_config(required_module = "phate")
load_pyphate()
pyphate <<- memoise::memoise(load_pyphate)
}
11 changes: 7 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ knitr::opts_chunk$set(
[![Twitter](https://img.shields.io/twitter/follow/KrishnaswamyLab.svg?style=social&label=Follow)](https://twitter.com/KrishnaswamyLab)
[![Github Stars](https://img.shields.io/github/stars/KrishnaswamyLab/PHATE.svg?style=social&label=Stars)](https://github.com/KrishnaswamyLab/PHATE/)

This R package provides an implementation of the
[PHATE dimensionality reduction and visualization method](https://www.biorxiv.org/content/early/2017/12/01/120378).
This R package provides an implementation of the [PHATE dimensionality reduction and visualization method](https://www.nature.com/articles/s41587-019-0336-3).

For a thorough overview of the PHATE visualization method, please see the [bioRxiv preprint](https://www.biorxiv.org/content/early/2017/12/01/120378)
For a thorough overview of the PHATE visualization method, please see the [Nature Biotechnology publication](https://www.nature.com/articles/s41587-019-0336-3).

For our Python and Matlab implementations, please see [KrishnaswamyLab/PHATE](https://github.com/KrishnaswamyLab/PHATE).

Expand Down Expand Up @@ -165,6 +164,10 @@ ggplot(tree.phate, aes(x=PHATE1, y=PHATE2, color=tree.data$branches)) +

To be consistent with common dimensionality reductions such as PCA (`stats::prcomp`) and t-SNE (`Rtsne::Rtsne`), we require that cells (observations) be rows and genes (features) be columns of your input data.

- **Can I run PHATE with Seurat?**

PHATE was removed from Seurat in version 3. You can install a version of Seurat with `RunPHATE` included by following the instructions at <https://github.com/satijalab/seurat/pull/1172#issuecomment-564782167>.

* **I have installed PHATE in Python, but phateR says it is not installed!**

Check your `reticulate::py_discover_config("phate")` and compare it to the version of Python in which you installed PHATE (run `which python` and `which pip` in a terminal.) Chances are `reticulate` can't find the right version of Python; you can fix this by adding the following line to your `~/.Renviron`:
Expand All @@ -175,5 +178,5 @@ You can read more about `Renviron` at <https://CRAN.R-project.org/package=startu

### Help

Please let us know of any issues at the [GitHub repository](https://github.com/KrishnaswamyLab/phateR/issues). If you have any questions or require assistance using PHATE, please read the documentation by running `help(phateR::phate)` or contact us at <https://krishnaswamylab.org/get-help>.
Please let us know of any issues at the [GitHub repository](https://github.com/KrishnaswamyLab/phateR/issues). If you have any questions or require assistance using PHATE, please read the documentation at <https://CRAN.R-project.org/package=phateR/phateR.pdf> or by running `help(phateR::phate)` or contact us at <https://krishnaswamylab.org/get-help>.

12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ Stars](https://img.shields.io/github/stars/KrishnaswamyLab/PHATE.svg?style=socia

This R package provides an implementation of the [PHATE dimensionality
reduction and visualization
method](https://www.biorxiv.org/content/early/2017/12/01/120378).
method](https://www.nature.com/articles/s41587-019-0336-3).

For a thorough overview of the PHATE visualization method, please see
the [bioRxiv
preprint](https://www.biorxiv.org/content/early/2017/12/01/120378)
the [Nature Biotechnology publication](https://www.nature.com/articles/s41587-019-0336-3).

For our Python and Matlab implementations, please see
[KrishnaswamyLab/PHATE](https://github.com/KrishnaswamyLab/PHATE).
Expand Down Expand Up @@ -203,6 +202,10 @@ To be consistent with common dimensionality reductions such as PCA
(observations) be rows and genes (features) be columns of your input
data.

- **Can I run PHATE with Seurat?**

PHATE was removed from Seurat in version 3. You can install a version of Seurat with `RunPHATE` included by following the instructions at <https://github.com/satijalab/seurat/pull/1172#issuecomment-564782167>.

- **I have installed PHATE in Python, but phateR says it is not
installed\!**

Expand All @@ -222,5 +225,6 @@ You can read more about `Renviron` at
Please let us know of any issues at the [GitHub
repository](https://github.com/KrishnaswamyLab/phateR/issues). If you
have any questions or require assistance using PHATE, please read the
documentation by running `help(phateR::phate)` or contact us at
documentation at <https://CRAN.R-project.org/package=phateR/phateR.pdf>
or by running `help(phateR::phate)` or contact us at
<https://krishnaswamylab.org/get-help>.

0 comments on commit e1946ef

Please sign in to comment.