Skip to contents

We provide wrapper functions to spatially quantify Pathway and Transcription Factor activities using DecoupleR.

## → Setting up spacedeconv environment..
## → Using conda environment 'r-omnideconv'

To compute activities you need to obtain a reference from OmniPathR. The method can be one of “progeny”, “dorothea” or “collectri”.

ref <- get_decoupleR_reference(method = "progeny", organism = "human")
## ── spacedeconv ─────────────────────────────────────────────────────────────────
##  Getting decoupleR reference
##  Got decoupleR reference [4s]
## 
head(ref)
## # A tibble: 6 × 4
##   source   target  weight  p_value
##   <chr>    <chr>    <dbl>    <dbl>
## 1 Androgen TMPRSS2  11.5  2.38e-47
## 2 Androgen NKX3-1   10.6  2.21e-44
## 3 Androgen MBOAT2   10.5  4.63e-44
## 4 Androgen KLK2     10.2  1.94e-40
## 5 Androgen SARG     11.4  2.79e-40
## 6 Androgen SLC38A4   7.36 1.25e-39

In the next step the activities can be computed.

data("spatial_data_3")
spatial_data_3 <- preprocess(spatial_data_3)
## ── spacedeconv ─────────────────────────────────────────────────────────────────
##  testing parameter
##  parameter OK [50ms]
## 
##  Removing 137 observations with umi count below threshold
##  Removed 137 observations with umi count below threshold [824ms]
## 
##  Removing 13049 variables with all zero expression
## Warning in preprocess(spatial_data_3): There are 13 mitochondrial genes
## present. Consider removing them.
##  Removed 13049 variables with all zero expression [184ms]
## 
##  Checking for ENSEMBL Identifiers
## ! Warning: ENSEMBL identifiers detected in gene names
##  Checking for ENSEMBL Identifiers Consider using Gene Names for first-generation deconvolution tools
##  Checking for ENSEMBL Identifiers Finished Preprocessing [9ms]
spatial_data_3 <- normalize(spatial_data_3)
## ── spacedeconv ─────────────────────────────────────────────────────────────────
##  testing parameter
##  parameter OK [17ms]
## 
##  Normalizing using cpm
##  Finished normalization using cpm [2.5s]
## 
##  Please note the normalization is stored in an additional assay

spe <- compute_activities(spatial_data_3, reference = ref, method = "wmean", assay = "cpm")
## ── spacedeconv ─────────────────────────────────────────────────────────────────
##  testing parameter
##  parameter OK [12ms]
## 
##  Running decoupleR
## → Calculated multiple results, using corr_wmean  , other available results:  norm_wmeanCalculated multiple results, using corr_wmean  , other available results:  wmean
##  Running decoupleR Finished [31.6s]