Helper function to deal with tensor sparsity and liana's scores as in Python
Source:R/liana_tensor.R
preprocess_scores.Rd
Helper function to deal with tensor sparsity and liana's scores as in Python
Usage
preprocess_scores(
context_df_dict,
score_col = "magnitude_rank",
sender_col = "source",
receiver_col = "target",
ligand_col = "ligand.complex",
receptor_col = "receptor.complex",
outer_fraction = 0,
invert = TRUE,
invert_fun = function(x) 1 - x,
non_negative = TRUE,
non_negative_fill = 0,
lr_sep = "^",
verbose = TRUE
)
Arguments
- context_df_dict
Dictionary (named list) containing a dataframe for each context. The dataframe must contain columns containing sender (source) cells, receiver (target) cells, ligands, receptors, and communication scores, separately. Keys are context names and values are dataframes. NULL by default. If not NULL will be used instead of `sce@metadata$liana_res`.
- score_col
Name of the column containing the communication scores in all context dataframes.
- sender_col
Name of the column containing the sender cells in all context dataframes.
- receiver_col
Name of the column containing the receiver cells in all context dataframes.
- ligand_col
Name of the column containing the ligands in all context dataframes.
- receptor_col
Name of the column containing the receptors in all context dataframes.
- outer_fraction
controls the elements to include in the union scenario of the `how` options. Only elements that are present at least in this fraction of samples/contexts will be included. When this value is 0, considers all elements across the samples. When this value is 1, it acts as using `how='inner'`
- invert
boolean wheter to invert the score (TRUE by defeault)
- invert_fun
function used to invert scores
- non_negative
whether to set negative scores to 0
- non_negative_fill
the value to be used to fill negative values
- lr_sep
ligand-receptor separator; `^` by default.
- verbose
verbosity logical