plotSimilarityMatrix: Plot similarity matrix with pheatmap

Description Usage Arguments Value Author(s) Examples

View source: R/plot-similarity-matrix.R

Description

Plot similarity matrix with pheatmap

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
plotSimilarityMatrix(
  X,
  y = NULL,
  clusLabels = NULL,
  colX = NULL,
  colY = NULL,
  myLegend = NULL,
  fileName = "posteriorSimilarityMatrix",
  savePNG = FALSE,
  semiSupervised = FALSE,
  showObsNames = FALSE,
  clr = FALSE,
  clc = FALSE,
  plotWidth = 500,
  plotHeight = 450
)

Arguments

X

Similarity matrix.

y

Vector

clusLabels

Cluster labels

colX

Colours for the matrix

colY

Colours for the response

myLegend

Vector of strings with the names of the variables

fileName

If savePNG is TRUE, this is the string containing the name of the output file. Can be used to specify the folder path too. Default is "posteriorSimilarityMatrix". The extension ".png" is automatically added to this string.

savePNG

Boolean: if TRUE, the plot is saved as a png file. Default is FALSE.

semiSupervised

Boolean flag: if TRUE, the response is plotted next to the matrix.

showObsNames

Boolean. If TRUE, observation names are shown in the plot. Default is FALSE.

clr

Boolean. If TRUE, rows are ordered by hierarchical clustering. Default is FALSE.

clc

Boolean. If TRUE, columns are ordered by hierarchical clustering. Default is FALSE.

plotWidth

Plot width. Default is 500.

plotHeight

Plot height. Default is 450.

Value

No return value. This function plots the similarity matrix either to screen or to a png file.

Author(s)

Alessandra Cabassi alessandra.cabassi@mrc-bsu.cam.ac.uk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Load one dataset with 100 observations, 2 variables, 4 clusters
data <- as.matrix(read.csv(system.file("extdata", "dataset1.csv",
package = "klic"), row.names = 1))
# Load cluster labels
cluster_labels <- as.matrix(read.csv(system.file("extdata",
"cluster_labels.csv", package = "klic"), row.names = 1))

# Compute consensus clustering with K=4 clusters
cm <- coca::consensusCluster(data, 4)

# Plot consensus (similarity) matrix
plotSimilarityMatrix(cm)

# Plot consensus (similarity) matrix with response
names(cluster_labels) <- as.character(1:100)
rownames(cm) <- names(cluster_labels)
plotSimilarityMatrix(cm, y = cluster_labels)

Example output



klic documentation built on July 8, 2020, 6:23 p.m.