featurePlot: Plot association between abundance of a feature and predictor

View source: R/featurePlot.R

featurePlotR Documentation

Plot association between abundance of a feature and predictor

Description

Plot association between abundance of a feature and predictor, modified if paired and covars are available

Usage

featurePlot(
  data,
  predictor,
  paired = NULL,
  covars = NULL,
  feature = NULL,
  relative = TRUE,
  logScale = FALSE,
  delta = 0.001,
  covar.quant = c(0, 1/3, 2/3, 1)
)

Arguments

data

Either a matrix with counts/abundances, OR a phyloseq object. If a matrix/data.frame is provided rows should be taxa/genes/proteins and columns samples, and there should be rownames

predictor

The predictor of interest. Either a Factor or Numeric, OR if data is a phyloseq object the name of the variable in sample_data(data) in quotation.

paired

For paired/blocked experimental designs. Either a Factor with Subject/Block ID for running paired/blocked analysis, OR if data is a phyloseq object the name of the variable in sample_data in quotation.

covars

Either a named list with covariates, OR if data is a phyloseq object a character vector with names of the variables in sample_data(data)

feature

Name of feature to plot. Should be in rownames of data (or taxa_names(data) if data is a phyloseq object)

relative

Logical. If TRUE (default) abundances are made relative

logScale

Logical. Should abundances be log10-scaled? After normalization if relative is TRUE. Default FALSE

delta

Pseudocount for log10 normalization

covar.quant

Quantiles for cutting quantitative covars

Details

Boxplot for categorical variables, points and smooth line for quantitative variable. If a paired variable is supplied, it is always plotted as points with lines grouped by the paired variable If covars are supplied data is split in facets. Quantitative covars are cut in intervals according to the quantiles given in covar.quant

Value

A ggplot

Examples

# Create random count_table and predictor
set.seed(5)
mat <- matrix(rnbinom(500, size = 0.1, mu = 500), nrow = 50, ncol = 10)
pred <- c(rep("Control", 5), rep("Treatment", 5))
rownames(mat) <- 1:50

featurePlot(mat, pred, feature = "5")

Russel88/DAtest documentation built on March 24, 2022, 3:50 p.m.