ExtractMatrix: Extract the Data Matrix from an Output Heatmap

View source: R/heatmap_functions.R View source: R/Package-Code5-Compiled.R

ExtractMatrixR Documentation

Extract the Data Matrix from an Output Heatmap

Description

Allows the user to extract the exact order of a heatmap from the output. Useful for preserving the ordering of samples or genes after clustering or often helpful for supplying supplemental information in papers.

Usage

ExtractMatrix(data, heatmap, clustered.cols = TRUE, clustered.rows = TRUE)

Arguments

data

numeric data matrix with samples/observations in the columns and genes/variables in the rows. Should be the same data supplied to the heatmap function

heatmap

Output of a heatmap generated from myHeatmap or myHeatmapByAnnotation. The heatmap generated from these functions can be saved to a variable which should serve as the input here. IMPORTANT. The heatmap supplied here MUST have show.colnames and show.rownames = TRUE.

clustered.cols

logical. should the order of the columns be extracted

clustered.rows

logical. should the order of the rows be extracted

Details

The heatmap supplied here MUST have show.colnames and show.rownames = TRUE. If the generated heatmap was a subset of the data provided as the input (a list of genes was given) this function will subset for those genes in the output.

Value

a data matrix of the same dimensions as the input heatmap

Author(s)

~~Alison Moss~~

See Also

See also extractClusters, extractGaps

Examples


##initiate_parameters
initiate_params()

##plot heatmap, ensure both colnames and rownames are being shown
heatmap <- myHeatmap(RAGP_norm, c("Kcn","Cacn","Scn","Hcn"), exact = FALSE, show.rownames = TRUE,
  show.colnames = TRUE, main = "Ion Channels")

channel.matrix <- ExtractMatrix(RAGP_norm, heatmap = heatmap)

##making a heatmap of the extracted matrix without clustering should give the same result as above
myHeatmap(channel.matrix, clust.rows = FALSE, clust.cols = FALSE)

##matrix can also be appended to other matrices or saved for other purposes

axm323/dataVisEasy documentation built on Feb. 1, 2024, 11:53 p.m.