Learn R Programming

rnaseqWrapper (version 1.0-1)

DESeqWrapper: A wrapper for DESeq

Description

This function provides a useful wrapper for the DESeq package, automating several of the manual steps to provide a basic DE analysis.

Users should use this as a guide, not necessarily as a final analysis.

The functions plotDE and plotDispEsts are only called from within this function.

Usage

DESeqWrapper(countData, conditions, whichGeneNames = 0, outNamePrefix = "DESeqOutputs", comps = "allPairwise", conds = NULL, colorSet = NULL, makePDFs = TRUE, writeScaled = FALSE, writeDE = TRUE, pCut = 0.05, dispMethod = "pooled", dispSharingMode = "maximum")

Arguments

countData
A data.frame or matrix with raw count data for each gene (row) and sample (column).
conditions
Character vector with the groups to be analyzed.
whichGeneNames
Numeric or character, which column has the gene names. Defaults to 0, which is rownames (preferred).
outNamePrefix
A string to prepend to written files; can included path specification.
comps
character vector of which contrasts to run in the format 1vs2 with numbers matching order of conditions above
conds
A character vector of the conditions for each column, matching the order of the columns in countData. If "NULL" (default) the function will use grep on conditions against column names to automatically generate the groups
colorSet
Vector of colors, specified in any valid R format, to use as labels for the conditions. If "NULL" (default), default colors will be used.
makePDFs
Logical, should figures be output as pdfs. If false, no figures will be generated.
writeScaled
Logical, should the scaled countData be written as a .txt file.
writeDE
Logical, should the DE results be written as .txt files.
pCut
What (FDR-corrected) q-value should be used as a cut-off.
dispMethod
Which method should be used for estimating dispersion by DESeq? See estimateDispersions for details and available options.
dispSharingMode
Which sharing mode should be used for estimating dispersion by DESeq? See estimateDispersions for details and available options.

Value

Writes txt and pdf files as run, and returns a list with:
deOutputs
A list with one data.frame for each contrast analyzed
normalizedReads
The normalized read data
isSignificant
A data.frame telling whether each gene is sig for each contrast

Examples

Run this code
## Only run if DESeq is available
if(require(DESeq)){

## Create an example count data set
exampleCounts <- counts(makeExampleCountDataSet())[1:500,]

## Note, from your data, this might look like:
# exampleCounts <- myInputData[,grep("READS",names(myInputData))]
# row.names(exampleCounts) <- myInputData$geneNameColumn

## Note, outputs save to disk are turned off
## Set each to TRUE to save to your working directory
test <- DESeqWrapper(exampleCounts,
                     conditions=c("A","B"),
                     writeScaled=FALSE,
                     writeDE=FALSE,
                     makePDFs=FALSE)

## Look at the outputs
head(test$deOutputs$AvsB)
head(test$normalizedReads)
head(test$isSignificant)

}

Run the code above in your browser using DataLab