Skip to content

[Bioc-devel] Changes to the SummarizedExperiment Class

1 message · Martin Morgan

#
On 03/31/2015 12:40 PM, Michael Love wrote:
Thanks for the prompt Mike and sorry for the slow response. gc() is not the most 
effective tool to track memory use; I compiled my R with 
--enable-memory-profiling, and then used tracemem

   m <- matrix(1:1e7,ncol=10,dimnames=list(1:1e6,1:10))
   tracemem(m)
   se <- SummarizedExperiment(m)

The original behavior was

 > names(assays(se)) <- "foo"
tracemem[0x7f49853a1010 -> 0x7f4981734010]: lapply lapply lapply lapply 
endoapply endoapply assays assays
tracemem[0x7f4981734010 -> 0x7f497f10e010]: lapply lapply lapply lapply 
endoapply endoapply assays<- assays<-
 >

which shows a memory copy on the way out (the call stack ending with the assays 
access S4 generic then method) and on the way in, the assays<- setter generic 
and method). withDimnames=FALSE gave me

 > names(assays(se, withDimnames=FALSE)) <- "foo"
tracemem[0x7f4981734010 -> 0x7f497f10e010]: lapply lapply lapply lapply 
endoapply endoapply assays<- assays<-
 >

with the duplication on the way in. GenomicRanges 1.19.50 gives, on a fresh 'se'

 > names(assays(se, withDimnames=FALSE)) <- "foo"
 >

with no duplication. assayNames<- (which I guess is the 'preferred' setter) 
behaves this way too.

Thanks for your report and patience.

Martin