make_FC.pval_plot: Plot FC-p value heatmap

View source: R/FC.pval.R

make_FC.pval_plotR Documentation

Plot FC-p value heatmap

Description

Plot grid of FC values as fill (with color scale) and p-value as stars/numbers in the centre of each tile.

Usage

make_FC.pval_plot(
  df,
  x_lab = "",
  y_lab = "",
  plot_title = "",
  out_dir = ".",
  pval.label = "p.signif",
  gradient_palette = "RdBu",
  group_name_sep = "/",
  trim_x = 3,
  pval_size = 8,
  pval_color = "white",
  log2FC = F,
  scale_FC = "cap_outliers",
  rescale_to = c(0, 1),
  x_axis_angle = 0,
  save.to.file = F,
  font_size = 10,
  line_size = 1,
  alphabetical_row = F
)

Arguments

df

A data frame with these exact columns 1) group (ie. group comparisons on x-axis), 2) p.value, 3) Fold.change, 4) Var (y-axis), created using make_FC.pval_df.

plot_title

Title of plot.

out_dir

The output directory where the plot will be saved, default is current working directory.

pval.label

How p-values are represented. Allowed values are "p.signif" (stars) and "p.format" (number).

gradient_palette

RColorBrewer palette for fold-change values. See RColorBrewer::display.brewer.all() for all options.

group_name_sep

A character indicating how the labels for groups should be presented, "/" in low/high

trim_x

Number, indicating the number of characters for each part (that is, length of truncated output string).

pval_size

Size of p-values.

pval_color

Color of p-values.

log2FC

Logical (TRUE/FALSE). Should log2 transformation be applied to Fold.change column before plotting?

scale_FC

Either "scale_column", "scale_row", "none", or "cap_outliers" (default). Should scale be applied to FC for each group (column), Var (row)? In "cap_outliers", non-outliers are unscaled, but upper and lower outliers (points outside 1st/3rd quartiles respectively) become upper and lower values of range of non-outliers.

rescale_to

A numeric vector of length 2, indicating lower and upper limits of scale. Default is 0 to 1: c(0,1). Only applied if "scale_FC" parameter is not "none".

x_axis_angle

Angle of the x-axis label. Default is 0 (horizontal), 90 is vertical.

save.to.file

If TRUE, save plot to file in out_dir. If FALSE, print to panel.

font_size

The size of text labels plot. legend title. The size of plot title, axis text, legend text is font_size. The size of plot subtitle is font_size / 1.5.

line_size

The thickness of grid lines.

alphabetical_row

Logical; should the y axis be sorted alphabetically or preserve the order of df$Var?

xlab

X axis label.

ylab

Y axis label.

Value

Plot object if save.to.file is FALSE.

Example of input data frame

group p.value Fold.change Var neo/non 0.6747883 1.5617445 CD11B neo/non 0.4820339 1.7443427 CD3 neo/non 0.9082967 1.0589647 CD4 neo/non 0.9691466 0.9896168 CD45


kazeera/hourglass documentation built on April 5, 2025, 7:18 a.m.