Description Usage Arguments Author(s) References Examples
View source: R/make.pheatmap.R
This function allows you to create a coloured heatmap for clusters vs markers (coloured by MFI) or clusters vs samples (coloured by MFI or cell counts). Can be set to plot 'fold-change' values (with is.fold = TRUE) that are provided in log2. make.pheatmap is a wrapper around the pheatmap function from pheatmap. Also uses the packages 'RColorBrewer' and 'scales' for colour customisation.
1 | make.pheatmap(dat, sample.col, plot.cols, annot.cols, file.name, plot.title, transpose, is.fold, fold.range, normalise, dendrograms, row.sep, col.sep, cell.size, standard.colours, path)
|
dat |
NO DEFAULT. data.frame. Clusters/populations vs markers (MFI) or Clusters/populations vs samples or (MFI or cell numbers). |
sample.col |
NO DEFAULT. Character. Specify the name of the column that indicates samples. Will be rows on heatmap. |
plot.cols |
NO DEFAULT. Character vector. Name of columns you wish to plot on the heatmap. Will be columns on heatmap. |
annot.cols |
DEFAULT = NULL. Character. Columns which contain values that you do NOT want to plot in the heatmap, e.g. sample name, group name, Live/Dead etc. |
file.name |
DEFAULT = paste0("Pheatmap by ", sample.col, ".png"). Character. What do you want to call the file, including the extension. |
plot.title |
DEFAULT = paste0(sample.col, " heatmap"). Character. |
transpose |
DEFAULT = FALSE. Logical. Do you want to transpose the heatmap. |
normalise |
DEFAULT = TRUE. Logical. Only applies to standard heatmaps (i.e. when is.fold = FALSE). TRUE to normalise each column between 0 and 1, FALSE to plot the raw values. |
is.fold |
DEFAULT = FALSE. Logical. TRUE for fold-change heatmap, FALSE for normal values heatmap. |
fold.range |
DEFAULT = NULL. Numeric vector. For fold-change heatmaps, what is the maxium and minimum values that should be plotted. Example: for a max of 3, and a minimum of -3 would b c(3,-3). Defaults to NULL (which will use the max and min within the dataset). |
dendrograms |
DEFAULT = "both". Character. Do you want to include dendrograms on columns/rows. Can be "both", "row", "column", or "none. |
cutree_rows |
DEFAULT = 1 (i.e. no divisions). Divides rows based on the level of dendrogram branches, if dendrograms = 'both' or 'row'. |
cutree_cols |
DEFAULT = 1 (i.e. no divisions). Divides columns based on the level of dendrogram branches, if dendrograms = 'both' or 'column' |
row.sep |
DEFAULT = c(). Numeric. Only used if not clustering rows. |
col.sep |
DEFAULT = c(). Numeric. Only used if not clustering columns |
cell.size |
DEFAULT = 15. Numeric. |
standard.colours |
DEFAULT = "BuPu". Character. Can also be "RdYlBu", "YlGnBu", "viridis", "magma", "inferno", "spectral", "Blues", "Reds", "Greys", or "rev(RdBu)". |
path |
DEFAULT = getwd(). The location to save plots. By default, will save to current working directory. Can be overidden. |
Thomas M Ashhurst, thomas.ashhurst@sydney.edu.au Felix Marsh-Wakefield, felix.marsh-wakefield@sydney.edu.au
https://sydneycytometry.org.au/spectre. Helpful examples at https://davetang.org/muse/2018/05/15/making-a-heatmap-in-r-with-the-pheatmap-package/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## MFI cluster vs marker heatmap
Spectre::make.pheatmap(dat = Spectre::demo.exp,
file.name = "Expression pheatmap.png",
plot.title = "Expression",
sample.col = "Population",
plot.cols = names(Spectre::demo.exp)[c(2:10)])
## Z-scrore of fold-change type heatmap
z.dat <- do.zscore(dat = Spectre::demo.sum,
use.cols = names(Spectre::demo.sum)[c(4:15)])
Spectre::make.pheatmap(dat = z.dat,
file.name = "z-score.png",
plot.title = "z-score",
sample.col = "Sample",
plot.cols = names(z.dat)[c(4:15)],
annot.cols = names(z.dat)[c(2:3)],
is.fold = TRUE,
fold.range = c(3,-3)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.