generate_prioritization_tables | R Documentation |
User 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
generate_prioritization_tables(
sender_receiver_info,
sender_receiver_de,
ligand_activities,
lr_condition_de = NULL,
prioritizing_weights = NULL,
scenario = "case_control"
)
sender_receiver_info |
Output of |
sender_receiver_de |
Output of |
ligand_activities |
Output of |
lr_condition_de |
Output of |
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. |
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/receptor
p_val_adapted_*
: p-value adapted to the sign of the LFC to only consider interactions where the ligand/receptor is upregulated in the sender/receiver
activity_zscore
: z-score of the ligand activity
prioritization_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
## Not run:
# 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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.