[BioC] how is cbind meant to work?

Marcus Davy MDavy at hortresearch.co.nz
Tue Aug 12 18:55:54 MEST 2003


On two objects of class marrayRaw cbind would not work for me either. I
am using R-1.7.1, with 
marrayClasses1.2.1 and marrayInput1.1.1 on redhat linux8.

I found that the package:marrayClasses "cbind" code for manipulating
the maTargets slot didnt seem to 
use the correct "rbind" code within the package:marrayClasses. It
seemed to try to use  "rbind" from 
package:base which is lower in the search path.

Here is my testcode using examples from the marrayInput package.



marcus


library(marrayInput)

find(cbind)
# [1] "package:marrayClasses" "package:base"      

find(rbind)
# [1] "package:marrayClasses" "package:base" 

search()
# [1] ".GlobalEnv"            "package:reposTools"    "package:tcltk"  
     
# [4] "package:Biobase"       "package:marrayClasses"
"package:marrayInput"  
# [7] "package:methods"       "package:ctest"         "package:mva"    
     
#[10] "package:modreg"        "package:nls"           "package:ts"     
     
#[13] "Autoloads"             "package:base"

datadir <- system.file("data", package = "marrayInput")
dir(datadir)
#[1] "00Index"         "fish.gal"        "swirl.1.spot"   
"swirl.2.spot"   
#[5] "swirl.3.spot"    "swirl.4.spot"    "swirl.RData"    
"SwirlSample.txt"

# maLayout slot
swirl.layout <- read.marrayLayout(fname = file.path(datadir,
"fish.gal"), ngr = 4, ngc = 4, nsr = 22, nsc = 24, skip = 21,
ctl.col = 4)

# maInfo slot
swirl.samples <- read.marrayInfo(file.path(datadir,
"SwirlSample.txt"))

# maGnames galfile slot
swirl.gnames <- read.marrayInfo(file.path(datadir, "fish.gal"),info.id
= 4:5, labels = 5, skip = 21)

# Loading two files
f1 <-  read.marrayRaw("swirl.1.spot", path = datadir, name.Gf =
"Gmean",
name.Gb = "morphG", name.Rf = "Rmean", name.Rb = "morphR",
layout = swirl.layout, gnames = swirl.gnames, targets = swirl.samples)

f2 <-  read.marrayRaw("swirl.2.spot", path = datadir, name.Gf =
"Gmean",
name.Gb = "morphG", name.Rf = "Rmean", name.Rb = "morphR",
layout = swirl.layout, gnames = swirl.gnames, targets = swirl.samples)

cbind(f1,f2)
# Error in cbind(...) : cannot create a matrix from these types

# Inside getMethods(cbind) class in "package:marrayClasses" fails at
the following line
# maTargets(newx) <- rbind(maTargets(newx), maTargets(x))


# created some temporary functions from within getMethods(cbind) and
getMethods(rbind) code
cbindcode <- function (..., deparse.level = 1) 
{
    data <- list(...)
    newx <- data[[1]]
    for (x in data[2:length(data)]) {
        if (length(maGf(x)) != 0) 
            maGf(newx) <- cbind(maGf(newx), maGf(x))
        if (length(maRf(x)) != 0) 
            maRf(newx) <- cbind(maRf(newx), maRf(x))
        if (length(maGb(x)) != 0) 
            maGb(newx) <- cbind(maGb(newx), maGb(x))
        if (length(maRb(x)) != 0) 
            maRb(newx) <- cbind(maRb(newx), maRb(x))
        if (length(maW(x)) != 0) 
            maW(newx) <- cbind(maW(newx), maW(x))
        maTargets(newx) <- rbindcode(maTargets(newx), maTargets(x)) #
Force R to use my temporary function
        if (length(maNotes(x)) != 0) 
            slot(newx, "maNotes") <- paste(maNotes(newx), maNotes(x))
    }
    return(newx)
}

rbindcode <- function (..., deparse.level = 1) 
{
    data <- list(...)
    newx <- data[[1]]
    for (i in 2:length(data)) {
        x <- data[[i]]
        if (length(maLabels(x)) != 0) 
            slot(newx, "maLabels") <- c(maLabels(newx), maLabels(x))
        if (length(maInfo(x)) != 0){
          slot(newx, "maInfo") <- rbind(maInfo(newx), maInfo(x))
          }
            if (length(maNotes(x)) != 0) 
            slot(newx, "maNotes") <- paste(maNotes(newx), maNotes(x))
    }
    return(newx)
}

####################### Now it works... ##########################
cbindcode(f1,f2)

Pre-normalization intensity data:	 Object of class marrayRaw. 

Number of arrays: 	2 arrays.
 
A) Layout of spots on the array: 
Array layout:	 Object of class marrayLayout. 

Total number of spots:			8448
Dimensions of grid matrix:		4 rows by 4 cols
Dimensions of spot matrices:		22 rows by 24 cols

Currently working with a subset of 8448 spots.

Control spots: 
There are   7681 types of controls : 
control fb16a01 fb16a02 fb16a03 fb16a04 fb16a05 fb16a06 fb16a07 fb16a08
fb16a09 
    768       1       1       1       1       1       1       1       1
      1 
...

Notes on layout: 
/usr/local/lib/R/library/marrayInput/data/fish.gal

B) Samples hybridized to the array: 
Object of class marrayInfo. 

NULL data frame with 1 rows

Number of labels:  0  
Dimensions of maInfo matrix:  0  rows by  0  columns

Notes: 


C) Summary statistics for log-ratio distribution: 
              Min. 1st Qu. Median  Mean 3rd Qu. Max.
swirl.1.spot -2.73   -0.79  -0.58 -0.48   -0.29 4.42
swirl.2.spot -2.72   -0.15   0.03  0.03    0.21 2.35

D) Notes on intensity data: 

















>>> Rob Dunne <Rob.Dunne at csiro.au> 12/08/2003 12:31:41 PM >>>

Hi List,
        how is cbind meant to work?

> class(t1)
[1] "marrayRaw"
> class(t2)
[1] "marrayRaw"
> temp<-cbind(t1,t2)
Error in cbind(...) : cannot create a matrix from these types
> 

also how do I find out information like this?
ie getMethods("cbind") gives me some information but not
enough (that I can understand) to use the function.

Also -- how can I average the respone (M values)
for two arrays  within an marrayNorm object?

			    bye
			    rob

-- 
Rob Dunne         Fax: +61 2 9325 3200     Tel: +61 2 9325 3263
CSIRO Mathematical and Information Sciences     +61 2 9325 3100
Locked Bag 17, North Ryde, New South Wales, Australia, 1670         
http://matilda.vu.edu.au/~dunne  Email: Rob.Dunne at csiro.au 

        Java has certainly revolutionized marketing and litigation.

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


______________________________________________________
The contents of this e-mail are privileged and/or confidential to the
named recipient and are not to be used by any other person and/or
organisation. If you have received this e-mail in error, please notify 
the sender and delete all material pertaining to this e-mail.



More information about the Bioconductor mailing list