Skip to contents

HeatmapDiag utility function for `pheatmap` using `slanter` to order the maximum values across the matrix diagonal

Usage

HeatmapDiag(matrix, ...)

Arguments

matrix

an R matrix as input to `pheatmap`. Could be the object returned by `scglmmr::GetGeneMatrix`

Value

a pheatmap object

Examples

if (FALSE) {
# make gene plot of top 50 ranked genes within each subst
# fit1 = dreamMixedModel(...)
r1 = ExtractResult(model.fit.list = fit1, coefficient.number = 1,coef.name = 'L1', what = 'gene.t.ranks')
rank = lapply(r1,function(x) names(x[1:50]))
top50ranks = unlist(rank) %>% unique()
res1 = ExtractResult(model.fit.list = fit1, coefficient.number = 1,coef.name = 'L1')
mtx = GetGeneMatrix(result.list = res1, gene_subset = top50ranks, stat_for_matrix = 'logFC', pvalfilter = 1, logfcfilter = -Inf)
pdf(file = paste0(figpath, 'geneplot.pdf'), width = 3.5 ,height = 5)
HeatmapDiag(matrix = mtx, fontsize_row = 1)
dev.off()
}