predict_single_cell_ligand_activities: Single-cell ligand activity prediction

View source: R/application_prediction.R

predict_single_cell_ligand_activitiesR Documentation

Single-cell ligand activity prediction

Description

predict_single_cell_ligand_activities For every individual cell of interest, predict activities of ligands in regulating expression of genes that are stronger expressed in that cell compared to other cells (0.975 quantile). Ligand activities are defined as how well they predict the observed transcriptional response (i.e. gene set) according to the NicheNet model.

Usage

predict_single_cell_ligand_activities(cell_ids, expression_scaled,ligand_target_matrix, potential_ligands, single = TRUE,...)

Arguments

cell_ids

Identities of cells for which the ligand activities should be calculated.

expression_scaled

Scaled expression matrix of single-cells (scaled such that high values indicate that a gene is stronger expressed in that cell compared to others)

ligand_target_matrix

The NicheNet ligand-target matrix denoting regulatory potential scores between ligands and targets (ligands in columns).

potential_ligands

Character vector giving the gene symbols of the potentially active ligands you want to define ligand activities for.

single

TRUE if you want to calculate ligand activity scores by considering every ligand individually (recommended). FALSE if you want to calculate ligand activity scores as variable importances of a multi-ligand classification model.

...

Additional parameters for get_multi_ligand_importances if single = FALSE.

Value

A tibble giving several ligand activity scores for single cells. Following columns in the tibble: $setting, $test_ligand, $auroc, $aupr and $pearson.

Examples

## Not run: 
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network,source_weights_df)
ligands = list("TNF","BMP2","IL4")
ligand_target_matrix = construct_ligand_target_matrix(weighted_networks, ligands, ltf_cutoff = 0, algorithm = "PPR", damping_factor = 0.5, secondary_targets = FALSE)
potential_ligands = c("TNF","BMP2","IL4")
genes = c("SOCS2","SOCS3","IRF1","ICAM1","ID1","ID2","ID3")
cell_ids = c("cell1","cell2")
expression_scaled = matrix(rnorm(length(genes)*2, sd = 0.5, mean = 0.5), nrow = 2)
rownames(expression_scaled) = cell_ids
colnames(expression_scaled) = genes
ligand_activities = predict_single_cell_ligand_activities(cell_ids = cell_ids, expression_scaled = expression_scaled, ligand_target_matrix = ligand_target_matrix, potential_ligands = potential_ligands)

## End(Not run)


saeyslab/nichenetr documentation built on March 26, 2024, 9:22 a.m.