[BioC] combine two objects & adding/deleting arrays in an obj ect

Jean Yee Hwa Yang jean at biostat.ucsf.edu
Sat Nov 22 06:31:50 MET 2003


Hi Yuk Fai,

The following three functions will combined marrayRaw and marrayNorm
objects.

Example use:
data(swirl)
cbindmarrayRaw(swirl, swirl)
cbindmarrayRaw(swirl, swirl[,1])

You will need to copy and paste for the moment.  I am working on putting
this into the package.

Cheers

Jean

####################### COPY AND PASTE FUNCTIONS BELOW
## Three fucntions

rbindmarrayInfo <-  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)
          }

cbindmarrayRaw <-  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) <- rbindmarrayInfo(maTargets(newx),
maTargets(x))
                  if(length(maNotes(x)) != 0)
                    slot(newx,"maNotes")<- paste(maNotes(newx),
maNotes(x))
                }
              return(newx)
            }

cbindmarrayNorm <-  function(..., deparse.level = 1)
            {
              data <- list(...)
              newx <- data[[1]]
              for(x in data[2:length(data)])
                {
                  if(length(maM(x))!=0)
                    maM(newx) <- cbind(maM(newx), maM(x))
                  if(length(maA(x))!=0)
                    maA(newx) <- cbind(maA(newx), maA(x))
                  if(length(maGb(x))!=0)
                    maMloc(newx) <- cbind(maMloc(newx), maMloc(x))
                  if(length(maRb(x))!=0)
                    maMscale(newx) <- cbind(maMscale(newx), maMscale(x))
                  if(length(maW(x))!=0)
                    maW(newx) <- cbind(maW(newx), maW(x))
                  maTargets(newx) <- rbindmarrayInfo(maTargets(newx),
maTargets(x))
                  if(length(maNotes(x)) != 0)
                    slot(newx,"maNotes")<- paste(maNotes(newx),
maNotes(x))
                }
              return(newx)
            }



More information about the Bioconductor mailing list