LIANA Quick Start Guide
Zaoqu Liu
Fork Maintainerliuzaoqu@163.com
2026-01-23
Source:vignettes/quickstart.Rmd
quickstart.RmdInstallation
From R-universe (Recommended)
install.packages("liana", repos = "https://zaoqu-liu.r-universe.dev")From GitHub
if (!requireNamespace("remotes", quietly = TRUE))
install.packages("remotes")
remotes::install_github("Zaoqu-Liu/liana")Quick Start in 5 Minutes
Load Example Data
# LIANA includes test data
liana_path <- system.file(package = "liana")
testdata <- readRDS(file.path(liana_path, "testdata", "input", "testdata.rds"))
# Check the data structure
print(testdata)
#> An object of class Seurat
#> 13714 features across 90 samples within 1 assay
#> Active assay: RNA (13714 features, 2000 variable features)Run LIANA (One Line!)
# Run multiple methods with consensus resource
liana_res <- liana_wrap(
testdata,
method = c("natmi", "connectome", "logfc", "sca"),
resource = "Consensus"
)Aggregate Results
# Combine results from all methods
liana_aggr <- liana_aggregate(liana_res)
# View top interactions
head(liana_aggr, 10)
#> # A tibble: 10 x 14
#> source target ligand.complex receptor.complex aggregate_rank mean_rank
#> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 B CD8 T HLA-DQA1 LAG3 0.000000322 28.8
#> 2 B CD8 T HLA-DQB1 LAG3 0.0000137 39.5
#> 3 B CD8 T HLA-DRA LAG3 0.0000137 15.2
#> 4 B CD8 T HLA-DQA2 LAG3 0.0000205 52
#> 5 NK NK SPON2 ITGB2 0.0000257 17
#> 6 B CD8 T HLA-DRB5 LAG3 0.0000291 39.5
#> 7 B CD8 T HLA-DRB1 LAG3 0.0000399 26.5
#> 8 B CD8 T HLA-DPA1 LAG3 0.0000530 25
#> 9 B CD8 T HLA-DPB1 LAG3 0.0000688 23
#> 10 NK B B2M CD1C 0.000260 42.8
#> # i 8 more variables: natmi.edge_specificity <dbl>, natmi.rank <dbl>,
#> # connectome.weight_sc <dbl>, connectome.rank <dbl>, logfc.logfc_comb <dbl>,
#> # logfc.rank <dbl>, sca.LRscore <dbl>, sca.rank <dbl>Visualize Results
# Dotplot of top interactions
liana_aggr %>%
liana_dotplot(
source_groups = c("B", "NK"),
target_groups = c("CD8 T", "NK", "B"),
ntop = 15
)
Key Concepts
Input Data Requirements
LIANA accepts: - Seurat objects (v4) - SingleCellExperiment objects
Requirements: - Normalized expression data (log-transformed) - Cell type annotations (cluster labels)
Available Methods
show_methods()
#> [1] "connectome" "logfc" "natmi" "sca"
#> [5] "cellphonedb" "cytotalk" "call_squidpy" "call_cellchat"
#> [9] "call_connectome" "call_sca" "call_italk" "call_natmi"Available Resources
show_resources()
#> [1] "Default" "Consensus" "Baccin2019" "CellCall"
#> [5] "CellChatDB" "Cellinker" "CellPhoneDB" "CellTalkDB"
#> [9] "connectomeDB2020" "EMBRACE" "Guide2Pharma" "HPMR"
#> [13] "ICELLNET" "iTALK" "Kirouac2010" "LRdb"
#> [17] "Ramilowski2015" "OmniPath" "MouseConsensus"Common Workflows
Workflow 1: Basic Analysis
# 1. Run LIANA
liana_res <- liana_wrap(your_data)
# 2. Aggregate
liana_aggr <- liana_aggregate(liana_res)
# 3. Filter significant interactions
significant <- liana_aggr %>%
filter(aggregate_rank <= 0.01)
# 4. Visualize
liana_dotplot(significant, ntop = 20)Workflow 2: Single Method
# Run only CellPhoneDB with custom parameters
cpdb_res <- liana_wrap(
your_data,
method = "cellphonedb",
resource = "CellPhoneDB",
permutation.params = list(nperms = 1000)
)Workflow 3: Custom Resource
# Use a specific resource
liana_res <- liana_wrap(
your_data,
method = c("natmi", "sca"),
resource = "CellChatDB"
)Visualization Gallery
Heatmap of Communication Frequencies
# Filter to significant interactions
liana_trunc <- liana_aggr %>%
filter(aggregate_rank <= 0.01)
# Frequency heatmap
if(nrow(liana_trunc) > 0) {
heat_freq(liana_trunc)
}
Chord Diagram
# Chord diagram (requires circlize)
if(requireNamespace("circlize", quietly = TRUE) && nrow(liana_trunc) > 0) {
chord_freq(liana_trunc,
source_groups = c("CD8 T", "NK", "B"),
target_groups = c("CD8 T", "NK", "B")
)
}
Tips and Best Practices
1. Data Quality
- Ensure proper normalization (log1p transformation)
- Remove low-quality cells before analysis
- Use consistent cell type annotations
2. Parameter Tuning
# Adjust expression proportion threshold
liana_res <- liana_wrap(
your_data,
expr_prop = 0.1 # Default: 10% of cells must express the gene
)Next Steps
- Algorithm Principles: Mathematical details of each method
- Visualization Guide: Advanced plotting options
- Multi-sample Analysis: Tensor decomposition for multiple conditions
Session Information
sessionInfo()
#> R version 4.4.0 (2024-04-24)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS 15.6.1
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
#>
#> locale:
#> [1] C
#>
#> time zone: Asia/Shanghai
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] ggplot2_4.0.1 dplyr_1.1.4 liana_0.1.14.9000 BiocStyle_2.34.0
#>
#> loaded via a namespace (and not attached):
#> [1] spatstat.sparse_3.1-0 fs_1.6.6
#> [3] matrixStats_1.5.0 lubridate_1.9.4
#> [5] httr_1.4.7 RColorBrewer_1.1-3
#> [7] doParallel_1.0.17 tools_4.4.0
#> [9] sctransform_0.4.3 backports_1.5.0
#> [11] utf8_1.2.6 R6_2.6.1
#> [13] uwot_0.2.4 lazyeval_0.2.2
#> [15] GetoptLong_1.1.0 withr_3.0.2
#> [17] sp_2.2-0 gridExtra_2.3
#> [19] prettyunits_1.2.0 progressr_0.18.0
#> [21] cli_3.6.5 Biobase_2.66.0
#> [23] textshaping_1.0.4 Cairo_1.7-0
#> [25] spatstat.explore_3.6-0 labeling_0.4.3
#> [27] sass_0.4.10 Seurat_4.4.0
#> [29] spatstat.data_3.1-9 S7_0.2.1
#> [31] readr_2.1.6 ggridges_0.5.7
#> [33] pbapply_1.7-4 pkgdown_2.1.3
#> [35] systemfonts_1.3.1 R.utils_2.13.0
#> [37] scater_1.34.1 dichromat_2.0-0.1
#> [39] parallelly_1.46.1 sessioninfo_1.2.3
#> [41] limma_3.62.2 readxl_1.4.5
#> [43] RSQLite_2.4.5 generics_0.1.4
#> [45] shape_1.4.6.1 spatstat.random_3.4-3
#> [47] ica_1.0-3 zip_2.3.3
#> [49] Matrix_1.7-4 ggbeeswarm_0.7.3
#> [51] S4Vectors_0.44.0 logger_0.4.1
#> [53] abind_1.4-8 R.methodsS3_1.8.2
#> [55] lifecycle_1.0.5 yaml_2.3.12
#> [57] edgeR_4.4.2 SummarizedExperiment_1.36.0
#> [59] SparseArray_1.6.2 Rtsne_0.17
#> [61] grid_4.4.0 blob_1.2.4
#> [63] promises_1.5.0 dqrng_0.4.1
#> [65] crayon_1.5.3 dir.expiry_1.14.0
#> [67] miniUI_0.1.2 lattice_0.22-7
#> [69] beachmat_2.22.0 cowplot_1.2.0
#> [71] chromote_0.5.1 magick_2.8.7
#> [73] pillar_1.11.1 knitr_1.51
#> [75] ComplexHeatmap_2.22.0 metapod_1.14.0
#> [77] GenomicRanges_1.58.0 tcltk_4.4.0
#> [79] rjson_0.2.23 future.apply_1.20.1
#> [81] codetools_0.2-20 leiden_0.4.3.1
#> [83] glue_1.8.0 spatstat.univar_3.1-6
#> [85] data.table_1.18.0 vctrs_0.7.0
#> [87] png_0.1-8 cellranger_1.1.0
#> [89] gtable_0.3.6 cachem_1.1.0
#> [91] OmnipathR_3.19.1 xfun_0.56
#> [93] S4Arrays_1.6.0 mime_0.13
#> [95] survival_3.8-3 SingleCellExperiment_1.28.1
#> [97] iterators_1.0.14 statmod_1.5.1
#> [99] bluster_1.16.0 fitdistrplus_1.2-4
#> [101] ROCR_1.0-11 nlme_3.1-168
#> [103] bit64_4.6.0-1 progress_1.2.3
#> [105] filelock_1.0.3 RcppAnnoy_0.0.23
#> [107] GenomeInfoDb_1.42.3 bslib_0.9.0
#> [109] irlba_2.3.5.1 vipor_0.4.7
#> [111] KernSmooth_2.23-26 otel_0.2.0
#> [113] colorspace_2.1-2 BiocGenerics_0.52.0
#> [115] DBI_1.2.3 tidyselect_1.2.1
#> [117] processx_3.8.6 bit_4.6.0
#> [119] compiler_4.4.0 curl_7.0.0
#> [121] rvest_1.0.5 httr2_1.2.2
#> [123] BiocNeighbors_2.0.1 xml2_1.5.2
#> [125] desc_1.4.3 DelayedArray_0.32.0
#> [127] plotly_4.11.0 bookdown_0.44
#> [129] checkmate_2.3.3 scales_1.4.0
#> [131] lmtest_0.9-40 rappdirs_0.3.4
#> [133] goftest_1.2-3 stringr_1.6.0
#> [135] digest_0.6.39 spatstat.utils_3.2-1
#> [137] rmarkdown_2.30 basilisk_1.23.0
#> [139] XVector_0.46.0 htmltools_0.5.9
#> [141] pkgconfig_2.0.3 sparseMatrixStats_1.18.0
#> [143] MatrixGenerics_1.18.1 fastmap_1.2.0
#> [145] rlang_1.1.7 GlobalOptions_0.1.3
#> [147] htmlwidgets_1.6.4 UCSC.utils_1.2.0
#> [149] shiny_1.12.1 farver_2.1.2
#> [151] jquerylib_0.1.4 zoo_1.8-15
#> [153] jsonlite_2.0.0 BiocParallel_1.40.2
#> [155] R.oo_1.27.1 BiocSingular_1.22.0
#> [157] magrittr_2.0.4 scuttle_1.16.0
#> [159] GenomeInfoDbData_1.2.13 patchwork_1.3.2
#> [161] Rcpp_1.1.1 viridis_0.6.5
#> [163] reticulate_1.44.1 stringi_1.8.7
#> [165] zlibbioc_1.52.0 MASS_7.3-65
#> [167] plyr_1.8.9 parallel_4.4.0
#> [169] listenv_0.10.0 ggrepel_0.9.6
#> [171] deldir_2.0-4 splines_4.4.0
#> [173] tensor_1.5.1 hms_1.1.4
#> [175] circlize_0.4.17 locfit_1.5-9.12
#> [177] ps_1.9.1 igraph_2.2.1
#> [179] spatstat.geom_3.6-1 reshape2_1.4.5
#> [181] stats4_4.4.0 ScaledMatrix_1.14.0
#> [183] XML_3.99-0.20 evaluate_1.0.5
#> [185] SeuratObject_4.1.4 scran_1.34.0
#> [187] BiocManager_1.30.27 tzdb_0.5.0
#> [189] foreach_1.5.2 httpuv_1.6.16
#> [191] polyclip_1.10-7 RANN_2.6.2
#> [193] tidyr_1.3.2 purrr_1.2.1
#> [195] future_1.69.0 clue_0.3-66
#> [197] scattermore_1.2 rsvd_1.0.5
#> [199] xtable_1.8-4 later_1.4.5
#> [201] viridisLite_0.4.2 ragg_1.5.0
#> [203] tibble_3.3.1 websocket_1.4.4
#> [205] beeswarm_0.4.0 memoise_2.0.1
#> [207] IRanges_2.40.1 cluster_2.1.8.1
#> [209] timechange_0.3.0 globals_0.18.0