get_hm_clust: Get data frame of genes per cluster from ComplexHeatmap...

View source: R/get_hm_clust.R

get_hm_clustR Documentation

Get data frame of genes per cluster from ComplexHeatmap output

Description

Get data frame of genes per cluster from ComplexHeatmap output

Usage

get_hm_clust(dat, hm, dimension)

Arguments

dat

Ordered and scaled matrix of gene counts

hm

ComplexHeatMap output specified with draw(h)

dimension

Row or column clusters

Value

Data frame of genes per row/column, which row or column they owe to, and which cluster number

Examples

library(ComplexHeatmap)
library(dplyr)
library(tidyr)
library(tibble)

hm.dat <- example.model$lme %>%
          select(gene, variable, pval) %>%
          pivot_wider(names_from = variable, values_from = pval) %>%
          column_to_rownames("gene") %>% as.matrix()
example.hm <- Heatmap(hm.dat, row_km=3, column_km=2)
example.hm <- draw(example.hm)

row_clust <- get_hm_clust(dat = hm.dat,
                        hm = example.hm, dimension = "row")
column_clust <- get_hm_clust(dat = hm.dat,
                        hm = example.hm, dimension = "col")

BIGslu/BIGpicture documentation built on Oct. 14, 2024, 9:30 p.m.