Generates a heatmap plot after computation of "pseudobulk" counts

pseudobulk_heatmap(
  x = NULL,
  color_pal = "muted",
  plot_meta = NULL,
  hm_display_genes = 30
)

Arguments

x

an STlist with pseudobulk counts in the @misc slot (generated by pseudobulk_samples)

color_pal

a string of a color palette from khroma or RColorBrewer, or a vector of color names or HEX values. Each color represents a category in the variable specified in plot_meta

plot_meta

a string indicating the name of the variable in the sample metadata to annotate heatmap columns

hm_display_genes

number of genes to display in heatmap, selected based on decreasing order of standard deviation across samples

Value

a ggplot object

Details

Generates a heatmap of transformed "pseudobulk" counts to help in initial data exploration of differences among samples. Each column in the heatmap represents a "pseudobulk" sample. Rows are genes, with the number of genes displayed controlled by the hm_display_genes argument. This function follows after usage of pseudobulk_samples.

Examples

# Using included melanoma example (Thrane et al.)
library('spatialGE')
data_files <- list.files(system.file("extdata", package="spatialGE"), recursive=T, full.names=T)
count_files <- grep("counts", data_files, value=T)
coord_files <- grep("mapping", data_files, value=T)
clin_file <- grep("thrane_clinical", data_files, value=T)
melanoma <- STlist(rnacounts=count_files[c(1:4)], spotcoords=coord_files[c(1:4)], samples=clin_file) # Only first two samples
#> Warning: Sample ST_mel3_rep1 was not found among the count/coordinate files.
#> Warning: Sample ST_mel3_rep2 was not found among the count/coordinate files.
#> Warning: Sample ST_mel4_rep1 was not found among the count/coordinate files.
#> Warning: Sample ST_mel4_rep2 was not found among the count/coordinate files.
#> Found matrix data
#> Matching gene expression and coordinate data...
#> Converting counts to sparse matrices
#> Completed STlist!
#> 
melanoma <- pseudobulk_samples(melanoma)
hm <- pseudobulk_heatmap(melanoma, plot_meta='BRAF_status', hm_display_genes=30)