combine two objects & adding/deleting arrays in an obj ect
1
0
Entering edit mode
Yuk Fai Leung ▴ 100
@yuk-fai-leung-416
Last seen 9.6 years ago
Thanks! But how about adding one/more experiments to an existing marrayRaw object? Fai ________ Yuk Fai Leung Bauer Center for Genomics Research Harvard University 7 Divinity Avenue Cambridge, MA 02138 Tel: 617-496-7134 Fax: 617-495-2196 email: yfleung@cgr.harvard.edu; yfleung@genomicshome.com URL: http://genomicshome.com > -----Original Message----- > From: Jean Yee Hwa Yang [mailto:jean@biostat.ucsf.edu] > Sent: Wednesday, November 19, 2003 2:02 AM > To: Yuk Fai Leung > Cc: 'bioconductor@stat.math.ethz.ch' > Subject: Re: [BioC] combine two objects & adding/deleting arrays in an > object > > Hi Yuk Fai, > > > Sorry for asking a simple question but I cannot find the answer in the > > archives. I want to know how to > > > > 1. Combine two objects of the same class, for example two marrayRaw > > objects. > Not at the moment > > > 2. Add/delete an array/experiment from a marrayRaw/marrayNorm object. > > This can be done by subsetting. > e.g. > > datasub <- data[, -4] > > data is a marrayRaw object and data sub has slide 4 removed. > > Cheers > > Jean
• 861 views
ADD COMMENT
0
Entering edit mode
@jean-yee-hwa-yang-104
Last seen 9.6 years ago
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) }
ADD COMMENT

Login before adding your answer.

Traffic: 926 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6