I got the same error by running this command..Can you please help me more?
Hi I was retrieving differentially expressed genes through R and got an error at the very last step. Please help me out in removing following error it will be very helpful.
Error
results= topTable(fit2, adjust ='BH', number = nrow(gse32269eset))
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 54675, 22283
1 answer
try using: topTable(fit2, adjust ='BH', number = Inf)
I think you are filtering some probes or aggregating the probes due to which there is a difference in the number of rows between fit2 and nrow(gse32269eset)
I am not sure but it is working for me. I presume that you are using GSE32269
> exprs = exprs(eset)
> dim(exprs)
[1] 22283 55
> design <- model.matrix(~ type + Tmprss2.erg + 0, as.data.frame(group))
> head(design)
typePrimary typeMet typeNormal Tmprss2.ergPositive
1 1 0 0 0
2 1 0 0 0
3 1 0 0 0
4 1 0 0 0
5 1 0 0 0
6 1 0 0 0
> cont.matrix <- makeContrasts(NormalvsPrimary = typePrimary-typeNormal, levels=design)
> print(cont.matrix)
Contrasts
Levels NormalvsPrimary
typePrimary 1
typeMet 0
typeNormal -1
Tmprss2.ergPositive 0
> fit1 <- lmFit(exprs, design)
> fit2 <- contrasts.fit(fit1, cont.matrix)
> fit2 <- eBayes(fit2)
> results <- topTable(fit2, "NormalvsPrimary", number=Inf)
> head(results)
logFC AveExpr t P.Value adj.P.Val B
201596_x_at 6.359687 10.604378 18.36430 9.175354e-25 2.044544e-20 45.75283
215054_at -1.735632 5.432611 -17.25748 1.593483e-23 1.775379e-19 43.02282
211820_x_at -2.799107 4.629426 -16.60052 9.224250e-23 6.374164e-19 41.33593
206207_at -4.621926 6.161970 -16.52111 1.144220e-22 6.374164e-19 41.12856
206676_at -5.027171 4.179033 -16.01332 4.615017e-22 2.056728e-18 39.78449
204959_at -5.102275 4.839911 -15.76017 9.351825e-22 3.473112e-18 39.10262
It worked but I need gene names too in my results how can I get them??
You need annotation file from Affymetrix and then map it to the probes. You may also use David to convert them to gene ids/gene symbol.
Thank u so much for our help.
https://biodbnet-abcc.ncifcrf.gov/db/db2db.php is a nice tool to convert prob-id to gene symbol
Thanx alot fr your help.
Sorry I have ovary cancer samples stage 1, 2, 3 and normal samples
I was going to have something like your above code resulted in P.value , adj.P.Val , logFC
I did like below
library(limma)
library(affy)
Data<-ReadAffy()
eset<-rma(Data)
exprs<-exprs(eset)
dim(exprs)
[1] 54675 4
design <- model.matrix(~ type + Tmprss2.erg + 0, as.data.frame(group))
Error in as.data.frame(group) : object 'group' not found
Actually I was going to compare normal with rest of cancers in 3 stages but I got error
how I can have your top table please?
Log in to answer this question.
I think It's related to selecting the number of DEGs,why you select all the prob-id in your GSE? try with a number,lets say 100, I suggest you specify log fold change for your topranked gene e.g logFC=0.05