Error in R Script
1
0
Entering edit mode
5.4 years ago
786 ▴ 50

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
R affy limma bioconductor • 2.3k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
3
Entering edit mode
5.4 years ago
Ar ★ 1.1k

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)

ADD COMMENT
0
Entering edit mode

I got the same error by running this command..Can you please help me more?

ADD REPLY
2
Entering edit mode

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
ADD REPLY
0
Entering edit mode

It worked but I need gene names too in my results how can I get them??

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
1
Entering edit mode

Thank u so much for our help.

ADD REPLY
1
Entering edit mode

https://biodbnet-abcc.ncifcrf.gov/db/db2db.php is a nice tool to convert prob-id to gene symbol

ADD REPLY
0
Entering edit mode

Thanx alot fr your help.

ADD REPLY
0
Entering edit mode

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?

ADD REPLY
0
Entering edit mode

Com'on.. you need to define the group first.. i.e. which sample belongs to which group. Read about limma first and try to understand the code. Please think and apply. I am sure you don't want yourself to be spoon-fed.

ADD REPLY
0
Entering edit mode

It is never a good idea to ask a new unrelated question in an existing thread. Please start a new thread.

ADD REPLY
0
Entering edit mode

Sorry If I ask such a question in a new thread the Admins will close my post abruptly because they supposed me as a spoon-feed OP :)

ADD REPLY

Login before adding your answer.

Traffic: 1771 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6