count_plot: A function to make a plot of normalized counts

View source: R/count_plot.R

count_plotR Documentation

A function to make a plot of normalized counts

Description

This function takes normalized counts of specific genes from a DESeq2 counts object, scales them, and creates a plot with pairwise t-tests by condition

Usage

count_plot(
  counts,
  scaling = "zscore",
  genes,
  condition,
  con = NULL,
  title = "expression",
  compare = NULL,
  col = "Dark2",
  method = "ind",
  pair = FALSE,
  pc = 1,
  yax = NULL,
  showStat = TRUE,
  style = "violin",
  sinaPoint = T,
  textsize = NULL,
  retStat = FALSE,
  retGP = FALSE
)

Arguments

counts

Normalized counts from a DESeq2 object - use 'counts(dds, normalized=TRUE)'

scaling

Method used to scale counts per gene across samples. 'zscore', 'log10', or 'none'. Default is 'zscore'

genes

Character vector of genes to subset from counts. Must correspond with rownames(counts).

condition

Character vector of conditions in DESeq2 object. Must be in order of columns (counts).

con

Character indicating the control condition. (To be displayed first in plot). Default NULL.

title

Character vector indicating title of plot. Defaults to "expression"

compare

List of character vectors (each of length 2) indicating pairwise comparisons. If NULL, all possible comparisons will be made. Default is NULL

col

Character indicating the RColorBrewer palette name or list of colours (hex, name, rgb()) to be used. Default is "Dark2"

method

Character indicating what to plot. One of "ind", "mean", "geoMean", or "median", or ".perMean". Defaults to "ind" for individual data points (one point per sample).

pair

Boolean indicating if t-test should be independent (FALSE; default) or paired (TRUE).

pc

Numeric indicating the pseudocount to be added when scaling="log10". Default=1.

yax

Character indicating the y-axis label. Leave NULL if going with default axis label.

showStat

Boolean indicating if statistics should be plotted.

style

Character indicating the style of plot ("violin", "box"). Defaults to "violin".

sinaPoint

Boolean indicating if sina points should be shown. Only when style="violin".

textsize

Numeric indicating text size for the plot. Leave NULL for default.

retStat

Boolean indicating if the stats should be returned

retGP

Boolean indicating if ggplots2 object should be returned for further editing. Default=FALSE

Value

Generates a violin or box plot


kevincjnixon/BinfTools documentation built on July 10, 2024, 11:46 a.m.