Skip to content

Commit

Permalink
Merge pull request #116 from KrishnaswamyLab/dev
Browse files Browse the repository at this point in the history
MAGIC v1.1: bugfixes and CRAN release
  • Loading branch information
scottgigante authored Jul 12, 2018
2 parents f69df20 + f3cccbd commit e88d508
Show file tree
Hide file tree
Showing 57 changed files with 1,364 additions and 1,069 deletions.
Binary file removed .DS_Store
Binary file not shown.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
.Rhistory
.RData
.Ruserdata
.Rbuildignore

# R installation files

Expand All @@ -20,5 +19,10 @@ python/*.dll
python/*.egg-info
python/magic/__pycache__
python/magic/*.pyc
.DS_Store
matlab/EMT.csv

# Mac detritus

*~
~$*
.DS_Store
29 changes: 11 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

language: r
sudo: required
cache: packages

os:
- linux
Expand All @@ -12,35 +11,29 @@ r:
- release
- devel

cache: packages

env:
global:
- PATH="$HOME/miniconda2/bin:$HOME/miniconda3/bin:$PATH"
- RETICULATE_PYTHON="$HOME/miniconda2/bin/python"

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

install:
- cd python
- python2 setup.py install --user
- python3 setup.py install --user
- cd ../Rmagic
- R CMD INSTALL .
- cd ..
- cd python; $HOME/miniconda2/bin/pip install -q .
- $HOME/miniconda3/bin/pip install -q .
- cd ../Rmagic; R CMD INSTALL .; cd ..

script:
- cd Rmagic
- R CMD build .
- cd Rmagic; R CMD build .
- travis_wait 30 R CMD check *tar.gz
- cd ../python
- cd ../python; $HOME/miniconda2/bin/pip install -q .[test,doc]
- $HOME/miniconda3/bin/pip install -q .[test,doc]
- python2 setup.py test
- python3 setup.py test
- cd ..
- cd doc; make html

warnings_are_errors: true
47 changes: 27 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
Markov Affinity-based Graph Imputation of Cells (MAGIC)
-------------------------------------------------------

[![Latest CRAN version](https://img.shields.io/cran/v/Rmagic.svg)](https://cran.r-project.org/package=Rmagic)
[![Travis CI Build](https://api.travis-ci.com/KrishnaswamyLab/MAGIC.svg?branch=master)](https://travis-ci.com/KrishnaswamyLab/MAGIC)
[![Read the Docs](https://img.shields.io/readthedocs/magic.svg)](https://magic.readthedocs.io/)
[![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)
[![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/MAGIC.svg?style=social&label=Stars)](https://github.com/KrishnaswamyLab/MAGIC/)

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>.
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>.

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

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

## Python

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

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

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

#### Installation from GitHub

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

git clone git://github.com/KrishnaswamyLab/MAGIC.git
cd MAGIC/python
python setup.py install --user
git clone git://github.com/KrishnaswamyLab/MAGIC.git
cd MAGIC/python
python setup.py install --user

### Usage

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

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

#### Installation with `devtools` and `pip`
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/.

You can install `Rmagic` with `devtools` by running the following in R:
#### Installation from CRAN

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

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

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

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/.
pip install --user git+git://github.com/KrishnaswamyLab/MAGIC.git#subdirectory=python

#### Installation from GitHub

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

git clone git://github.com/KrishnaswamyLab/MAGIC.git
cd MAGIC/python
python setup.py install --user
cd ../Rmagic
R CMD INSTALL .
git clone git://github.com/KrishnaswamyLab/MAGIC.git
cd MAGIC/python
python setup.py install --user
cd ../Rmagic
R CMD INSTALL .

### Usage

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

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`.

## Help

If you have any questions or require assistance using MAGIC, please contact us at <https://krishnaswamylab.org/get-help>.
3 changes: 3 additions & 0 deletions Rmagic/.Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^data-raw$
^tests$
^README\.Rmd$
9 changes: 4 additions & 5 deletions Rmagic/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
Package: Rmagic
Type: Package
Title: Markov Affinity-based Graph Imputation of Cells
Title: MAGIC - Markov Affinity-Based Graph Imputation of Cells
Version: 1.0.0
Author: c(person("David van Dijk", "MSKCC", email = "davidvandijk@gmail.com", role = c("aut")),
Authors@R: c(person(given = "David", family = "van Dijk", email = "davidvandijk@gmail.com", role = c("aut")),
person(given = 'Scott', family = 'Gigante', email = 'scott.gigante@yale.edu', role = 'cre', comment = c(ORCID = '0000-0002-4544-2764')))
Maintainer: Scott Gigante <scott.gigante@yale.edu>
Description: MAGIC is an interactive tool to impute missing values in single-cell
data and restore the structure of the data.
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>.
Depends:
R (>= 3.3),
Matrix (>= 1.2-0)
Expand All @@ -19,6 +18,6 @@ Suggests:
readr,
viridis,
phateR
License: MIT + file LICENSE
License: GPL-2 | file LICENSE
LazyData: true
RoxygenNote: 6.0.1
5 changes: 4 additions & 1 deletion Rmagic/R/magic.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#' If NULL, alpha decaying kernel is not used
#' @param t int, optional, default: 'auto'
#' power to which the diffusion operator is powered
#' sets the level of diffusion
#' sets the level of diffusion. If 'auto', t is selected according to the
#' Procrustes disparity of the diffused data.'
#' @param npca number of PCA components that should be used; default: 20.
#' @param init magic object, optional
#' object to use for initialization. Avoids recomputing
Expand Down Expand Up @@ -123,6 +124,8 @@ magic <- function(data,
genes <- as.integer(genes - 1)
} else if (length(genes) == 1 && genes == "all_genes") {
gene_names <- colnames(data)
} else if (length(genes) == 1 && genes == "pca_only") {
gene_names <- paste0("PC", 1:npca)
} else {
# character vector
if (!all(genes %in% colnames(data))) {
Expand Down
32 changes: 27 additions & 5 deletions Rmagic/README.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title : Rmagic v1.0.0
output: github_document
toc: true
---

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

[![Latest CRAN version](https://img.shields.io/cran/v/Rmagic.svg)](https://cran.r-project.org/package=Rmagic)
[![Travis CI Build](https://api.travis-ci.com/KrishnaswamyLab/MAGIC.svg?branch=master)](https://travis-ci.com/KrishnaswamyLab/MAGIC)
[![Read the Docs](https://img.shields.io/readthedocs/magic.svg)](https://magic.readthedocs.io/)
[![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)
[![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/MAGIC.svg?style=social&label=Stars)](https://github.com/KrishnaswamyLab/MAGIC/)


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>.
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>.

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

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

In R, run these commands to install MAGIC and all dependencies:
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/.

#### Installation from CRAN

In R, run this command to install MAGIC and all dependencies:

```{r install_Rmagic, eval=FALSE}
if (!require(devtools)) install.packages(devtools)
if (!require(Rmagic)) devtools::install_github("KrishnaswamyLab/magic/Rmagic")
install.packages("Rmagic")
```

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

#### Installaton from source

To install the very latest version of MAGIC, you can install from GitHub with the following commands run in a terminal.

```{bash install_magic_source, eval=FALSE}
git clone https://github.com/KrishnaswamyLab/MAGIC
cd MAGIC/python
python setup.py install --user
cd ../Rmagic
R CMD INSTALL .
```

#### Extra packages for the tutorial

We'll install a couple more tools for this tutorial.

```{r install_extras, eval=FALSE}
Expand Down Expand Up @@ -159,3 +178,6 @@ ggplot(data_PHATE) +
labs(color="VIM")
```

## Help

If you have any questions or require assistance using MAGIC, please contact us at <https://krishnaswamylab.org/get-help>.
35 changes: 30 additions & 5 deletions Rmagic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Rmagic v1.0.0

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

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

Markov Affinity-based Graph Imputation of Cells (MAGIC) is an algorithm
for denoising and transcript recover of single cells applied to
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>.

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

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

In R, run these commands to install MAGIC and all dependencies:
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/.

#### Installation from CRAN

In R, run this command to install MAGIC and all dependencies:

``` r
if (!require(devtools)) install.packages(devtools)
if (!require(Rmagic)) devtools::install_github("KrishnaswamyLab/magic/Rmagic")
install.packages("Rmagic")
```

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

#### Installaton from source

To install the very latest version of MAGIC, you can install from
GitHub with the following commands run in a terminal.

``` bash
git clone https://github.com/KrishnaswamyLab/MAGIC
cd MAGIC/python
python setup.py install --user
cd ../Rmagic
R CMD INSTALL .
```

#### Extra packages for the tutorial

We’ll install a couple more tools for this tutorial.

``` r
Expand Down Expand Up @@ -211,3 +232,7 @@ ggplot(data_PHATE) +
```

<img src="man/figures/README-run_phate-1.png" width="100%" />

## Help

If you have any questions or require assistance using MAGIC, please contact us at <https://krishnaswamylab.org/get-help>.
Loading

0 comments on commit e88d508

Please sign in to comment.