Skip to contents

Wrapper around `liana_wrap` to run liana for each sample.

Usage

liana_bysample(
  sce,
  idents_col,
  sample_col,
  verbose = TRUE,
  inplace = TRUE,
  aggregate_how = NULL,
  ...
)

Arguments

idents_col

name of the cluster column

sample_col

name of the sample/context column

verbose

verbosity logical

inplace

logical (TRUE by default) if liana results are to be saved to the SingleCellExperiment object (`sce@metadata$liana_res`)

aggregate_how

if running multiple methods (default), then one cal also choose to aggregate the CCC results by sample.

...

Arguments passed on to liana_wrap

sce

`SingleCellExperiment` object or `SeuratObject`

method

method(s) to be run via liana

resource

resource(s) to be used by the methods (`Consensus` by default), Use `all` to run all `human` resources in one go), or `custom` to run liana_wrap with an appropriately formatted custom resource, passed via `exernal_resource`

external_resource

external resource in OmniPath tibble format

min_cells

minimum cell per cell identity to be considered for analysis

return_all

whether to return all possible interactions. Any interaction with `expr_prop` below the specific threshold will be assigned to the *worst* possible score in those that pass the threshold. For example, p-values from CellPhoneDB will be assigned to max(pvalue) - likely 1, and lr_means will be assigned to min(lr_means). Note that this applies only to the internal methods of liana.

supp_columns

any supplementary/additional columns which are to be returned by liana. Possibilities include: c("ligand.expr", "receptor.expr" "ligand.stat", "receptor.stat", "ligand.pval", "receptor.pval", "ligand.FDR", "receptor.FDR", etc)

assay

assay to be used by Seurat, by default set to `NULL` and will use the DefaultAssay.

.simplify

if methods are run with only 1 resource, return a list of tibbles for each method (default), rather than a list of lists with method-resource combinations

base

Default to NULL (i.e. log2-transformation is assumed for SCE, and log-tranformation for Seurat). This is a requred step for the calculation of the logFC method - ensures that any other preprocessing of the counts is preserved. One could also pass `NaN` if they wish to use the counts stored in the counts assay/slot, or any other number according to the base that was used for log-tranformation.

cell.adj

cell adjacency tibble/dataframe /w weights by which we will `multiply` the relevant columns. Any cell pairs with a weights of 0 will be filtered out. Note that if working with LIANA's default methods, we suggest weights >= 0 & =< 1. This ensure that all methods' score will be meaningfully weighed without changing the interpretation of their scores, thus allow one to filter SCA, rank NATMI, etc.

Value

If inplace is true returns a sce object with `liana_res` in `sce@metadata`, else it returns a named list of tibble with liana results per sample.

Details

takes a Seurat/SCE object and runs LIANA by sample/condition. The key by which the samples are separated is build from the `condition_col` and `sample_col`, separated by the `key_sep`.