Skip to contents

Function to Aggregate CCC Method Results

Usage

liana_aggregate(
  liana_res,
  aggregate_how = NULL,
  resource = NULL,
  set_cap = "max",
  cap = NULL,
  get_ranks = TRUE,
  get_agrank = TRUE,
  .score_mode = .score_specs,
  verbose = TRUE,
  join_cols = NULL,
  ...
)

Arguments

liana_res

LIANA results

aggregate_how

way to aggregate, by default (NULL) will aggregate all passed methods with the approach specified in `liana:::.score_specs`. Alternative options are `magnitude` and `specificity`.

resource

If methods are ran with multiple resources, the name of the resource of interest needs to be provided *Note* if a name is not provided, the first results based on the first resource in the list will be returned

set_cap

Function used to set ranked cap (i.e. the value that is assigned to interactions with NA for scores); By default, this is set to "max", which is the maximum number of interactions obtained by the methods; Some methods return all possible ligand-receptor combinations for each possible source and target cell pair - i.e. the known universe of all possible interactions (based on the CCC resource)

cap

A cap can for all methods can also be manually set, then the top X interactions, based on the `specificity` scores for each method will be returned and the ranking will be carried out solely on them

get_ranks

boolean, whether to return consensus ranks for methods

get_agrank

boolean, whether to return aggregate rank using the `RobustRankAggreg` package.

.score_mode

defines the way that the methods would be aggragate. By default, we use the score of each method which reflects specificity (if available), if not e.g. the case of SCA we use it's sole scoring function. This aggregation is by default done on the basis of the list returns by `.score_mode`. Alternatively, one could pass `.score_housekeep` to obtain an aggragate of the housekeeping interactions of each method.

join_cols

columns by which different method results will be joined. NULL by default, and automatically will handle the columns depending on the methods used.

...

Arguments passed on to .rank_matrix

glist

a list of ranked/ordered characters

Value

Tibble with the interaction results and ranking for each method

Details

set_cap is the name of the name of a function that is to be executed on a vector representing the number of rows in the results for each method, by default this is set to base::max, but any other function that works with vectors could be passed - e.g. min, mean, etc.

This function also decomplexifies any complex present in the CellChat results which returns complexes by default

Examples

liana_path <- system.file(package = "liana")
# load testdata
testdata <- readRDS(file.path(liana_path , "testdata", "input", "testdata.rds"))
# run liana
liana_res <- liana_wrap(testdata, method=c("sca", "natmi"))
#> Expression from the `RNA` assay will be used
#> Running LIANA with `seurat_annotations` as labels!
#> Warning: 3465 genes and/or 0 cells were removed as they had no counts!
#> Warning: `invoke()` is deprecated as of rlang 0.4.0.
#> Please use `exec()` or `inject()` instead.
#> This warning is displayed once per session.
#> LIANA: LR summary stats calculated!
#> Now Running: Sca
#> Now Running: Natmi
# aggregate results from multiple methods
liana_res <- liana_aggregate(liana_res)
#> Now aggregating sca
#> Now aggregating natmi
#> Aggregating Ranks