PrepareExpression: PrepareExpression

Description Usage Arguments Details Value Author(s) Examples

View source: R/aveytoolkit_PrepareExpression.R

Description

Takes in an expression matrix or data frame and prepares it for further analysis

Usage

1
2
3
4
5
6
7
8
PrepareExpression(
  eset,
  target,
  returnProbes = TRUE,
  labelColumn = "Label",
  select = colnames(target),
  collapse = "."
)

Arguments

eset

expression information and (potentially) other columns

target

target file where the column names of eset can be matched to 'Label'

returnProbes

whether probe mapping should be returned along with expression values in a list. This will only be returned correctly if there is a column of eset matching SYMBOL in any case.

labelColumn

the column name in the target file to use for matching the column names of eset. Default is "Label"

select

the column names of target to select and merge as the new column names of eset

collapse

Details

Wrote this to automate the few lines I always perform to "prepare" an expression set for further processing. I always want to remove the symbols column, rename the column names based on the target file, and (usually) change the rownames to be gene symbols. This function takes in the matrix format that I use to store processed expression files (in a pacakge or file).

Value

if returnProbes is FALSE: a list of the prepared expression data frame (exprDat) and the (potentially modified) target data frame (target) . if returnProbes is TRUE (default): a list of three elements including the two above and probeMap (a vector mapping from gene symbols to probe names).

Author(s)

Stefan Avey

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Creating fake expression matrix
dat <- matrix(rnorm(1000, mean=8, sd=1), nrow=100, ncol=10)
colnames(dat) <- sample(letters[1:10], size=10)
fakeGenes <- as.vector(outer(LETTERS[1:26], LETTERS[1:26], paste0))
x <- data.frame(symbol=fakeGenes[1:nrow(dat)], dat, row.names=paste0("Probe_", 1:nrow(dat)))
head(x) # look at first 6 rows of toy data set
target <- data.frame(Label=letters[1:26], Class=rep(1:3, length.out=26))
head(target)

prepList <- PrepareExpression(x, target, select="Class")
head(prepList$exprDat)
head(prepList$target)
head(prepList$probeMap)

## Not run: 
## Load expression data from HIPC package
library(HIPC)
data(y3ExprPBMC, y3Target)
prepList <- PrepareExpression(y3ExprPBMC, y3Target,
                              select=c("Response", "SubjectID", "Age", "Time"))

## End(Not run)

stefanavey/aveytoolkit documentation built on March 5, 2020, 12:49 a.m.