Perform a prioritization of cell-cell interactions (similar to MultiNicheNet).
Source:R/prioritization.R
generate_prioritization_tables.RdUser can choose the importance attached to each of the following prioritization criteria: differential expression of ligand and receptor, cell-type specificity of expression of ligand and receptor, NicheNet ligand activity
Usage
generate_prioritization_tables(
sender_receiver_info,
sender_receiver_de,
ligand_activities,
lr_condition_de = NULL,
prioritizing_weights = NULL,
scenario = "case_control"
)Arguments
- sender_receiver_info
Output of
generate_info_tablesORget_exprs_avg->process_table_to_ic- sender_receiver_de
Output of
generate_info_tablesORcalculate_de->process_table_to_ic- ligand_activities
Output of
predict_ligand_activities- lr_condition_de
Output of
generate_info_tablesORFindMarkers->process_table_to_ic- prioritizing_weights
Named vector indicating the relative weights of each prioritization criterion (default: NULL). If NULL, the weights are determined by the chosen "scenario". If provided, the vector must contain the following names: "de_ligand", "de_receptor", "activity_scaled", "exprs_ligand", "exprs_receptor", "ligand_condition_specificity", "receptor_condition_specificity"
- scenario
"case_control" or "one_condition": if "case_control", all weights are set to 1. If "one_condition", the weights are set to 0 for condition specificity and 1 for the remaining criteria.
Value
Data frames of prioritized sender-ligand-receiver-receptor interactions.
The resulting dataframe contains columns from the input dataframes, but columns from lr_condition_de are suffixed with _group (some columns from lr_condition_de are also not present).
Additionally, the following columns are added:
lfc_pval_*: product of -log10(pval) and the LFC of the ligand/receptorp_val_adapted_*: p-value adapted to the sign of the LFC to only consider interactions where the ligand/receptor is upregulated in the sender/receiveractivity_zscore: z-score of the ligand activityprioritization_score: The prioritization score for each interaction, calculated as a weighted sum of the prioritization criteria.
Moreover, scaled_* columns are scaled using the corresponding column's ranking or the scale_quantile_adapted function. The columns used for prioritization are scaled_p_val_adapted_ligand, scaled_p_val_adapted_receptor, scaled_activity, scaled_avg_exprs_ligand, scaled_avg_exprs_receptor, scaled_p_val_adapted_ligand_group, scaled_p_val_adapted_receptor_group
Examples
if (FALSE) { # \dontrun{
# Calculate tables with generate_info_tables
info_tables <- generate_info_tables(seurat_obj, "celltype", sender_celltypes, receiver, expressed_ligands, expressed_receptors, lr_network, "aggregate", "LCMV", "SS")
# Generate prioritization tables
generate_prioritization_tables(info_tables$sender_receiver_info,
info_tables$sender_receiver_de,
ligand_activities,
info_tables$lr_condition_de,
scenario = "case_control"
)
# Alternatively, these tables can also be calculated manually:
# Calculate LCMV-specific average expression
expression_info <- get_exprs_avg(seurat_obj, "celltype", condition_oi = "LCMV", condition_colname = "aggregate")
# Calculate LCMV-specific cell-type markers
DE_table <- calculate_de(seurat_obj, "celltype", condition_oi = "LCMV", condition_colname = "aggregate")
# Calculate condition-specific markers
condition_markers <- FindMarkers(
object = seuratObj, ident.1 = "LCMV", ident.2 = "SS",
group.by = "aggregate", min.pct = 0, logfc.threshold = 0
) %>% rownames_to_column("gene")
# Process tables
processed_expr_info <- process_table_to_ic(expression_info, table_type = "expression", lr_network)
processed_DE_table <- process_table_to_ic(DE_table,
table_type = "celltype_DE", lr_network,
senders_oi = sender_celltypes, receivers_oi = receiver
)
processed_condition_DE_table <- process_table_to_ic(condition_markers, table_type = "group_DE", lr_network)
# Custom weights
prioritizing_weights <- c("de_ligand" = 1, "de_receptor" = 1, "activity_scaled" = 2, "exprs_ligand" = 1, "exprs_receptor" = 1, "ligand_condition_specificity" = 0.5, "receptor_condition_specificity" = 0.5)
generate_prioritization_tables(processed_expr_info, processed_DE_table, ligand_activities, processed_condition_DE_table, prioritizing_weights)
} # }