ezheat: Plot heatmap

View source: R/ezheat.R

ezheatR Documentation

Plot heatmap

Description

Draw heatmap using pheatmap package.

Usage

ezheat(
  object,
  pheno.df = NULL,
  labrows = rownames(object),
  labcols = colnames(object),
  main = "Log2 Expression",
  name = "topgenes_heat",
  sc = "ctr",
  clip = NA,
  color.v = NULL,
  unique.rows = FALSE,
  only.labrows = FALSE,
  ntop = NULL,
  stat.tab = NULL,
  cutoff = 0.05,
  reorder_rows = FALSE,
  reorder_cols = FALSE,
  gaps_row = NULL,
  gaps_col = NULL,
  annotation_row = NA,
  annotation_colors = NA,
  angle_col = c("270", "0", "45", "90", "315"),
  fontsize_row = 10,
  fontsize_col = 10,
  na.lab = c("---", ""),
  plot = TRUE,
  width = 7,
  height = 7,
  verbose = FALSE
)

Arguments

object

Matrix-like object with features (e.g. genes) as rows and samples as columns.

pheno.df

Data frame with rows as samples and columns as phenotypes.

labrows

Labels for rows, e.g. gene symbols. This can be of length 1 (in which case it is recycled), of length nrow(object).

labcols

Labels for columns. This can be of length 1 (in which case it is recycled), of length ncol(object).

main

Main title of plot.

name

Name of file to create. Set to NA to plot to screen instead of to file.

sc

Row scaling. Should rows be centered ('ctr'), z-scored ('z'), or neither ('none').

clip

Values with magnitude > clip are reset to value clip. If given, must be > 0.

color.v

Color palette for heatmap. If NULL, it's set to colorRampPalette(rev(brewer.pal(n=9, name='RdYlBu')))(50).

unique.rows

Logical; remove duplicated row labels to make rows unique?

only.labrows

Logical; only include rows where labrows aren't missing (missing is defined by na.lab)?

ntop

Scalar number of rows to include.

stat.tab

Matrix-like object with statistics, such as p-values, per column, used to add "*". If given, its dimensions should match object and it cannot have NAs.

cutoff

Cutoff such that elements with stats.tab < cutoff show asterisk if stats.tab and cutoff are not NULL.

reorder_rows

Logical; should rows be reordered with hierarchical clustering?

reorder_cols

Logical; should columns be reordered with hierarchical clustering?

gaps_row

vector of row indices after which to insert gaps.

gaps_col

vector of column indices after which to insert gaps.

annotation_row

data frame that specifies the annotations shown on left side of the heatmap. Each row defines the features for a specific row. The rows in the data and in the annotation are matched using corresponding row names. Note that color schemes takes into account if variable is continuous or discrete.

annotation_colors

list for specifying annotation_row and annotation_col track colors manually. It is possible to define the colors for only some of the features. See pheatmap examples.

angle_col

angle of the column labels, right now one can choose only from few predefined options (0, 45, 90, 270 and 315)

fontsize_row

Font size for row labels.

fontsize_col

Font size for column labels.

na.lab

Character vector of labels in lab.col to treat as missing, in addition to NA.

plot

Logical; should plot be generated?

width

Manual option for determining the output file width in inches.

height

Manual option for determining the output file height in inches.

verbose

Logical; print pruning messages to console?

Details

main is modified to describe data transformations.

If the data after scaling and clipping (if they are used) has positive and negative values, the key is made symmetric about zero.

object cannot have NAs.

Value

A list with element mat of the matrix of values plotted, and if plot=TRUE element gtable, containing the gtable object returned by pheatmap.


jdreyf/ezlimmaplot documentation built on Feb. 8, 2025, 2:25 a.m.