calcLogVal: Calculate log value of RNAseq columns

Description Usage Arguments Value Author(s) Examples

Description

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

Usage

1
2
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, as they will be called to grep.

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.

Author(s)

Mark Peterson

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## 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)

}

rnaseqWrapper documentation built on May 2, 2019, 5:58 a.m.