Learn R Programming

rnaseqWrapper (version 1.0-1)

calcLogVal: Calculate log value of RNAseq columns

Description

Calculate the log value of a series of columns, allowing an offset to avoid returning "-Inf."

Usage

calcLogVal(data, colID = "FPKM", offset = 0.1,
           setBase = 2, matchEnd = TRUE)

Arguments

data
A matrix or data.frame containing gene (row) data for several individuals (columns).
colID
Either a numeric vector of columns to calculate the log of, or a character vector with patterns (e.g., FPKM) to match in the names of data. If a character vector, make sure the names are unique enough to match only what you want them to,
offset
How much to add before taking log to avoid returning -Inf.
setBase
A positive number to pass to log to set the logarthimic base. Defaults to setBase = 2
matchEnd
Logical, should the colId pattern only match the end of the string.

Value

  • Returns a data.frame with the log value of the desired columns.Rows match the input data, so can be appended using cbind or merge.

Examples

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

## Create sample data
## Could be reads or FPKM from your input
exampleCounts <- counts(makeExampleCountDataSet())

## Only calculate for the "2" columns
## This could be reads, if you have multiple column types
testLog <- calcLogVal(exampleCounts,
                      colID="2",
                      matchEnd=TRUE)
head(testLog)

## Calculate log of all columns
testLog2 <- calcLogVal(exampleCounts,
                       colID="*",
                       setBase=2)
head(testLog2)

}

Run the code above in your browser using DataLab