View source: R/heatmap_functions.R View source: R/Package-Code5-Compiled.R
ExtractMatrix | R Documentation |
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.
ExtractMatrix(data, heatmap, clustered.cols = TRUE, clustered.rows = TRUE)
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 |
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.
a data matrix of the same dimensions as the input heatmap
~~Alison Moss~~
See also extractClusters, extractGaps
##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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.