clusFigs: k-means clustered figures

View source: R/clusFigs.R

clusFigsR Documentation

k-means clustered figures

Description

This function is for use with more than one results object. Combine the results from multiple comparisons by clustering genes based on their log2 fold changes between conditions for each comparison. This function will create a clustered heatmap and bar plot of the average log2 fold-change in each cluster.

Usage

clusFigs(
  resList,
  numClus,
  title = "Clustered Results",
  labgenes = "",
  col = "Dark2",
  hmcol = NULL,
  avgExp = FALSE,
  con = NULL,
  showStat = TRUE,
  retStat = FALSE
)

Arguments

resList

A list of results data frames. names(resList) will be used

numClus

Number of k-means clusters to cluster the results

title

Character indicating the titles of the plots to be made

labgenes

Character vector corresponding to rownames in resList of genes to label in heatmap

col

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

hmcol

Colour Ramp Palette of length 100 indicating the colour palette of the heatmap. Leave NULL for default.

avgExp

Boolean. If set to TRUE, resList should actually be an average expression matrix instead of list of DESeq2 results objects. (See AvgExp())

con

Character indicating the control condition (equal to one of names(resList), or the colnames of the average expression matrix) to order the clusters from greatest to smallest average. Default is NULL for no ordering. Can also be releveled after using BinfTools:::clusRelev().

showStat

Boolean. If set to TRUE, significance symbols will be shown for significant contrasts in boxplot.

retStat

Boolean. If set to TRUE, stats for contrasts (p-values and FDR) will be returned for each cluster along with results in a list object.

Value

A data frame of log2FoldChanges for each comparison as columns (rows are genes) and a column named "cluster" indicating the cluster each gene belongs to. Two figures: a Heatmap of log2FoldChange of each gene ordered into clusters and a bar plot of the average log2FoldChange in each cluster (+/- SD) by comparison.


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