Figure 2C

Code
# Enrique Blanco Carmona
# e.blancocarmona@kitz-heidelberg.de
# PhD Student – Clinical Bioinformatics
# Division of Pediatric Neurooncology (B062)
# DKFZ-KiTZ | Germany

# Read in sample.
sample <- readRDS("/omics/odcf/analysis/OE0145_projects/idh_gliomas/Figures_Science/revision/IDH_gliomas_book/datasets/integrated_LGGs.rds")

# Subset tumor cells.
sample <- sample[, sample$relabelling %in% c("Astro-like", "RA", "OPC-like", "Gradient", "Cycling")]
sample$relabelling[sample$relabelling == "RA"] <- "RE"
sample$subtype[sample$subtype == "Oligodendroglioma"] <- "OD"
sample$subtype[sample$subtype == "Astrocytoma"] <- "AS"
sample$subtype = factor(sample$subtype, levels = c("OD", "AS"))
# Read in TF activities.
dorothea_activities <- readRDS("/omics/odcf/analysis/OE0145_projects/idh_gliomas/Figures_Science/revision/IDH_gliomas_book/datasets/primary_dorothea.rds")
Code
p <- SCpubr::do_TFActivityPlot(sample = sample,
                               activities = dorothea_activities,
                               n_tfs = 30,
                               split.by = "subtype",
                               group.by = c("relabelling"),
                               max.cutoff = 1, 
                               min.cutoff = -1,
                               font.size = 17,
                               axis.text.face = "plain",
                               legend.length = 12,
                               legend.width = 0.5,
                               legend.framecolor = "grey50",
                               legend.tickcolor = "white",
                               legend.framewidth = 0.2,
                               legend.tickwidth = 0.2) +
     ggplot2::xlab("Regulon") +
     ggplot2::ylab("Cell type")

p$guides$fill$title <- "Regulon score"
p <- p + ggplot2::theme(plot.margin = ggplot2::margin(t = 0, r = 0, b = 0, l = 0))