Description Usage Arguments Value Author(s) Examples
Calculate the log value of a series of columns, allowing an offset to avoid returning "-Inf."
1 2 | calcLogVal(data, colID = "FPKM", offset = 0.1,
setBase = 2, matchEnd = TRUE)
|
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 |
offset |
How much to add before taking log to avoid returning |
setBase |
A positive number to pass to |
matchEnd |
Logical, should the |
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.
Mark Peterson
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.