[Bioc-devel] change names(assays(SummarizedExperiment)) w/o copy?
Michael Love
michaelisaiahlove at gmail.com
Wed May 7 21:06:08 CEST 2014
hi,
Is there a way that I can change the names of the assays slot of a
SummarizedExperiment, without making a new copy of the data contained
within? Assume I get an SE which has already been constructed, but no
names on the assays() SimpleList.
thanks,
Mike
> library(GenomicRanges)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1291106 69 1710298 91.4 1590760 85.0
Vcells 1178619 9 1925843 14.7 1724123 13.2
> m <- matrix(1:2e7, ncol=10)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1291111 69.0 1967602 105.1 1590760 85.0
Vcells 11178604 85.3 22482701 171.6 21178631 161.6
# made a ~75 Mb matrix
> colnames(m) <- letters[1:10]
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1291149 69.0 1967602 105.1 1590760 85.0
Vcells 11178679 85.3 22482701 171.6 21179851 161.6
> se <- SummarizedExperiment(m)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1302603 69.6 1967602 105.1 1623929 86.8
Vcells 12189777 93.1 22482701 171.6 21179851 161.6
# so far no copying
> names(assays(se)) <- "counts"
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1303174 69.6 1967602 105.1 1623929 86.8
Vcells 22190847 169.4 23686836 180.8 22203423 169.4
# last step made a copy
> sessionInfo()
R Under development (unstable) (2014-05-07 r65539)
Platform: x86_64-apple-darwin12.5.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] GenomicRanges_1.17.12 GenomeInfoDb_1.1.3 IRanges_1.99.13
[4] S4Vectors_0.0.6 BiocGenerics_0.11.2
loaded via a namespace (and not attached):
[1] RCurl_1.95-4.1 stats4_3.2.0 XVector_0.5.6
More information about the Bioc-devel
mailing list