Hi. I want to use the genefilter library to perform simple t-tests for each gene comparing across leukemia and normal samples. And I need the pvalues, so here is the code I have used to prepare the rowttest:
library(leukemiasEset)
library(preprocessCore)
library(genefilter)
library(qvalue)
library(org.Hs.eg.db)
data(leukemiasEset)
table(leukemiasEset$LeukemiaType)
##quantile normalization on the expression data
lenorm = normalize.quantiles(exprs(leukemiasEset)) # quantile normalization
rownames(lenorm) = rownames(exprs(leukemiasEset)) # add row names
colnames(lenorm) = colnames(exprs(leukemiasEset)) # add column names
exprs(leukemiasEset) = lenorm # overwrite initial exprs
boxplot(exprs(leukemiasEset))
##Subset the leukemiasEset data to include only samples from chronic myeloid leukemia, CML ("CML"), and normal samples ("NoL") into a new ExpressionSet, cml_normal
cml_normal = leukemiasEset[, leukemiasEset$LeukemiaType %in% c("CML", "NoL")]
cml_normal$LeukemiaType = factor(cml_normal$LeukemiaType)
##set the reference level to be our normal samples:
cml_normal$LeukemiaType = relevel(cml_normal$LeukemiaType, "NoL")
factor(cml_normal$LeukemiaType)
##This code maps the ENSEMBL IDs to gene symbols and ENTREZ IDs and adds them to the feature data
library(org.Hs.eg.db)
symbols = mapIds(org.Hs.eg.db, rownames(cml_normal), keytype = "ENSEMBL", column="SYMBOL")
ids = mapIds(org.Hs.eg.db, rownames(cml_normal), keytype = "ENSEMBL", column="ENTREZID")
fData(cml_normal)$symbol = symbols
fData(cml_normal)$gene_id = ids
fData(cml_normal)
Now, I know a rowttests would look like this: rtt=rowttests(exprs(leukemiasEset), factor(cml_normal$LeukemiaType) ). However, I get the following error: Error in rowcoltt(x, fac, tstatOnly, 1L, na.rm) : length(fac)=24, ncol(x)=60, should be the same.
I don't know what could be wrong and how to correct that factor as to obtain the test. Any help would be welcome