Skip to content

Commit e88d508

Browse files
authored
Merge pull request #116 from KrishnaswamyLab/dev
MAGIC v1.1: bugfixes and CRAN release
2 parents f69df20 + f3cccbd commit e88d508

57 files changed

Lines changed: 1364 additions & 1069 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

-10 KB
Binary file not shown.

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
.Rhistory
66
.RData
77
.Ruserdata
8-
.Rbuildignore
98

109
# R installation files
1110

@@ -20,5 +19,10 @@ python/*.dll
2019
python/*.egg-info
2120
python/magic/__pycache__
2221
python/magic/*.pyc
23-
.DS_Store
2422
matlab/EMT.csv
23+
24+
# Mac detritus
25+
26+
*~
27+
~$*
28+
.DS_Store

.travis.yml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
language: r
44
sudo: required
5-
cache: packages
65

76
os:
87
- linux
@@ -12,35 +11,29 @@ r:
1211
- release
1312
- devel
1413

15-
cache: packages
16-
1714
env:
1815
global:
1916
- PATH="$HOME/miniconda2/bin:$HOME/miniconda3/bin:$PATH"
2017
- RETICULATE_PYTHON="$HOME/miniconda2/bin/python"
2118

2219
before_install:
23-
- chmod +x travis_setup.sh
24-
- ./travis_setup.sh
25-
- $HOME/miniconda2/bin/pip install --user phate nose2
26-
- $HOME/miniconda3/bin/pip install --user phate nose2
27-
- R -e "install.packages(c('reticulate', 'devtools', 'readr', 'phateR', 'Matrix', 'ggplot2', 'viridis'))"
20+
- chmod +x travis_setup.sh; ./travis_setup.sh
21+
- $HOME/miniconda2/bin/pip install -q phate
22+
- $HOME/miniconda3/bin/pip install -q phate
23+
- R -e "install.packages(c('reticulate', 'devtools', 'readr', 'phateR', 'Matrix', 'ggplot2', 'viridis'), quiet=TRUE)"
2824

2925
install:
30-
- cd python
31-
- python2 setup.py install --user
32-
- python3 setup.py install --user
33-
- cd ../Rmagic
34-
- R CMD INSTALL .
35-
- cd ..
26+
- cd python; $HOME/miniconda2/bin/pip install -q .
27+
- $HOME/miniconda3/bin/pip install -q .
28+
- cd ../Rmagic; R CMD INSTALL .; cd ..
3629

3730
script:
38-
- cd Rmagic
39-
- R CMD build .
31+
- cd Rmagic; R CMD build .
4032
- travis_wait 30 R CMD check *tar.gz
41-
- cd ../python
33+
- cd ../python; $HOME/miniconda2/bin/pip install -q .[test,doc]
34+
- $HOME/miniconda3/bin/pip install -q .[test,doc]
4235
- python2 setup.py test
4336
- python3 setup.py test
44-
- cd ..
37+
- cd doc; make html
4538

4639
warnings_are_errors: true

README.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
Markov Affinity-based Graph Imputation of Cells (MAGIC)
22
-------------------------------------------------------
33

4+
[![Latest CRAN version](https://img.shields.io/cran/v/Rmagic.svg)](https://cran.r-project.org/package=Rmagic)
45
[![Travis CI Build](https://api.travis-ci.com/KrishnaswamyLab/MAGIC.svg?branch=master)](https://travis-ci.com/KrishnaswamyLab/MAGIC)
56
[![Read the Docs](https://img.shields.io/readthedocs/magic.svg)](https://magic.readthedocs.io/)
67
[![Cell Publication DOI](https://zenodo.org/badge/DOI/10.1016/j.cell.2018.05.061.svg)](https://www.cell.com/cell/abstract/S0092-8674(18)30724-4)
78
[![Twitter](https://img.shields.io/twitter/follow/KrishnaswamyLab.svg?style=social&label=Follow)](https://twitter.com/KrishnaswamyLab)
89
[![Github Stars](https://img.shields.io/github/stars/KrishnaswamyLab/MAGIC.svg?style=social&label=Stars)](https://github.com/KrishnaswamyLab/MAGIC/)
910

10-
Markov Affinity-based Graph Imputation of Cells (MAGIC) is an algorithm for denoising and transcript recover of single cells applied to single-cell RNA sequencing data, as described in Van Dijk D *et al.* (2018), *Recovering Gene Interactions from Single-Cell Data Using Data Diffusion*, Cell <https://www.cell.com/cell/abstract/S0092-8674(18)30724-4>.
11+
Markov Affinity-based Graph Imputation of Cells (MAGIC) is an algorithm for denoising and imputation of single cells applied to single-cell RNA sequencing data, as described in Van Dijk D *et al.* (2018), *Recovering Gene Interactions from Single-Cell Data Using Data Diffusion*, Cell <https://www.cell.com/cell/abstract/S0092-8674(18)30724-4>.
1112

1213
MAGIC has been implemented in Python, Matlab, and R.
1314

1415
<p align="center">
15-
<img src="https://github.com/KrishnaswamyLab/MAGIC/blob/master/magic.gif"/>
16+
<img src="https://raw.githubusercontent.com/KrishnaswamyLab/MAGIC/master/magic.gif"/>
1617
<br>
1718
<i>Magic reveals the interaction between Vimentin (VIM), Cadherin-1 (CDH1), and Zinc finger E-box-binding homeobox 1 (ZEB1, encoded by colors).
1819
</i>
@@ -31,11 +32,12 @@ MAGIC has been implemented in Python, Matlab, and R.
3132
* [Instructions for the Matlab version](#instructions-for-the-matlab-version)
3233
* [R](#r)
3334
* [Installation](#installation-1)
34-
* [Installation with devtools and <code>pip</code>](#installation-with-devtools-and-pip)
35+
* [Installation from CRAN](#installation-from-cran)
3536
* [Installation from GitHub](#installation-from-github-1)
3637
* [Usage](#usage-1)
3738
* [Quick Start](#quick-start-1)
3839
* [Tutorials](#tutorials-1)
40+
* [Help](#help)
3941

4042
## Python
4143

@@ -45,15 +47,15 @@ MAGIC has been implemented in Python, Matlab, and R.
4547

4648
To install with `pip`, run the following from a terminal:
4749

48-
pip install --user git+git://github.com/KrishnaswamyLab/MAGIC.git#subdirectory=python
50+
pip install --user git+git://github.com/KrishnaswamyLab/MAGIC.git#subdirectory=python
4951

5052
#### Installation from GitHub
5153

5254
To clone the repository and install manually, run the following from a terminal:
5355

54-
git clone git://github.com/KrishnaswamyLab/MAGIC.git
55-
cd MAGIC/python
56-
python setup.py install --user
56+
git clone git://github.com/KrishnaswamyLab/MAGIC.git
57+
cd MAGIC/python
58+
python setup.py install --user
5759

5860
### Usage
5961

@@ -91,29 +93,30 @@ Bone Marrow data notebook: http://nbviewer.jupyter.org/github/KrishnaswamyLab/MA
9193

9294
To use MAGIC, you will need to install both the R and Python packages.
9395

94-
#### Installation with `devtools` and `pip`
96+
If `python` or `pip` are not installed, you will need to install them. We recommend
97+
[Miniconda3](https://conda.io/miniconda.html) to install Python and `pip` together,
98+
or otherwise you can install `pip` from https://pip.pypa.io/en/stable/installing/.
9599

96-
You can install `Rmagic` with `devtools` by running the following in R:
100+
#### Installation from CRAN
97101

98-
if (!require(devtools)) install.packages("devtools")
99-
library(devtools)
100-
install_github("KrishnaswamyLab/magic/Rmagic")
102+
In R, run this command to install MAGIC and all dependencies:
101103

102-
You then need to install MAGIC in Python with `pip` by running the following from a terminal:
104+
install.packages("Rmagic")
103105

104-
pip install --user git+git://github.com/KrishnaswamyLab/MAGIC.git#subdirectory=python
106+
In a terminal, run the following command to install the Python
107+
repository.
105108

106-
If `python` or `pip` are not installed, you will need to install them. We recommend [Miniconda3](https://conda.io/miniconda.html) to install Python and `pip` together, or otherwise you can install `pip` from https://pip.pypa.io/en/stable/installing/.
109+
pip install --user git+git://github.com/KrishnaswamyLab/MAGIC.git#subdirectory=python
107110

108111
#### Installation from GitHub
109112

110113
To clone the repository and install manually, run the following from a terminal:
111114

112-
git clone git://github.com/KrishnaswamyLab/MAGIC.git
113-
cd MAGIC/python
114-
python setup.py install --user
115-
cd ../Rmagic
116-
R CMD INSTALL .
115+
git clone git://github.com/KrishnaswamyLab/MAGIC.git
116+
cd MAGIC/python
117+
python setup.py install --user
118+
cd ../Rmagic
119+
R CMD INSTALL .
117120

118121
### Usage
119122

@@ -131,3 +134,7 @@ After installing the package, MAGIC can be run by loading the library and callin
131134
#### Tutorials
132135

133136
For a working example, see the Rmarkdown tutorials at https://github.com/KrishnaswamyLab/MAGIC/blob/master/Rmagic/inst/examples/bonemarrow_tutorial.md and https://github.com/KrishnaswamyLab/MAGIC/blob/master/Rmagic/inst/examples/EMT_tutorial.md or in `R/inst/examples`.
137+
138+
## Help
139+
140+
If you have any questions or require assistance using MAGIC, please contact us at <https://krishnaswamylab.org/get-help>.

Rmagic/.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
^data-raw$
2+
^tests$
3+
^README\.Rmd$

Rmagic/DESCRIPTION

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
Package: Rmagic
22
Type: Package
3-
Title: Markov Affinity-based Graph Imputation of Cells
3+
Title: MAGIC - Markov Affinity-Based Graph Imputation of Cells
44
Version: 1.0.0
5-
Author: c(person("David van Dijk", "MSKCC", email = "davidvandijk@gmail.com", role = c("aut")),
5+
Authors@R: c(person(given = "David", family = "van Dijk", email = "davidvandijk@gmail.com", role = c("aut")),
66
person(given = 'Scott', family = 'Gigante', email = 'scott.gigante@yale.edu', role = 'cre', comment = c(ORCID = '0000-0002-4544-2764')))
77
Maintainer: Scott Gigante <scott.gigante@yale.edu>
8-
Description: MAGIC is an interactive tool to impute missing values in single-cell
9-
data and restore the structure of the data.
8+
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>.
109
Depends:
1110
R (>= 3.3),
1211
Matrix (>= 1.2-0)
@@ -19,6 +18,6 @@ Suggests:
1918
readr,
2019
viridis,
2120
phateR
22-
License: MIT + file LICENSE
21+
License: GPL-2 | file LICENSE
2322
LazyData: true
2423
RoxygenNote: 6.0.1

Rmagic/R/magic.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
#' If NULL, alpha decaying kernel is not used
1717
#' @param t int, optional, default: 'auto'
1818
#' power to which the diffusion operator is powered
19-
#' sets the level of diffusion
19+
#' sets the level of diffusion. If 'auto', t is selected according to the
20+
#' Procrustes disparity of the diffused data.'
2021
#' @param npca number of PCA components that should be used; default: 20.
2122
#' @param init magic object, optional
2223
#' object to use for initialization. Avoids recomputing
@@ -123,6 +124,8 @@ magic <- function(data,
123124
genes <- as.integer(genes - 1)
124125
} else if (length(genes) == 1 && genes == "all_genes") {
125126
gene_names <- colnames(data)
127+
} else if (length(genes) == 1 && genes == "pca_only") {
128+
gene_names <- paste0("PC", 1:npca)
126129
} else {
127130
# character vector
128131
if (!all(genes %in% colnames(data))) {

Rmagic/README.Rmd

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title : Rmagic v1.0.0
33
output: github_document
4+
toc: true
45
---
56

67
<!-- README.md is generated from README.Rmd. Please edit that file -->
@@ -14,17 +15,18 @@ knitr::opts_chunk$set(
1415
)
1516
```
1617

18+
[![Latest CRAN version](https://img.shields.io/cran/v/Rmagic.svg)](https://cran.r-project.org/package=Rmagic)
1719
[![Travis CI Build](https://api.travis-ci.com/KrishnaswamyLab/MAGIC.svg?branch=master)](https://travis-ci.com/KrishnaswamyLab/MAGIC)
1820
[![Read the Docs](https://img.shields.io/readthedocs/magic.svg)](https://magic.readthedocs.io/)
1921
[![Cell Publication DOI](https://zenodo.org/badge/DOI/10.1016/j.cell.2018.05.061.svg)](https://www.cell.com/cell/abstract/S0092-8674(18)30724-4)
2022
[![Twitter](https://img.shields.io/twitter/follow/KrishnaswamyLab.svg?style=social&label=Follow)](https://twitter.com/KrishnaswamyLab)
2123
[![Github Stars](https://img.shields.io/github/stars/KrishnaswamyLab/MAGIC.svg?style=social&label=Stars)](https://github.com/KrishnaswamyLab/MAGIC/)
2224

2325

24-
Markov Affinity-based Graph Imputation of Cells (MAGIC) is an algorithm for denoising and transcript recover of single cells applied to single-cell RNA sequencing data, as described in Van Dijk D *et al.* (2018), *Recovering Gene Interactions from Single-Cell Data Using Data Diffusion*, Cell <https://www.cell.com/cell/abstract/S0092-8674(18)30724-4>.
26+
Markov Affinity-based Graph Imputation of Cells (MAGIC) is an algorithm for denoising and imputation of single cells applied to single-cell RNA sequencing data, as described in Van Dijk D *et al.* (2018), *Recovering Gene Interactions from Single-Cell Data Using Data Diffusion*, Cell <https://www.cell.com/cell/abstract/S0092-8674(18)30724-4>.
2527

2628
<p align="center">
27-
<img src="https://github.com/KrishnaswamyLab/MAGIC/blob/master/magic.gif"/>
29+
<img src="https://raw.githubusercontent.com/KrishnaswamyLab/MAGIC/master/magic.gif"/>
2830
<br>
2931
<i>Magic reveals the interaction between Vimentin (VIM), Cadherin-1 (CDH1), and Zinc finger E-box-binding homeobox 1 (ZEB1, encoded by colors).
3032
</i>
@@ -42,11 +44,14 @@ Markov Affinity-based Graph Imputation of Cells (MAGIC) is an algorithm for deno
4244

4345
To use MAGIC, you will need to install both the R and Python packages.
4446

45-
In R, run these commands to install MAGIC and all dependencies:
47+
If `python` or `pip` are not installed, you will need to install them. We recommend [Miniconda3](https://conda.io/miniconda.html) to install Python and `pip` together, or otherwise you can install `pip` from https://pip.pypa.io/en/stable/installing/.
48+
49+
#### Installation from CRAN
50+
51+
In R, run this command to install MAGIC and all dependencies:
4652

4753
```{r install_Rmagic, eval=FALSE}
48-
if (!require(devtools)) install.packages(devtools)
49-
if (!require(Rmagic)) devtools::install_github("KrishnaswamyLab/magic/Rmagic")
54+
install.packages("Rmagic")
5055
```
5156

5257
In a terminal, run the following command to install the Python repository.
@@ -55,6 +60,20 @@ In a terminal, run the following command to install the Python repository.
5560
pip install --user git+git://github.com/KrishnaswamyLab/MAGIC.git#subdirectory=python
5661
```
5762

63+
#### Installaton from source
64+
65+
To install the very latest version of MAGIC, you can install from GitHub with the following commands run in a terminal.
66+
67+
```{bash install_magic_source, eval=FALSE}
68+
git clone https://github.com/KrishnaswamyLab/MAGIC
69+
cd MAGIC/python
70+
python setup.py install --user
71+
cd ../Rmagic
72+
R CMD INSTALL .
73+
```
74+
75+
#### Extra packages for the tutorial
76+
5877
We'll install a couple more tools for this tutorial.
5978

6079
```{r install_extras, eval=FALSE}
@@ -159,3 +178,6 @@ ggplot(data_PHATE) +
159178
labs(color="VIM")
160179
```
161180

181+
## Help
182+
183+
If you have any questions or require assistance using MAGIC, please contact us at <https://krishnaswamylab.org/get-help>.

Rmagic/README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Rmagic v1.0.0
33

44
<!-- README.md is generated from README.Rmd. Please edit that file -->
55

6+
[![Latest CRAN version](https://img.shields.io/cran/v/Rmagic.svg)](https://cran.r-project.org/package=Rmagic)
67
[![Travis CI
78
Build](https://api.travis-ci.com/KrishnaswamyLab/MAGIC.svg?branch=master)](https://travis-ci.com/KrishnaswamyLab/MAGIC)
89
[![Read the
@@ -13,14 +14,14 @@ Docs](https://img.shields.io/readthedocs/magic.svg)](https://magic.readthedocs.i
1314
Stars](https://img.shields.io/github/stars/KrishnaswamyLab/MAGIC.svg?style=social&label=Stars)](https://github.com/KrishnaswamyLab/MAGIC/)
1415

1516
Markov Affinity-based Graph Imputation of Cells (MAGIC) is an algorithm
16-
for denoising and transcript recover of single cells applied to
17+
for denoising and imputation of single cells applied to
1718
single-cell RNA sequencing data, as described in Van Dijk D *et al.*
1819
(2018), *Recovering Gene Interactions from Single-Cell Data Using Data
1920
Diffusion*, Cell
2021
<https://www.cell.com/cell/abstract/S0092-8674(18)30724-4>.
2122

2223
<p align="center">
23-
<img src="https://github.com/KrishnaswamyLab/MAGIC/blob/master/magic.gif"/>
24+
<img src="https://raw.githubusercontent.com/KrishnaswamyLab/MAGIC/master/magic.gif"/>
2425
<br>
2526
<i>Magic reveals the interaction between Vimentin (VIM), Cadherin-1 (CDH1), and Zinc finger E-box-binding homeobox 1 (ZEB1, encoded by colors).
2627
</i>
@@ -42,11 +43,16 @@ Diffusion*, Cell
4243

4344
To use MAGIC, you will need to install both the R and Python packages.
4445

45-
In R, run these commands to install MAGIC and all dependencies:
46+
If `python` or `pip` are not installed, you will need to install them. We recommend
47+
[Miniconda3](https://conda.io/miniconda.html) to install Python and `pip` together,
48+
or otherwise you can install `pip` from https://pip.pypa.io/en/stable/installing/.
49+
50+
#### Installation from CRAN
51+
52+
In R, run this command to install MAGIC and all dependencies:
4653

4754
``` r
48-
if (!require(devtools)) install.packages(devtools)
49-
if (!require(Rmagic)) devtools::install_github("KrishnaswamyLab/magic/Rmagic")
55+
install.packages("Rmagic")
5056
```
5157

5258
In a terminal, run the following command to install the Python
@@ -56,6 +62,21 @@ repository.
5662
pip install --user git+git://github.com/KrishnaswamyLab/MAGIC.git#subdirectory=python
5763
```
5864

65+
#### Installaton from source
66+
67+
To install the very latest version of MAGIC, you can install from
68+
GitHub with the following commands run in a terminal.
69+
70+
``` bash
71+
git clone https://github.com/KrishnaswamyLab/MAGIC
72+
cd MAGIC/python
73+
python setup.py install --user
74+
cd ../Rmagic
75+
R CMD INSTALL .
76+
```
77+
78+
#### Extra packages for the tutorial
79+
5980
We’ll install a couple more tools for this tutorial.
6081

6182
``` r
@@ -211,3 +232,7 @@ ggplot(data_PHATE) +
211232
```
212233

213234
<img src="man/figures/README-run_phate-1.png" width="100%" />
235+
236+
## Help
237+
238+
If you have any questions or require assistance using MAGIC, please contact us at <https://krishnaswamylab.org/get-help>.

0 commit comments

Comments
 (0)