[BioC] question about read.marrayRaw

Marcus Davy MDavy at hortresearch.co.nz
Wed Oct 6 05:50:50 CEST 2004


Hi, the reason for the problem is due to a slight bug in the package 'marray', 
specifically in the function read.marrayRaw.

> packageDescription("marray", fields="Version")
[1] "1.5.14"

The function read.marrayRaw in 'marray' uses read.table whereas 
the function version of read.marrayRaw in 'marrayInput' uses scan to upload the data.

Reproducing the problem using the example from the marray vignette example:


library(marray)
datadir <- system.file("swirldata", package = "marray") 
dir(datadir)

swirl.layout <- read.marrayLayout(fname = file.path(datadir,"fish.gal"), ngr = 4, ngc = 4, nsr = 22, nsc = 24, skip = 21, ctl.col = 4)
ctl <- rep("Control", maNspots(swirl.layout))
ctl[maControls(swirl.layout) != "control"] <- "N" 
maControls(swirl.layout) <- factor(ctl) 
swirl.layout

swirl.samples <- read.marrayInfo(file.path(datadir, "SwirlSample.txt"))
swirl.gnames <- read.marrayInfo(file.path(datadir, "fish.gal"), info.id = 4:5, labels = 5, skip = 21)
fnames <- dir(path = datadir, pattern = paste("*", "spot", sep = "."))
swirl.raw <- read.marrayRaw(fnames, path = datadir, name.Gf = "Gmean", name.Gb = "morphG", 
name.Rf = "Rmean", name.Rb = "morphR", layout = swirl.layout, gnames = swirl.gnames, targets = swirl.samples)
maRf(swirl.raw)
     /usr/local/lib/R/library/marray/swirldata/swirl.1.spot
[1,]                                               19538.47
     /usr/local/lib/R/library/marray/swirldata/swirl.2.spot
[1,]                                               16138.72
     /usr/local/lib/R/library/marray/swirldata/swirl.3.spot
[1,]                                                2895.16
     /usr/local/lib/R/library/marray/swirldata/swirl.4.spot
[1,]                                               14054.54


Only the first line of each spot file has been loaded in using read.marrayRaw. When the swirl.layout object is
defined, the slot maSub is TRUE of length 1, 
> maSub(swirl.layout)
[1] TRUE

In read.marrayRaw, read.table uses this slot to define the number of spots for nrows, which is the number of rows to read in.
Inside read.marrayRaw...
nspots <- sum(layout at maSub)  # of length 1
...
 dat <- read.table(f, skip = skip2, header = TRUE, sep = sep, 
            as.is = TRUE, quote = quote, check.names = FALSE, 
            comment.char = "", nrows = nspots, ...)  # data of length 1


Quick work around is to define the layout *after* reading in the data.


library(marray)
datadir <- system.file("swirldata", package = "marray") 
dir(datadir)

swirl.samples <- read.marrayInfo(file.path(datadir, "SwirlSample.txt"))
swirl.gnames <- read.marrayInfo(file.path(datadir, "fish.gal"), info.id = 4:5, labels = 5, skip = 21)
fnames <- dir(path = datadir, pattern = paste("*", "spot", sep = "."))
swirl.raw <- read.marrayRaw(fnames, path = datadir, name.Gf = "Gmean", name.Gb = "morphG", name.Rf = "Rmean", name.Rb = "morphR", gnames = swirl.gnames, targets = swirl.samples)

swirl.layout <- read.marrayLayout(fname = file.path(datadir,"fish.gal"), ngr = 4, ngc = 4, nsr = 22, nsc = 24, skip = 21, ctl.col = 4)
ctl <- rep("Control", maNspots(swirl.layout))
ctl[maControls(swirl.layout) != "control"] <- "N" 
maControls(swirl.layout) <- factor(ctl) 
swirl.layout

maLayout(swirl.raw) <- swirl.layout
dim(maRf(swirl.raw))
[1] 8448    4

Now all the data is uploaded.

marcus

>>> Ren Na <na at uthscsa.edu> 5/10/2004 3:51:09 AM >>>
Gustavo Henrique Esteves wrote:

>Hello Ren,
>
>Try to set the maSub in your marrayLayout object to a vector of TRUEs
>with length equal to the number of spots you have in your files. I
>have had the same problem and doing this resolved to me.
>
>Well hapened to me in R-1.9.1 with the last marray package. In the
>previous versions I didn't have this problem. What version of R /
>marray are you using?
>
>Gustavo
>
>
>
>
>On Fri, 01 Oct 2004 16:46:03 -0500, Ren Na <na at uthscsa.edu> wrote:
>  
>
>>I try to create a marrayRaw object. The problem I am having is that only
>>the first line of  my every .spot file has been read by the function
>>read.marrayRaw. The following is what I did,
>>xpd.layout <- read.marrayLayout(fname="Mouse24052004.txt", ngr=8, ngc=4,
>>nsr=23, nsc=23, skip=0, ctl.col=6)
>>xpd.samples<- read.marrayInfo("sample.txt")
>>xpd.gnames<-read.marrayInfo("Mouse24052004.txt", info.id=6, labels=10,
>>skip=0)
>>targets <- readTargets("Targets.txt")
>>fnames<-targets$FileName
>>xpd.raw<-read.marrayRaw(fnames, name.Gf="Gmedian", name.Gb="morphG",
>>name.Rf="Rmedian", name.Rb="morphR", layout=xpd.layout,
>>gnames=xpd.gnames, targets=xpd.samples)
>> > xpd.raw
>>An object of class "marrayRaw"
>>@maRf
>>     ./1391.spot ./1392.spot ./1348.spot ./1349.spot ./1373.spot ./1374.spot
>>[1,]         621         217         639         539         329         290
>>     ./1393.spot ./1394.spot ./1358.spot ./1359.spot ./1371.spot ./1372.spot
>>[1,]        1704         198         606         563         562        1052
>>     ./1387.spot ./1388.spot ./1397.spot ./1398.spot ./1399.spot ./1390.spot
>>[1,]         817         101         297         433        1926         650
>>
>>@maGf
>>     ./1391.spot ./1392.spot ./1348.spot ./1349.spot ./1373.spot ./1374.spot
>>[1,]         380         657         555         554         638         346
>>     ./1393.spot ./1394.spot ./1358.spot ./1359.spot ./1371.spot ./1372.spot
>>[1,]        3267         349         503         635         844        1596
>>     ./1387.spot ./1388.spot ./1397.spot ./1398.spot ./1399.spot ./1390.spot
>>[1,]        1078          90         334         549        2118        1093
>>
>>@maRb
>>...............................................................................
>>...............................................................................
>>I couldn't figure out what I did wrong. Thanks for any help.
>>
>>Ren
>>
>>_______________________________________________
>>Bioconductor mailing list
>>Bioconductor at stat.math.ethz.ch 
>>https://stat.ethz.ch/mailman/listinfo/bioconductor 
>>
>>    
>>
>
>
>
>  
>
Hi, Gustavo,
Thank you very much, it works with your suggestion.
I had exactly same experience like you. I am using R(1.9.1) and the last 
marray package(1.5.14). And I didn't have this problem before.

Ren

_______________________________________________
Bioconductor mailing list
Bioconductor at stat.math.ethz.ch 
https://stat.ethz.ch/mailman/listinfo/bioconductor

______________________________________________________

The contents of this e-mail are privileged and/or confidenti...{{dropped}}



More information about the Bioconductor mailing list