Introduction

Note: this feature is deprecated in VISION 3.0+.

To compute Signature consistency scores, VISION needs a cell-cell similarity metric in order to build the neighborhood graph. By default, VISION runs PCA and uses euclidean distances in the reduced space for this purpose. However, if the cells’ variation is better modeled by a trajectory (either linear or tree-like), then distances along the trajectory structure can be used instead.

Many tools exist to perform trajectory inference in single cells. The Dynverse project has developed wrappers for 59 recently-published methods and VISION is able to accept the wrapped output of these methods as an input trajectory model.

Within the Dynverse trajectory object, VISION depends on two components:

  • The milestone network (essentially the topology of the trajectory produced from your favorite trajectory method)
  • The progression of cells along each edge in the milestone network. We expect that each cell is only present on a single edge.

Installation

You should have a working installation of VISION, dyno, and tidyverse.

devtools::install_github("YosefLab/VISION")
devtools::install_github("dynverse/dyno")
install.packages('tidyverse')

Data

In this vignette, we’ll be analyzing a set of ~5,000 cells during haematopoiesis (Tusi et al, Nature 2018).

Workflow

We begin by loading in the data and requisite libraries:

counts = as.matrix(read.table("data/hemato_counts.csv.gz", sep=',', header=T, row.names=1))

We’ll now follow the dyno vignette in the github README. You’ll need to make sure you have Docker installed. Although we use Slingshot here, there is a wide variety of methods that can be used, as listed on the Dynmethods page.

Before running the model, we’ll need to perform some gene filtering. We first only select the genes used in the original Tusi et al study, then for further efficiency, we further filter using VISION’s Fano filtering.

k.genes = read.table("data/bBM.filtered_gene_list.paper.txt.gz", sep=',')[,1]
filt.counts = counts[k.genes, ]

f.genes = VISION:::filterGenesFano(filt.counts)
filt.counts = filt.counts[f.genes, ]

Now, resuming the workflow recommended on the dyno vignette,

umis <- colSums(counts)
scale.factor <- median(umis)
expr <- t(t(counts) / umis) * scale.factor
filt.expr <-  log(1 + expr[f.genes,])

dataset <- wrap_expression(
  counts = t(filt.counts),
  expression = t(filt.expr)
)

model <- infer_trajectory(dataset, "projected_slingshot", verbose=T)

model <- model %>% add_dimred(dyndimred::dimred_mds, expression_source = dataset$expression)

plot_dimred(
  model,
  expression_source = dataset$expression
)

Now, with this model saved we can pass it to VISION via the latentTrajectory parameter. The model will automatically be analyzed with the same signatures passed to the VISION object, and with this model, the Trajectory tab will be activated in the VISION output report.

meta <- read.table("data/hemato_covariates.txt.gz", sep='\t', header=T, row.names=1)
meta <- meta[colnames(expr), -1]

vis <- Vision(expr, signatures = c("data/h.all.v5.2.symbols.gmt"),
            meta = meta, latentTrajectory = model)

vis <- addProjection(vis, "MDS", model$dimred[,c(1,2)])

vis <- analyze(vis)

Session Info

## R version 3.6.2 (2019-12-12)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Catalina 10.15.7
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] BiocStyle_2.20.2
## 
## loaded via a namespace (and not attached):
##  [1] knitr_1.33          magrittr_1.5        R6_2.4.1           
##  [4] ragg_1.2.1          rlang_1.0.1         fastmap_1.1.0      
##  [7] stringr_1.4.0       tools_3.6.2         xfun_0.25          
## [10] cli_3.1.1           jquerylib_0.1.4     systemfonts_1.0.4  
## [13] htmltools_0.5.2     yaml_2.2.1          digest_0.6.23      
## [16] rprojroot_2.0.2     pkgdown_2.0.2       crayon_1.3.4       
## [19] bookdown_0.23       textshaping_0.3.6   BiocManager_1.30.16
## [22] purrr_0.3.3         sass_0.4.0          fs_1.5.0           
## [25] memoise_2.0.0       cachem_1.0.6        evaluate_0.14      
## [28] rmarkdown_2.10      stringi_1.4.5       compiler_3.6.2     
## [31] bslib_0.3.1         desc_1.3.0          jsonlite_1.6