simpleheatmap3: heatmap3 facade

Description Usage Arguments Examples

View source: R/simpleheatmap3.R

Description

heatmap3 facade

Usage

1
2
3
4
5
6
simpleheatmap3(pln, main = "", distf = dist, hclustf = hclust,
  labRow = "", labCol = "", palette = getBlueWhiteRed(),
  margins = c(5, 5), scale = "none", plot = TRUE,
  nrOfClustersCol = 3, nrOfClustersRow = 3,
  suppressColSideCols = FALSE, ColSideLabs = "", RowSideLabs = "",
  ...)

Arguments

pln

matrix or dataframe with numerical values

main

title

distf

distance function

hclustf

clustering function

labRow

row labels

labCol

column labels

palette

color palette

margins

control margins of heatmap

scale

c(row, column or none)

plot

logical; If TRUE simpleheatmap3 returns modified heatmap3 object, if FALSE returns a data.frame with clusterIDs. Default is TRUE

nrOfClustersCol

number of distinct clusters for cutree function on columns. Default is 3

nrOfClustersRow

number of distinct clusters for cutree function on rows. Default is 3

suppressColSideCols

Option to suppress color side labelling per default

ColSideLabs

label for ColSideColors

RowSideLabs

label for RowSideColors

...

other parameters to heatmap3

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
df <- matrix(rnorm(150), ncol = 10) # 15x10 matrix without NAs

clust <- simpleheatmap3(pln = df,
                        main = "",
                        distf = dist,
                        hclustf = hclust,
                        labRow = "",
                        plot = FALSE,
                        nrOfClustersRow = 3,
                        suppressColSideCols = TRUE) 
# plot = F will return a list containing two data.frames 
# with the specified number of distinct clusters in nrOfClustersRow
# and nrOfClustersCol
clust
hmp3 <- simpleheatmap3(pln = df,
                       main = "",
                       distf = dist,
                       hclustf = hclust,
                       labRow = "",
                       plot = TRUE,
                       nrOfClustersRow = 3, 
                       nrOfClustersCol = 3, 
                       suppressColSideCols = FALSE)
# plot = TRUE will result in the same list and additionally plot the heatmap. 
# suppressColSideCols = FALSE will leave the heatmap with ColSideColors

stopifnot(all(clust$Row$clusterID==hmp3$Row$clusterID))

df[3,1:7] <- NA # Seed some missing values in line 3

hmp3_withNAs <- simpleheatmap3(pln = df,
                       main = "",
                       distf = dist,
                       hclustf = hclust,
                       labRow = paste0("ABC", 1:nrow(df)),
                       plot = TRUE,
                       nrOfClustersRow = 3, 
                       nrOfClustersCol = 3, 
                       suppressColSideCols = TRUE)
                       
# Since line 3 contained more than ncol(df)/2 missing values 
# it is removed from the clustering.

stopifnot(! 3 %in% hmp3_withNAs$Row$rowID)
hmp3_withNAs <- simpleheatmap3(pln = df,
                       main = "",
                       distf = dist,
                       hclustf = hclust,
                       labRow = paste0("ABC", 1:nrow(df)),
                       plot = TRUE,
                       nrOfClustersRow = 3, 
                       nrOfClustersCol = 3, 
                       suppressColSideCols = FALSE)
                       

protViz/quantable documentation built on Nov. 29, 2021, 10:07 a.m.