signatureBoxplot: Plot a boxplot of signature genes.

View source: R/plot.R

signatureBoxplotR Documentation

Plot a boxplot of signature genes.

Description

Plot a boxplot of signature genes.

Usage

signatureBoxplot(
  inputData,
  annotationData,
  signatureColNames,
  annotationColName,
  name = "Signatures",
  scale = FALSE,
  violinPlot = FALSE,
  includePoints = TRUE,
  notch = FALSE,
  rotateLabels = FALSE,
  nrow = NULL,
  ncol = NULL,
  fill_colors = NULL
)

Arguments

inputData

an input data object. It should either be of the class SummarizedExperiment and contain the profiled signature data and annotation data as columns in the colData, or alternatively be of the classes data.frame or matrix and contain only the gene expression data. Required.

annotationData

a data.frame or matrix of annotation data, with one column. Only required if inputData is a data.frame or matrix of signature data.

signatureColNames

a vector of the column names in colData that contain the signature data. Only required if inputData is a SummarizedExperiment object.

annotationColName

a character string naming the column name in the colData that contains the annotation data to be used in making the boxplot. Only required if inputData is a SummarizedExperiment object.

name

a character string giving the title of the boxplot. The default is "Signatures".

scale

logical. Setting scale = TRUE scales the signature data. The default is FALSE.

violinPlot

logical. Setting violinPlot = TRUE creates violin plots in place of boxplots. The default is FALSE.

includePoints

logical. If TRUE, points will be included over the boxplots. The default is TRUE.

notch

logical. Notches are used to compare groups; if the notches of two boxes do not overlap, this suggests that the medians are significantly different. If TRUE, the boxplot will be notched. The default is FALSE.

rotateLabels

logical. If TRUE, the x-axis labels will be rotated. The default is FALSE.

nrow

integer giving the number of rows in the resulting array.

ncol

integer giving the number of columns in the resulting array.

fill_colors

a vector of color names to be used as the fill colors for the boxplot. If NULL, colors will be supplied via RColorBrewer. The default is fill_colors = NULL.

Value

A ggplot2 boxplot of the signature data using the provided annotation information.

Examples

library(SummarizedExperiment)

# Generate some artificial data that shows a difference in Zak_RISK_16
mat_testdata <- rbind(matrix(c(rnorm(80), rnorm(80) + 5), 16, 10,
                             dimnames = list(TBsignatures$Zak_RISK_16,
                                             paste0("sample", seq_len(10)))),
                      matrix(rnorm(1000), 100, 10,
                             dimnames = list(paste0("gene", seq_len(100)),
                                             paste0("sample", seq_len(10)))))

# Create a SummarizedExperiment object that contains the data
testdataSE <- SummarizedExperiment(assays = SimpleList(data = mat_testdata),
                                   colData = DataFrame(sample =
                                                         c(rep("down", 5),
                                                           rep("up", 5))))

# Run profiler using GSVA and ssGSEA on Zak_RISK_16 signature
res <- runTBsigProfiler(testdataSE, useAssay = "data",
                        signatures = TBsignatures["Zak_RISK_16"],
                        algorithm = c("GSVA", "ssGSEA"), parallel.sz = 1,
                        combineSigAndAlgorithm = TRUE)
signatureBoxplot(res, signatureColNames = c("GSVA_Zak_RISK_16",
                                            "ssGSEA_Zak_RISK_16"),
                 annotationColName = "sample", name = "Zak_RISK_16 Signature")


dfjenkins3/TBSignatureProfiler documentation built on Oct. 26, 2024, 1:29 a.m.