exprLFC: Log2 fold change heatmap

Description Usage Arguments Details Value Author(s) Examples

View source: R/exprLFC.R

Description

Create single column heatmap of log2 fold change across two conditions Needs plotly

Usage

1
2
3
4
exprLFC(exprDataFrame, sampleGroups, genes = NULL, absVal = FALSE,
  yticklabSize = 8, figHeightPerGene = 20, figWidth = 200,
  colorsPlot = colorRamp(c("blue", "green")), ncolors = 5,
  plotTitle = "Log2 FC", minVal = NULL, maxVal = NULL, fileOut = NULL)

Arguments

exprDataFrame

Data frame - Gene x sample expression values (counts, tpm, whatever)

sampleGroups

List - Two elements, each containing indices of samples in exprDataFrame

genes

Character? -

yticklabSize

Numeric - Font size for gene symbols

figHeightPerGene

Numeric -

figWidth

Numeric -

colorsPlot

Color ramp -

ncolors

Numeric -

plotTitle

String -

minVal

Numeric -

maxVal

Numeric -

fileOut

String - If given, save png to with this filename

Details

Given a gene-by-sample dataframe with expression values, a list with two vectors indicating samples in each of two groups, and (optionally) a list of the genes you want included, make a one-column heatmap of log fold change across the group means for each gene, using plotly. Note that, probably because I'm not set up to do the paying thing, some stuff doesn't get incorporated into the output png. Fold change will be group2 / group1 (so if you put a control condition in group 1, the sign will be positive if expression increased in the treatment condition, not that that changes anything in the heatmap since we'll show abs(LFC)). A pseudocount of 1 is added to all values before taking the means of the two conditions. This means that genes with an original count of 0 get a log2(count) of 0 rather than an infinite value.

Value

Plotly object

Author(s)

Emma Myers

Examples

1
2
3
4
5
6
7
exprData = read.table("Rorb_p2_TPM.csv", header=TRUE, row.names=1, sep=",")
colnames(exprDataFrame) = gsub("BF_RORb", "", colnames(exprDataFrame))
geneList = c("Rorb", "Plxnd1", "Has2", "Sparcl1", "Pde1a", "Has3")
groups = vector("list", 2)
groups[[1]] = colnames(exprDataFrame)[1:4]
groups[[2]] = colnames(exprDataFrame)[5:8]
exprLFC(exprData, genes=geneList, sampleGroups=groups, fileOut="exprLFC.png")

e-myers/rnaseq documentation built on May 20, 2019, 9:14 p.m.