knitr::opts_chunk$set(echo = TRUE)
To facilitate further method development and the benchmarks of current and future methods, in this vignette we provide further instructions relevant for method developers.
library(tidyverse) library(magrittr) library(liana) liana_path <- system.file(package = "liana") testdata <- readRDS(file.path(liana_path , "testdata", "input", "testdata.rds"))
liana_pipe
and ContributionsTo facilitate method development, we provide a guide how to make use of the architecture already implemented in LIANA.
First, we start by converting the object to SCE (if Seurat) and basic checks via liana_rep
.
Then we generate a LR_res table with many relevant columns, such as stats for ligands and receptors per cell type.
Note that liana_pipe also takes complexes into account by dissociating them into subunits (see ?liana:::decomplexify
).
These are later re-assembled back into complexes using the recomplexify
function.
sce <- liana_prep(testdata) # Obtain LR summary res with CellPhoneDB and dissociate complexes lr_res <- liana_pipe(sce, op_resource = select_resource("CellPhoneDB")[[1]] %>% liana:::decomplexify(), base = exp(1) # here we assume log-transformation # of the library-normalized counts ) %>% glimpse()
``
The LR result summary is then passed to the get_*
functions then provide ways
to summarize this information into a score (LRscore
in this case) that can be
used to the prioritize interactions.
We also need to pass the function that we wish to use to account for heteromeric complexes
get_sca(lr_res, complex_policy="mean", expr_prop=liana_defaults()[["expr_prop"]], return_all=FALSE) %>% glimpse
get_*
functions refer to liana_call
and liana_score
functions behind the scenes, so please refer to those for more info.
Install a LIANA++ environment with all original software as a way to minimize bias for benchmark studies.
LIANA++ uses CCC methods from both R and Python, as such dependencies for both need to be installed.
To install the LIANA++ framework run the following code in R:
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools") library(devtools) Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS = TRUE) # ignore warning from iTALK BiocManager::install("ComplexHeatmap") # required for Connectome devtools::install_github('saezlab/OmnipathR@ff3ad88e3915747e1b557bf44ac5396f9525dd7e') # install 4.0 version of OmnipathR # install tools devtools::install_github("sqjin/CellChat") devtools::install_github('msraredon/Connectome', ref = 'master') devtools::install_github("Coolgenome/iTALK", build_vignettes = FALSE) # A modified version of SingleCellSignalR (SCA) that enables external resources devtools::install_github(repo = "saezlab/SingleCellSignalR_v1", subdir = "SingleCellSignalR") # Finally, install LIANA devtools::install_github('saezlab/liana')
Squidpy and NATMI are written in Python, as such a python environment with the prerequisites of these methods needs to be set up.
If you also wish to run the CellPhoneDB re-implementation from Squidpy, please set up a conda environment by running the following lines in the terminal: ```{bash, eval = FALSE} conda create -n liana_env conda activate liana_env conda install -c anaconda python=3.8.5 pip install squidpy
Please use the [.yml](https://github.com/saezlab/liana/blob/master/liana_env.yml) file to set up a conda environment:
conda env create -f liana_env.yml
Note! NATMI and Squidpy are set by default to look for this conda environment ("liana_env"). #### To use NATMI with LIANA, clone the modified NATMI repo into liana path by running the following in the terminal: ```{sh, eval=FALSE} cd *insert fullpath*/liana git clone https://github.com/saezlab/NATMI
system.file(package = "liana") # "/home/user/R/x86_64.../4.0/liana"
It might be easier to just also clone the liana repo.
call_*
functionsUse the call_ functions to run the pipelines of the original methods, rather than their re-implementations. These functions work with Seurat objects and they are instead converted to SCE. These are largely getting deprecated and will be moved to a seperate repository in the future.
# RUN cellchat alone with OmniPath's Consensus sca_res <- call_sca( testdata, op_resource = select_resource('Consensus')[[1]] ) # Show CellChat Results sca_res
Similarly one could call all call_*
functions via liana_wrap
liana_calls <- liana_wrap(testdata, method = c('call_connectome', 'call_sca', 'call_italk', 'call_natmi' ), resource = c("Default")) # Run with Default Resources liana_calls %>% liana_aggregate() # Connectome finds no significant hits here # Note that for italk we use mean(ligand.logFC, receptor.logFC) as a way to compare # to the other methods
options(width = 120) sessioninfo::session_info()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.