Skip to content

Commit b5e747d

Browse files
Matthew JonesMatthew Jones
Matthew Jones
authored and
Matthew Jones
committed
updated phylovision rmd
1 parent a4a5cee commit b5e747d

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

DESCRIPTION

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Maintainer: Matt Jones <[email protected]>
1111
Description: VISION provides functional interpretation of single cell RNA-seq (scRNA-seq) latent manifolds through the use of biological signatures (which can be downloaded from online databases). VISION can operate downstream of other common analyses such as dimensionality reduction, clustering, or trajectory analysis of scRNA-seq data. VISION produces an interactive web-based output report that can be easily shared with other collaborators or the greater scientific community.
1212
Depends: R (>= 3.4)
1313
Imports:
14+
dplyr,
1415
fastICA,
1516
igraph,
1617
irlba,

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ exportMethods(viewResults)
6262
import(Matrix)
6363
import(Rcpp)
6464
import(ape)
65+
import(dplyr)
6566
import(loe)
6667
import(logging)
6768
import(methods)

vignettes/phyloVision.Rmd

+29-18
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ vignette: >
88
%\VignetteEncoding{UTF-8}
99
---
1010

11+
# Introduction
12+
As of version 3.0.0, VISION now supports the analysis of scRNA-seq data with respect to a user-defined cell lineage, or phylogeny. In this case, VISION uses the relationships between cells as specified by the phylogeny, as opposed to some user-defined latent space, to conduct the autocorrelation analysis. In this vignette, we demonstrate how a user might use this variant of the VISION pipeline - which we term `PhyloVision` - to analyze a recently published dataset that simultaneously profiled the single-cell transcriptomes and lineages of mouse embryogenesis (Chan et al, Nature 2019).
13+
14+
This tutorial begins by showing users how to create a `PhyloVision` object and performing analysis on it. Then, we demonstrate how this object can be passed into a Hotspot module that will identify de-novo transcriptional gene sets that are autocorrelated on the tree (this is described more below and in the Spatial Hotspot vignette). Finally, we show users how to launch a report for viewing.
15+
1116
# Preliminaries
1217

1318
If you have yet to install VISION, we recommend installing the package from Github to install this package. Full source code can be found at the VISION Github repository, available [here](http://www.github.com/YosefLab/VISION).
@@ -19,20 +24,14 @@ install_github("YosefLab/VISION")
1924

2025
Once VISION and R are installed, you may load in VISION using `library(VISION)`.
2126

22-
Hotspot is a tool for identifying informative genes (and gene modules) in a single-cell dataset. Hotspot is installed directly from the git repository using the following command:
27+
To enable the Hotspot analysis below, install it directly from the git repository using the following command:
2328

2429
```
2530
pip install git+https://github.com/yoseflab/Hotspot.git
2631
```
32+
If you are having trouble installing Hotspot, please refer to the documentation website [here](https://yoseflab.github.io/Hotspot/).
2733

28-
# Using PhyloVision
29-
30-
Running an analysis with vision consists of three steps:
31-
32-
1. Creating the PhyloVision object
33-
2. Running the `phyloAnalyze` function
34-
3. Running Hotspot
35-
4. Browsing results
34+
# Running PhyloVision
3635

3736
First, we need to load VISION, reticulate and ape.
3837
```{r setup, eval=F}
@@ -59,9 +58,14 @@ sig <- paste("data", "h.all.v5.2.symbols.gmt", sep="/")
5958
6059
# Read the tree
6160
tree <- read.tree(paste(file_path, "embryo_tree.newick", sep="/"))
62-
# Collapse one mutations
61+
62+
# subset tree and expression matrix
63+
keep.bcs = intersect(tree$tip.label, colnames(expr))
64+
tree <- keep.tip(tree, keep.bcs)
65+
expr <- expr[, keep.bcs]
66+
67+
# Collapse one mutations with ape
6368
tree <- collapse.singles(tree)
64-
expr <- expr[, tree$tip.label]
6569
6670
# Construct the Vision object
6771
vis <- PhyloVision(tree=tree, data=expr, signatures=sig, meta=meta, num_neighbors=30, projection_genes= rownames(expr))
@@ -72,9 +76,7 @@ The `ape` phylogeny object. Singleton edges should be collapsed prior to use. En
7276

7377
**Expression Data**
7478

75-
The provided expression data should be scaled and normalized. It is recommended to apply more advanced normalization procedures such as batch correction or removal of technical confounders.
76-
77-
The expression data should not be log-transformed prior to loading into VISION.
79+
The provided expression data should be library-normalized. The expression data should not be log-transformed prior to loading into VISION. For more information on the input to VISION, please refer to the central [VISION vignette](VISION_vignette.html)
7880

7981
**Signatures**
8082

@@ -101,12 +103,17 @@ vis <- phyloAnalyze(vis)
101103
```
102104
## Running Hotspot analysis
103105

104-
We can also perform Hotspot module analysis. The expression data is already logged for us.
106+
As mentioned above, PhyloVision can take advantage of the new Hotspot functionality in VISION. Briefly, Hotspot is a tool for inferring modules of genes that are significantly autocorrelated with one another and a particular latent space (e.g., the first 30 principal components of a gene expression matrix). When combined with PhyloVision, the Hotspot functionality will use the user-defined phylogeny as the latent space.
107+
108+
We can invoke the Hotspot analysis with the function `runHotspot` and setting `tree=True`. Upon doing so, this will identify modules of genes and add these as Signatures to the VISION object for autocorrelation evaluation. Moreover, to add interpretability to this analysis, VISION will also compute the enrichment between all the user-defined Signatures and each Hotspot module. This information will be accessible on the web-based report by selecting the "Hotspot" mode in the top-right of the web-page.
109+
110+
The full Hotspot API is exposed for analysis as well. For more on the Hotspot API see [here](https://yoseflab.github.io/Hotspot/index.html). To note, while it is typically not recommended to use `model="normal"` and `logdata=FALSE` in Hotpsot, we elect to do so because the data here has been previously log-normalized. In more typical single-cell anlayses where the user is working with a library-normalized count matrix, we suggest setting `model="danb"` and `logdata=TRUE`.
111+
105112
```{r hotspot, eval=F}
106113
vis <- runHotspot(vis, model="normal", tree=TRUE, min_gene_threshold=50, n_neighbors = 30, number_top_genes = nrow(expr), logdata=FALSE)
107114
```
108115

109-
The full Hotspot API is exposed for analysis as well. For more on the Hotspot API see [here](https://yoseflab.github.io/Hotspot/index.html)
116+
We have additionally exposed the full Hotspot pipeline should a user want to iterate with different parameters:
110117
```{r full_h, eval=FALSE}
111118
# Init Hotspot
112119
hs <- hsInit(vis, model = "normal", tree=TRUE, logdata=FALSE)
@@ -143,9 +150,13 @@ draw_hotspot_heatmap(hs)
143150

144151
## Viewing Results
145152

146-
Finally, we can launch the Vision browser.
153+
Finally, we can launch the Vision browser. If you are local, the following will work:
147154
```{r eval=FALSE}
148155
viewResults(vis)
149156
```
150157

151-
158+
Else, if you would like to launch from a server, you can use the following settings:
159+
```{r, eval=FALSE}
160+
viewResults(vis, host='0.0.0.0', port=8100, browser=F)
161+
```
162+
Now, the report will be visible from port `8100` from your server (e.g., http://server-name:8100/Results.html)

0 commit comments

Comments
 (0)