Skip to content

Commit 544ec7e

Browse files
authored
Merge pull request #131 from KrishnaswamyLab/dev
MAGIC v1.3.0
2 parents c18669a + e7eb1dc commit 544ec7e

File tree

19 files changed

+213
-527
lines changed

19 files changed

+213
-527
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ python/*.egg-info
2020
python/magic/__pycache__
2121
python/magic/*.pyc
2222
python/tutorial_notebooks/.ipynb_checkpoints
23+
__pycache__
24+
.eggs
25+
2326

2427
matlab/EMT.csv
2528

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The following code runs MAGIC on test data located in the MAGIC repository.
7676

7777
#### Tutorials
7878

79-
We have included two tutorial notebooks on MAGIC usage and results visualization for single cell RNA-seq data.
79+
You can read the MAGIC documentation at https://magic.readthedocs.io/. We have included two tutorial notebooks on MAGIC usage and results visualization for single cell RNA-seq data.
8080

8181
EMT data notebook: http://nbviewer.jupyter.org/github/KrishnaswamyLab/MAGIC/blob/master/python/tutorial_notebooks/emt_tutorial.ipynb
8282

@@ -134,7 +134,7 @@ After installing the package, MAGIC can be run by loading the library and callin
134134

135135
#### Tutorials
136136

137-
For a working example, see the Rmarkdown tutorials at <http://htmlpreview.github.io/?https://github.com/KrishnaswamyLab/MAGIC/blob/master/Rmagic/inst/examples/bonemarrow_tutorial.html> and <http://htmlpreview.github.io/?https://github.com/KrishnaswamyLab/MAGIC/blob/master/Rmagic/inst/examples/emt_tutorial.html> or in `Rmagic/inst/examples`.
137+
You can read the MAGIC tutorial by running `help(Rmagic::magic)`. For a working example, see the Rmarkdown tutorials at <http://htmlpreview.github.io/?https://github.com/KrishnaswamyLab/MAGIC/blob/master/Rmagic/inst/examples/bonemarrow_tutorial.html> and <http://htmlpreview.github.io/?https://github.com/KrishnaswamyLab/MAGIC/blob/master/Rmagic/inst/examples/emt_tutorial.html> or in `Rmagic/inst/examples`.
138138

139139
## Help
140140

Rmagic/DESCRIPTION

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
Package: Rmagic
22
Type: Package
33
Title: MAGIC - Markov Affinity-Based Graph Imputation of Cells
4-
Version: 1.0.0
4+
Version: 1.3.0
55
Authors@R: c(person(given = "David", family = "van Dijk", email = "[email protected]", role = c("aut")),
6-
person(given = 'Scott', family = 'Gigante', email = '[email protected]', role = 'cre', comment = c(ORCID = '0000-0002-4544-2764')))
6+
person(given = 'Scott', family = 'Gigante', email = '[email protected]', role = 'cre',
7+
comment = c(ORCID = '0000-0002-4544-2764')))
78
Maintainer: Scott Gigante <[email protected]>
89
Description: MAGIC (Markov affinity-based graph imputation of cells) is a method for addressing technical noise in single-cell data, including under-sampling of mRNA molecules, often termed "dropout" which can severely obscure important gene-gene relationships. MAGIC shares information across similar cells, via data diffusion, to denoise the cell count matrix and fill in missing transcripts. Read more: van Dijk et al. (2018) <DOI:10.1016/j.cell.2018.05.061>.
910
Depends:
@@ -15,9 +16,10 @@ Imports:
1516
reticulate (>= 1.4),
1617
ggplot2
1718
Suggests:
18-
readr,
19+
readr,
1920
viridis,
20-
phateR
21+
phateR
2122
License: GPL-2 | file LICENSE
2223
LazyData: true
23-
RoxygenNote: 6.0.1
24+
RoxygenNote: 6.1.0
25+
Encoding: UTF-8

Rmagic/R/magic.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#' @param seed int or `NULL`, random state (default: `NULL`)
4040
#'
4141
#' @examples
42-
#' if (reticulate::py_module_available("phate")) {
42+
#' if (reticulate::py_module_available("magic")) {
4343
#'
4444
#' data(magic_testdata)
4545
#'

Rmagic/R/utils.R

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,25 @@ null_equal <- function(x, y) {
1010
}
1111

1212
load_pymagic <- function(delay_load = FALSE) {
13-
result <- try(pymagic <<- reticulate::import("magic", delay_load = delay_load))
13+
if (is.null(pymagic)) {
14+
result <- try(pymagic <<- reticulate::import("magic", delay_load = delay_load))
15+
} else {
16+
result <- try(reticulate::import("magic", delay_load = delay_load))
17+
}
1418
if (methods::is(result, "try-error")) {
15-
install.magic()
19+
if ((!delay_load) && length(grep("ModuleNotFoundError: No module named 'magic'", result)) > 0 ||
20+
length(grep("ImportError: No module named magic", result)) > 0) {
21+
if (utils::menu(c("Yes", "No"), title="Install MAGIC Python package with reticulate?") == 1) {
22+
install.magic()
23+
}
24+
} else if (length(grep("r\\-reticulate", reticulate::py_config()$python)) > 0) {
25+
message("Consider removing the 'r-reticulate' environment by running:")
26+
if (grep("virtualenvs", reticulate::py_config()$python)) {
27+
message("reticulate::virtualenv_remove('r-reticulate')")
28+
} else {
29+
message("reticulate::conda_remove('r-reticulate')")
30+
}
31+
}
1632
}
1733
}
1834

@@ -44,6 +60,7 @@ install.magic <- function(envname = "r-reticulate", method = "auto",
4460
envname = envname, method = method,
4561
conda = conda, pip=pip, ...
4662
)
63+
message("Install complete. Please restart R and try again.")
4764
},
4865
error = function(e) {
4966
stop(paste0(
@@ -57,5 +74,6 @@ install.magic <- function(envname = "r-reticulate", method = "auto",
5774
pymagic <- NULL
5875

5976
.onLoad <- function(libname, pkgname) {
77+
py_config <- reticulate::py_discover_config(required_module = "magic")
6078
load_pymagic(delay_load = TRUE)
6179
}

Rmagic/README.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title : Rmagic v1.0.0
2+
title : Rmagic v1.3.0
33
output: github_document
44
toc: true
55
---
@@ -181,4 +181,4 @@ ggplot(data_PHATE) +
181181

182182
## Help
183183

184-
If you have any questions or require assistance using MAGIC, please contact us at <https://krishnaswamylab.org/get-help>.
184+
Please let us know of any issues at the [GitHub repo](https://github.com/KrishnaswamyLab/MAGIC/issues). If you have any questions or require assistance using MAGIC, please read the documentation by running `help(Rmagic::magic)` or contact us at <https://krishnaswamylab.org/get-help>.

Rmagic/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Rmagic v1.0.0
1+
Rmagic v1.3.0
22
================
33

44
<!-- README.md is generated from README.Rmd. Please edit that file -->
@@ -236,4 +236,7 @@ ggplot(data_PHATE) +
236236

237237
## Help
238238

239-
If you have any questions or require assistance using MAGIC, please contact us at <https://krishnaswamylab.org/get-help>.
239+
Please let us know of any issues at the [GitHub
240+
repo](https://github.com/KrishnaswamyLab/MAGIC/issues). If you have any
241+
questions or require assistance using MAGIC, please read the documentation
242+
by running `help(Rmagic::magic)` or contact us at <https://krishnaswamylab.org/get-help>.

Rmagic/man/install.magic.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rmagic/man/magic.Rd

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/doc/source/api.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,6 @@ MAGIC
99
:inherited-members:
1010
:show-inheritance:
1111

12-
File Input/Output
13-
-----------------
14-
15-
.. automodule:: magic.io
16-
:members:
17-
:inherited-members:
18-
:show-inheritance:
19-
20-
Data Preprocessing
21-
------------------
22-
23-
.. automodule:: magic.preprocessing
24-
:members:
25-
:inherited-members:
26-
:show-inheritance:
27-
2812
Plotting
2913
--------
3014

0 commit comments

Comments
 (0)