Closed DarioS closed 2 months ago
You're going to have to be more specific
O.K. So, instead of just ACTA2, CD34 headings, generate headings like mCAF (ACTA2), iCAF (CD34) by a facet labeller. I looked at data
part of object and had a guess + facet_wrap(vars(colour_by), labeller = geneCellTypeLabeller)
but it was not right. So, basically hoping to paste known gene marker name to cell type name without editing SingleCellExperiment
.
Not wishing to be fussy, but I was rather hoping for a reproducible code example, with current output plus expected output
Ah, I got it to work with as_labeller
while designing the minimal reproducible example.
library(scater)
library(ggplot2)
markers <- c("Gene_0001", "Gene_0050", "Gene_0010")
example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)
example_sce$cellType <- LETTERS[1:4]
aLabeller <- setNames(c("Type A (Gene_0001)", "Type B (Gene_0050)", "Type C (Gene_0010)"),
c("Gene_0001", "Gene_0050", "Gene_0010"))
plotExpression(example_sce, markers, x = "cellType", colour_by = "cellType") +
facet_wrap(vars(Feature), labeller = as_labeller(aLabeller))
This compares a marker gene in its known cell type and all others alongside that.
It would be convenient to be able to define a custom labeller so that the cell type may be shown in a group's title with marker gene.