[BioC] Changing the value of sampleNames for exprSet

Martin Morgan mtmorgan at fhcrc.org
Thu Aug 17 22:30:29 CEST 2006


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



More information about the Bioconductor mailing list