This is a test version of Biostars. For the public version, visit https://www.biostars.org.
R Microarray Analysis: Cel Files From Database

(cross-posted on so)

I have CEL files for an experiment stored in a MySQL database. I'd like my R script to directly load them from there in order to perform my analysis.

There is a MySQL connector in R. BLOBs are said not to be supported, but I don't know how old the sources are.

Now, is there a way / what is the simplest method to get this working?

I know that I can write a helper Script in e.g. Perl to fetch the files, and then let R do the work once they are retrieved, but it would be nice to have it in one step.

microarray r mysql

Just curious as to why the CEL files are in MySQL? Normally, I would store them on disk in a directory; I might use MySQL to store the file path. Is there some advantage to in-database storage?

It's a part of a framework that already stores other binary data in the database and has methods to store and retrieve those. It would be easier to just add a .cel file type than to implement directory-based storage at this point.

2 answers

I don't think it is nice to use R to fetch CEL file in a database. Maybe you can store your CEL file in a directory, then let R to read it use R package affy. Previously, I have done some microarray analysis for a pathogen Fusarium, and what I did is to download CDF file for my CEL files, then use R package makecdfenv to install CDF library in R, in this way, which would be recognized by R in the RMA or MAS processing.

The following is my R codes, some of which is carried out in CMD:

pkgpath <- tempdir()
# Fusariuma520094.cdf is my CDF library, and you have to install package
# makecdfenv first, then make your Fusarium CDF library, here results
# Fusarium CDF library fusariuma520094cdf, and you also have to remember
# the path it stored for later useage. 
make.cdf.package("Fusariuma520094.cdf",
                  cdf.path=system.file("extdata", package="makecdfenv"),
                  compress=TRUE, species = "Fusarium",
                  package.path = pkgpath)

#The below is carried out in CMD

Bash>cd C:\Program Files\R\R-2.11.1\bin
R CMD INSTALL path to your CDF library\fusariuma520094cdf

#The following is running in R again
library(affy)
data<-ReadAffy("C:\\Public\\Fusarium CDF file\\0H_3.CEL")
data@cdfName
eset = mas5(data)

MySQL suppors the following syntax:

select blobfield into dumpfile '/tmp/blobfile' from blobtable;

See if it works, then you can use the file based access.

http://dev.mysql.com/doc/refman/5.0/en/select.html

Log in to answer this question.