Thank you for the reply, it is appreciated. I will definitely look into this, but first I just want to try and get an example working, that then I can tinker the details. I attempted to combine the information here and here here to come up with two solutions, but I am running into two problems.
Method 1: I have a phenotype file like this (file called "PhenotypicData"):
id,Age
GSM1330619,14
GSM1330620,14
GSM1330621,14
GSM1330622,14
GSM1330623,2
GSM1330624,2
GSM1330625,2
GSM1330626,2
and a set of .CEL.gz files in the current working directory
I was attempting to run a script:
library(Biobase)
library(affy)
library(limma)
tmp <-read.csv("PhenotypicData",header=T)
pdata <-AnnotatedDataFrame(tmp)
files <-list.files(pattern="*.gz") #I am doing this because for the justRMA command, I was getting an error saying I wasn't reading in the list of files properly, so I'm trying to make a list of files.
data_list <-lapply(files,read.table) #So make a list of the ".gz" files
#eset <- justRMA(data_list,phenoData=pdata) #And read this list into RMA
#design <-model.matrix(~Age,pdata(eset))
#fit <-lmFit(eset,Age)
#efit <-eBayes(fit)
#topTable(efit,coef=2)
When I run this script, I get: There were 48 warnings (use warnings() to see them)
When I add in an extra line to the script:
library(Biobase)
library(affy)
library(limma)
tmp <-read.csv("PhenotypicData",header=T)
pdata <-AnnotatedDataFrame(tmp)
files <-list.files(pattern="*.gz")
data_list <-lapply(files,read.table)
eset <- justRMA(data_list,phenoData=pdata)
#design <-model.matrix(~Age,pdata(eset))
#fit <-lmFit(eset,Age)
#efit <-eBayes(fit)
#topTable(efit,coef=2)
I get the output: Error: the following are not valid files: /path/to/directory/data_list
When I edit the script:
library(Biobase)
library(affy)
library(limma)
phenoData <-read.AnnotatedDataFrame("PhenotypicData")
eset <- justRMA("cel_files",phenoData=phenoData) #cel_files is a sub directory containing only .gz files
#design <-model.matrix(~Age,pdata(eset))
#fit <-lmFit(eset,Age)
#efit <-eBayes(fit)
#topTable(efit,coef=2)
...and various combinations of the justRMA (e.g. changing "cel_files" to "cel_files/*gz" line to try to tell the script where the .gz files are), I just keep getting:
Error: the following are not valid files: /path_to_files/cel_files/*.gz Execution halted
Method 2: I then tried an approach as in the second link described above.
Example of my gene-based expression data ("GeneExpressionData"):
symbol GSM1330623 GSM1330624 GSM1330625 GSM1330626 GSM1330619 GSM1330620 GSM1330621 GSM1330622
0610005C13Rik 4.15 4.12 4.29 4.44 4.1 4.08 4.49 4.2
0610006L08Rik 3.86 3.8 4.27 3.85 3.96 4 4.1 4.27
0610007P14Rik 9.18 9.14 9.57 9.48 9.37 9.5 9.09 9.63
0610009B22Rik 9.15 9.26 9.41 9.21 9.48 9.47 9.18 9.48
0610009L18Rik 7.76 7.49 7.15 7.16 6.88 7.22 6.92 7.11
0610009O20Rik 6.84 6.87 7.005 6.85 6.83 6.86 6.84 6.865
Example of my feature data ("FeatureData"):
id,symbol
1415670_at,Copg1
1415671_at,Atp6v0d1
1415672_at,Golga7
1415673_at,Psph
1415674_a_at,Trappc4
1415675_at,Dpm2
My phenotype data ("PhenotypeData"):
id,Age
GSM1330619,14
GSM1330620,14
GSM1330621,14
GSM1330622,14
GSM1330623,2
GSM1330624,2
GSM1330625,2
GSM1330626,2
I ran this code:
library(Biobase)
library(affy)
tmp <-read.csv("PhenotypicData",row.names=1)
pdata <-AnnotatedDataFrame(tmp)
tmp <-read.table("GeneExpressionData",header=T)
m <-as.matrix(tmp)
tmp <- read.csv("FeatureData",row.names=1)
fdata <-AnnotatedDataFrame(tmp)
eset <-new("ExpressionSet",exprs=m, phenoData=pdata,featureData=fdata)
The error is:
Error in validObject(.Object) :
Error in `featureNames<-`(`*tmp*`, value = c("1415670_at", "1415671_at", :
'value' length (45101) must equal feature number in AssayData (26731)
Calls: new ... .nextMethod -> .local -> featureNames<- -> featureNames<-
I understand that the error is because in my GeneExpression data has data PER GENE, whereas my feature data are data PER PROBE. I just don't know how to fix this error. I also tried to run this analysis without providing feature data (i.e. probe to gene), but I got an error.
Would you know what's going on here to make the above code run? Many thanks again for your time.