Changing the value of sampleNames for exprSet
2
0
Entering edit mode
Jeff Lande ▴ 110
@jeff-lande-390
Last seen 9.6 years ago
I have a question about editing sampleNames in an exprSet object. I would like to get rid of the .CEL portion of the file name (or change it altogether) that occurs when I use ReadAffy() and rma() to create an exprSet. To put it into context, I am calculating additional phenoData elements from existing phenoData elements and then assigning the updated phenoData object to the exprSet. I had been using the following assignments in the past > pd <- read.phenoData(filename="samplenames.txt") > phenoData(origexprSet) <- pd > newexprSet <- new('exprSet',exprs=exprs(origexprSet),phenoData=pd) In the most recent version of R/BioC, this produced an error (Error in validObject(.Object) : invalid class "exprSet" object: sampleNames different from names of phenoData rows). To my understanding, this is occurring because of the new object checking feature. The exprSets were created in a previous version of R, so I was previously able to connect the exprSet and phenoData with differing sample names (the difference being in the .CEL extension in the sampleNames for the exprSet that is results from the ReadAffy() command and no .CEL extension in the rownames of the phenoData). I'm able to modify the phenoData object with the command rownames(pData(pd)) <- sampleNames(origexprSet) and then get the newexprSet <- new('exprSet',exprs=exprs(origexprSet),phenoData=pd) assignment to work. I would actually rather get rid of the .CEL extension in the sampleNames of the exprSet object, but I'm getting an error: > sampleNames(origexprSet) <- sub(".CEL$","",sampleNames(origexprSet)) Error in slot(object, slotNames[[i]]) : no slot of name "reporterInfo" for this object of class "exprSet" Any help would be appreciated. > sessionInfo() Version 2.3.0 (2006-04-24) i386-pc-mingw32 attached base packages: [1] "tools" "methods" "stats" "graphics" "grDevices" "utils" [7] "datasets" "base" other attached packages: affy affyio Biobase "1.10.0" "1.0.0" "1.10.0" Thanks, Jeff Lande Univ of MN CONFIDENTIALITY NOTICE: Electronic messages can be misdirect...{{dropped}}
affy affyio affy affyio • 1.3k views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 13 hours ago
United States
I think there was a time when exprSets did not have a reporterInfo slot, and I guess your origexprSet dates from then. If recreating the object from the .CEL files, as James suggests, is not an option you might try newExprs <- exprs(origexprSet) colnames(newExprs) <- sub(".CEL$", "", sampleNames(orig)) new("exprSet", exprs=newExprs, phenoData=pd) A more radical approach is to update origexprSet to a new definition, maybe something like: updateMyOrigExprSet <- function(orig) { data <- exprs(orig) colnames(data) <- sub(".CEL$", "", sampleNames(orig)) new("exprSet", exprs=data, description=description(orig), annotation=annotation(orig), notes=notes(orig), ## reporterInfo=reporterInfo(orig), phenoData=phenoData(orig)) } updateMyOrigExprSet(origexprSet) The idea is that "new" is creating something with all the current slots, using the data from your original if provided. Bioconductor is trying to get better at both backward compatibility and easy updates to older instances. In the forthcoming October release of Bioconductor, you should be able to check that you have a current version of the object > isCurrent(origexprSet) and update it if necessary > updateObject(origexprSet) Hope that helps, Martin -- Bioconductor "Jeff Lande" <land0038 at="" umn.edu=""> writes: > I have a question about editing sampleNames in an exprSet object. I would > like to get rid of the .CEL portion of the file name (or change it > altogether) that occurs when I use ReadAffy() and rma() to create an > exprSet. > > To put it into context, I am calculating additional phenoData elements from > existing phenoData elements and then assigning the updated phenoData object > to the exprSet. > > I had been using the following assignments in the past > >> pd <- read.phenoData(filename="samplenames.txt") >> phenoData(origexprSet) <- pd >> newexprSet <- new('exprSet',exprs=exprs(origexprSet),phenoData=pd) > > In the most recent version of R/BioC, this produced an error > > (Error in validObject(.Object) : invalid class "exprSet" object: sampleNames > different from names of phenoData rows). > > To my understanding, this is occurring because of the new object checking > feature. The exprSets were created in a previous version of R, so I was > previously able to connect the exprSet and phenoData with differing sample > names (the difference being in the .CEL extension in the sampleNames for the > exprSet that is results from the ReadAffy() command and no .CEL extension in > the rownames of the phenoData). I'm able to modify the phenoData object > with the command > > rownames(pData(pd)) <- sampleNames(origexprSet) > > and then get the > newexprSet <- new('exprSet',exprs=exprs(origexprSet),phenoData=pd) > assignment to work. > > I would actually rather get rid of the .CEL extension in the sampleNames of > the exprSet object, but I'm getting an error: > >> sampleNames(origexprSet) <- sub(".CEL$","",sampleNames(origexprSet)) > Error in slot(object, slotNames[[i]]) : no slot of name "reporterInfo" for > this object of class "exprSet" > > Any help would be appreciated. > >> sessionInfo() > Version 2.3.0 (2006-04-24) > i386-pc-mingw32 > > attached base packages: > [1] "tools" "methods" "stats" "graphics" "grDevices" "utils" > [7] "datasets" "base" > > other attached packages: > affy affyio Biobase > "1.10.0" "1.0.0" "1.10.0" > > Thanks, > > Jeff Lande > Univ of MN > > CONFIDENTIALITY NOTICE: Electronic messages can be misdirect...{{dropped}} > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 2 hours ago
United States
Hi Jeff, I would just use the sampleNames argument to ReadAffy() or justRMA() to read in the names you want to use instead of trying to change after the fact. > eset <- justRMA(filenames = list.celfiles()[1:5],sampleNames = sub("\\.CEL$","", list.celfiles()[1:5])) Background correcting Normalizing Calculating Expression > sampleNames(eset) [1] "EA02014_40455_H133A_1" "EA02014_40456_H133A_2" "EA02014_40457_H133A_3" [4] "EA02014_40459_H133A_5" "EA02014_40461_H133A_7" HTH, Jim Jeff Lande wrote: > I have a question about editing sampleNames in an exprSet object. I would > like to get rid of the .CEL portion of the file name (or change it > altogether) that occurs when I use ReadAffy() and rma() to create an > exprSet. > > To put it into context, I am calculating additional phenoData elements from > existing phenoData elements and then assigning the updated phenoData object > to the exprSet. > > I had been using the following assignments in the past > > >>pd <- read.phenoData(filename="samplenames.txt") >>phenoData(origexprSet) <- pd >>newexprSet <- new('exprSet',exprs=exprs(origexprSet),phenoData=pd) > > > In the most recent version of R/BioC, this produced an error > > (Error in validObject(.Object) : invalid class "exprSet" object: sampleNames > different from names of phenoData rows). > > To my understanding, this is occurring because of the new object checking > feature. The exprSets were created in a previous version of R, so I was > previously able to connect the exprSet and phenoData with differing sample > names (the difference being in the .CEL extension in the sampleNames for the > exprSet that is results from the ReadAffy() command and no .CEL extension in > the rownames of the phenoData). I'm able to modify the phenoData object > with the command > > rownames(pData(pd)) <- sampleNames(origexprSet) > > and then get the > newexprSet <- new('exprSet',exprs=exprs(origexprSet),phenoData=pd) > assignment to work. > > I would actually rather get rid of the .CEL extension in the sampleNames of > the exprSet object, but I'm getting an error: > > >>sampleNames(origexprSet) <- sub(".CEL$","",sampleNames(origexprSet)) > > Error in slot(object, slotNames[[i]]) : no slot of name "reporterInfo" for > this object of class "exprSet" > > Any help would be appreciated. > > >>sessionInfo() > > Version 2.3.0 (2006-04-24) > i386-pc-mingw32 > > attached base packages: > [1] "tools" "methods" "stats" "graphics" "grDevices" "utils" > [7] "datasets" "base" > > other attached packages: > affy affyio Biobase > "1.10.0" "1.0.0" "1.10.0" > > Thanks, > > Jeff Lande > Univ of MN > > CONFIDENTIALITY NOTICE: Electronic messages can be misdirect...{{dropped}} > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.
ADD COMMENT

Login before adding your answer.

Traffic: 730 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