From 0acb2dfa69b48686362636040f5183bb74613c96 Mon Sep 17 00:00:00 2001 From: Gabriele Sales Date: Wed, 9 Nov 2022 10:56:21 +0100 Subject: [PATCH] Preserve plot labels when only one ligand/target pair is detected --- R/application_prediction.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/application_prediction.R b/R/application_prediction.R index 9e1a832..9f88a28 100644 --- a/R/application_prediction.R +++ b/R/application_prediction.R @@ -938,7 +938,7 @@ nichenet_seuratobj_aggregate = function(receiver, seurat_obj, condition_colname, order_targets = order_targets %>% intersect(rownames(active_ligand_target_links)) order_ligands = order_ligands %>% intersect(colnames(active_ligand_target_links)) - vis_ligand_target = active_ligand_target_links[order_targets,order_ligands] %>% t() + vis_ligand_target = active_ligand_target_links[order_targets,order_ligands,drop=FALSE] %>% t() p_ligand_target_network = vis_ligand_target %>% make_heatmap_ggplot("Prioritized ligands","Predicted target genes", color = "purple",legend_position = "top", x_axis_position = "top",legend_title = "Regulatory potential") + theme(axis.text.x = element_text(face = "italic")) #+ scale_fill_gradient2(low = "whitesmoke", high = "purple", breaks = c(0,0.006,0.012)) } else { vis_ligand_target = NULL