[BioC] Reading Imagene files with read.imagene in limma

Gordon Smyth smyth at wehi.edu.au
Tue Jun 8 00:38:11 CEST 2004

At 08:14 PM 7/06/2004, STKH (Steen Krogsgaard) wrote:
>I have a bunch of Imagene data files that I want to read into limma
>using read.imagene. It all works very nicely like this:
>RG<-read.imagene(files), where files is a matrix with two columns and
>one row for each array. The names of the two dye-files are in the two
>I want to wrap this call into another function in order to do some
>processing of the quality flags that Imagene uses (I want to change the
>flags into weights). The idea is:

Why re-invent the wheel? read.maimages() already gives you complete 
facility to do this. The argument wt.fun given to read.maimages() can be 
any function you like which takes an imagene file as a data frame and 
converts flags into weights. The help says:

'wt.fun' may be any user-supplied function which accepts
      a data.frame argument and returns a vector of non-negative
      weights. The columns of the data.frame are as in the image
      analysis output files. See 'QualityWeights' for provided weight


>read.my.imagene <-function(files, path = NULL, ext = NULL, names = NULL,
>columns = NULL,
>     wt.fun = NULL, verbose = TRUE, sep = "      ", quote = "\"",
>exclude.flags=c(1,2,3), ...)
>         obj=read.imagene(files=files, path=path, ext=ext, names=names,
>columns=columns, wt.fun=wt.fun, verbose=verbose, sep=sep, quote=quote,
>         // do some more stuff
>but when I call read.my.imagene I get an error "Error in scan(file =
>file, what = what, sep = sep, quote = quote, dec = dec,  :
>         line 1 did not have 27 elements". I understand that scan is
>complaining about the number of columns in the data file, but I'm really
>puzzled why it works when I call read.imagene directly but not when I
>call read.my.imagene which then in turn calls read.imagene.
>I also tried to copy the source code for read.imagene into a new
>function (which I called test.read), and this produced the exact same
>error. There were no code changes done, just a copy of the source code
>into Notepad (yes, I'm on a Windows box) preceeded by "test.read = ".
>I use R 1.9.0 and the latest Bioconductor (downloaded last week).
>thanks in advance for any suggestions

More information about the Bioconductor mailing list