Don't worry, I was already suspecting something like this. Happens to all of us sometimes :)
This is a code i am running:
fit <- lmFit(eset,design)
This is the error I am getting
Error in rowMeans(y$exprs, na.rm = TRUE) : 'x' must be an array of at least two dimensions
This is some relevant information:
> dim(eset)
Features Samples
54675 161
> dim(design)
[1] 161 12
> typeof(eset)
[1] "S4"
> typeof(design)
[1] "double"
Thanks!
2 answers
This is solved thank you for your help. I'm sorry I took up so much of both your time. It was as simple as reinstalling the limma package.
Thank you so much for your help, its been essential!
Not sure what is happening on your end. I downloaded the data from https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE5281 (at the bottom, the entire GSE5281_RAW.tar), unpacked it and then ran this code (conditions are just random because I have no clue what this experiment is about). I am not sure what some of your code lines were doing so I suggest you simply stick with this below, which is also almost 100% what the limma guide suggests:
library(oligo)
library(limma)
CELFiles <- list.files("~/Downloads/GSE5281_RAW/",full.names=TRUE, pattern = "CEL.gz")
RawData <- oligo::read.celfiles(CELFiles)
PreProcessedData<- oligo::rma(RawData)
# just some dummy condition:
condition <- data.frame(Group=c(rep("control", 100), rep("treatment", 61)))
# model.matrix:
design <- model.matrix(~Group, data = condition)
# fit the linear model
fit <- lmFit(PreProcessedData,design)
# empirical Bayes
eB <- eBayes(fit)
# results
topTable(eB, coef = 1)
Do you use Mac OS, because even when i run this lmfit is not working. Could this be a Mac issue. Im going to try to download the data again.
EDIT: I still get the same error
setwd("/Users/ashaypatel/Desktop/Research/GSE5281") #Set Working directory
celpath<-"~/Desktop/Research/GSE5281" #Set path to cel files
CELFiles <- list.files(celpath,full.names=TRUE, pattern = "CEL")
RawData <- oligo::read.celfiles(CELFiles)
PreProcessedData<- oligo::rma(RawData)
condition <- data.frame(Group=c(rep("control", 100), rep("treatment", 61)))
design <- model.matrix(~Group, data = condition)
fit <- lmFit(PreProcessedData,design)
I get the error:
> fit <- lmFit(PreProcessedData,design)
Error in rowMeans(y$exprs, na.rm = TRUE) : 'x' must be an array of at least two dimensions
Same error!?- that is bizarre. You have tried this in a fresh R session? Also avoid RStudio if you can - I never use it for analyses.
I presume that you can obtain the data like this:
library(Biobase)
library(GEOquery)
# load series and platform data from GEO
gset <- getGEO("GSE5281", GSEMatrix =TRUE, getGPL=FALSE)
if (length(gset) > 1) idx <- grep("GPL570", attr(gset, "names")) else idx <- 1
gset <- gset[[idx]]
What do you use instead of RStudio?, I did try a fresh r ression. I'll try restarting my computer
RStudio is totally fine, so is Mac. There might be a few situations where RStudio might be undesirable, e.g. in the context of running forked processes, but this is not relevant here.
Yes, the example I showed was done on a Mac (10.14, R 4.0.2), there is something odd going on on your end. I suggest you reinstall the relevant packages, redownload the data and try again.
I use the standard R environment, on Ubuntu 16.04.
Log in to answer this question.
What is the output of:
Thank you. So, it is an ExpressionSet. How was it produced (show all code, please)? How was
designproduced?Thanks, I think that it relates to the annotation part. Can you confirm that this works:?
?
This particular command is likely messing up your ExpressionSet object:
This works:
This does not work:
I tried getting rid of:
does not seem to change anything
Are you sure? If you literally do this, it produces the same error?
If so, then the error is with your
designobject. Please double check it.Also output
sessionInfo()I get the same exact error even with the code you just posted.
What do you think is wrong my design object, the dimensions seem to be fine and my contrast matrix correctly identifies comparisons?
Okay, how about:
The head command should really have worked. I am getting the feeling that this is an issue with Mac OS.
Does this not even work:
Sorry, because my account is new, it woudn't let me post more. No this does not work. I did recently update my mac os to catalina 10.15.6
At this point, you will have to provide some test data so that I can test it here. This can simply mean pasting some data here and then showing how the error is reproduced upon using this test data
So I fixed that error. It seems to be one of data type which is strange. If I use PreProcessedDataframe instead of PreProcessedData is works. However now I need help with annotation. It won't let me use fdata to annotate
here is my code: ```
```
Sorry I don't know how to insert block code!
Also what I mean is that I have the data in terms of affymetrix probes and not genes, how do I get genes. I know my .db package but the method I used to use using fdata does not work, it relies on PreProcessedData (an expression set) rather than PreProcessedData_dataframe.
Also the documentation says that lmfit should be able to take an expression set so its strange.
Thank you.
This is the first time that you indicate that this is public GEO data. In that case, please see the solution by my colleague;