generate_heatmap: explore_heatmap.R

Description Usage Arguments Value

View source: R/generate_heatmap.R

Description

Produce heatmap of count data. uses euclidean distances (recommdended) of clr transformed data; zero replacement completed by Bayesian-multiplicative replacement

Usage

1
2
3
4
5
generate_heatmap(data, x_var, y_var, value_var, x_dist = "euclidean",
  x_hclust = "complete", y_dist = "euclidean", y_hclust = "complete",
  x_meta = NULL, y_meta = NULL, x_label = NULL, y_label = NULL,
  heatmap_w = 20, heatmap_h = 20, dendro_x_h = 8, dendro_y_w = 8,
  output)

Arguments

data

dataframe. long format, with column of xdata, variable (such as taxonomy, or compounds), and value (such as abundance or concentration)

x_var

string. variable to be heatmap x-axis. example: sample should be a column name in data

y_var

string. variable to be heatmap y-axis. example: species or compound should be column name in data

value_var

string. column containing heatmap values

x_dist

string; dist method for x dendrogram; method for computing phylogenetic distance; supplied to the dist(); default method: "euclidean" dist method options: "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski"

x_hclust

string; hclust method for x dendrogram; Linkage criteria to determine distance between sets of observations; to be used in hclust(); default method: "complete" hclust method options:"ward.D", "ward.D2", "single", "complete", "average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC)

y_dist

string; dist method for ydata dendrogram; method for computing phylogenetic distance; supplied to the dist(); default method: "euclidean" dist method options: "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski"

y_hclust

string; hclust method for ydata dendrogram; Linkage criteria to determine distance between sets of observations; to be used in hclust(); default method: "complete" hclust method options:"ward.D", "ward.D2", "single", "complete", "average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC) When set to FALSE, xdata listed along y-axis

x_meta

dataframe. default NULL. Any metadata on heatmap x axis variable (such as sample) to be included x_var should be the identifier to link metadata

y_meta

dataframe. default NULL. any metadata on heatmap y axis variable (such as species) to be included y_var should be identifier to link metadata

x_label

string. default NULL. Should be column in x_meta. How x-axis of heatmap should be labelled. When set to NULL, x_var is used

y_label

string. default NULL. Should be a column in y_meta. How y-axis of heatmap should be labelled. When set to NULL, y_var is used

heatmap_w

numeric; default 20; width (cm) of heatmap panel

heatmap_h

numeric; default 20; height (cm) of heatmap panel

dendro_x_h

numeric; default 8; height (cm) of x-axis dendrogram; helps with ensuring x-axis dendrogram labels are not cut off

dendro_y_w

numeric; default 8; width(cm) of y-axis dendrogram; helps with ensuring y-axis dendrogram labels are not cut off

output

= string; path and file name of resulting heatmap png Example: "/path/to/my_heatmap.png"

Value

pdata dataframe for heatmap ddata_x dataframe for x-axis dendrogram ddata_x dataframe for y-axis dendrogram p_hl ggplot of heatmap and legend p_x ggplot of x-axis dendrogram p_y ggplot of y-axis dendrogram g gtable grob of entire heatmap and dendrograms


schyen/somefxns documentation built on Aug. 6, 2019, 2:26 p.m.