View source: R/plotMarkerHeatmap.R
plotMarkerHeatmap | R Documentation |
Create a heatmap of the log-normalized expression for the most interesting markers of a particular label.
plotMarkerHeatmap(
results,
test,
label,
other.labels = NULL,
assay.type = "logcounts",
display.row.names = NULL,
use.pruned = FALSE,
order.by.effect = "cohens.d",
order.by.summary = "min.rank",
top = 20,
num.threads = bpnworkers(BPPARAM),
BPPARAM = SerialParam(),
...
)
configureMarkerHeatmap(
results,
test,
label,
other.labels = NULL,
assay.type = "logcounts",
use.pruned = FALSE,
order.by.effect = "cohens.d",
order.by.summary = "min.rank",
num.threads = 1
)
results |
A DataFrame containing the output from |
test |
A numeric matrix of log-normalized expression values where rows are genes and columns are cells.
Each row should be named with the same gene name that was used to compute Alternatively, a SummarizedExperiment object containing such a matrix. |
label |
String specifying the label of interest. |
other.labels |
Character vector specifying the other labels to be compared to |
assay.type |
Integer scalar or string specifying the matrix of expression values to use if |
display.row.names |
Character vector of length equal to the number of rows of |
use.pruned |
Logical scalar indicating whether the pruned labels should be used instead. |
order.by.effect |
String specifying the effect size from |
order.by.summary |
String specifying the summary statistic from |
top |
Integer scalar indicating the top most interesting markers to show in the heatmap. |
num.threads |
Integer scalar specifying the number to threads to use. |
BPPARAM |
Deprecated, use |
... |
Additional parameters for heatmap control passed to |
The plotMarkerHeatmap
function creates a heatmap where each row is a marker gene for label
and each column is a cell in the test dataset.
The aim is to check the effectiveness of the reference-derived markers for distinguishing between labels in the test dataset.
“Interesting” markers should show strong upregulation in cells assigned to label
compared to cells assigned to all other.labels
.
We identify such markers by scoring all reference-derived markers with scoreMarkers
on the test
expression.
The top
markers based on the specified order.by.*
fields are shown in the heatmap.
If only one label is present, markers are ranked by average abundance intead.
The configureMarkerHeatmap
function performs all the calculations underlying plotMarkerHeatmap
.
This can be used to apply the same general approach with other plots, e.g., using functions from scuttle or dittoSeq.
For plotMarkerHeatmap
, the output of pheatmap
is returned showing the heatmap on the current graphics device.
For configureMarkerHeatmap
, a list is returned containing:
rows
, an integer vector of row indices for the markers of label
, ordered from most to least interesting.
columns
, an integer vector of column indices to show in the heatmap.
This is ordered by the predicted labels so that cells assigned to the same label are contiguous.
predictions
, a character vector of predicted labels for cells to be shown in the heatmap.
Each entry corresponds to an entry of columns
.
The labels in this vector are guaranteed to be sorted.
Aaron Lun
# Running the SingleR() example.
example(SingleR, echo=FALSE)
plotMarkerHeatmap(pred, test, pred$labels[1])
plotMarkerHeatmap(pred, test, pred$labels[1], use.pruned=TRUE)
plotMarkerHeatmap(pred, test, pred$labels[1], order.by.effect="auc")
# Manually configuring a simpler heatmap by label:
config <- configureMarkerHeatmap(pred, test, pred$labels[1])
mat <- assay(test, "logcounts")[head(config$rows, 20), config$columns]
aggregated <- scuttle::summarizeAssayByGroup(mat, config$predictions)
pheatmap::pheatmap(assay(aggregated), cluster_col=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.