[BioC] Questions about exporting data out of R

Matthew Hannah Hannah at mpimp-golm.mpg.de
Wed Mar 17 12:21:43 MET 2004


Lizhe,

I did this a while ago and found that if you simply export the
pm values you get it in a format that has too many columns for
excel. The following works (not sure if its the most efficient).
It returns a list of all the affy IDS followed by the 11 values
for pm in one file and mm in another (If you have a different size
probeset just change [1:11]. To use it you have to create a new 
folder and then create a subfolder containing each single CEL file 
(and list these in the dirs line below). Set the first of these dirs 
as the working directory and then run the following script. Beware 
though as it takes at least 5min per CEL file on my machine.

HTH,
Matt

#set dirs - modify to your directory names
dirs <- c("C:../C24A","C:../C24ACC")

library(affy)

for(j in dirs) { setwd(j)

data <- ReadAffy()


#pm data extraction
gn <- geneNames(data)
pmdatatable <- matrix(nrow=length(gn),ncol=11,byrow=T)
for(i in 1:length(gn)){ pmdatatable[i,]<-pm(data,gn[i])[1:11] }

#join genenames as labels on pmdatatable and write to file
pmdata<- cbind(gn, pmdatatable)

write.table(pmdata, file="pmdata.txt")


#then for mm values
mmdatatable <- matrix(nrow=length(gn),ncol=11,byrow=T)
for(i in 1:length(gn)){ mmdatatable[i,]<-mm(data,gn[i])[1:11] }
mmdata<- cbind(gn, mmdatatable)
write.table(mmdata, file="mmdata.txt")
}



More information about the Bioconductor mailing list