Last active
August 29, 2015 14:10
-
-
Save PeteHaitch/346b924e3eca8c3cfade to your computer and use it in GitHub Desktop.
Benchmarking accessing names of assays in SummarizedExperiment object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(GenomicRanges) | |
library(microbenchmark) | |
nrows <- 2000000; ncols <- 6 | |
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows) | |
rowData <- GRanges(rep(c("chr1", "chr2"), c(0.25 * nrows, 0.75 * nrows)), | |
IRanges(floor(runif(nrows, 1e5, 1e6)), width=100), | |
strand=sample(c("+", "-"), nrows, TRUE)) | |
colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3), | |
row.names=LETTERS[1:6]) | |
se <- SummarizedExperiment(assays=SimpleList(counts=counts), | |
rowData=rowData, colData=colData) | |
# The names(se@assays$field("data")) method is based on bsseq::assayNames() | |
microbenchmark(names(assays(se)), names(assays(se, withDimnames = FALSE)), | |
names(se@assays$field("data"))) | |
# Unit: microseconds | |
# expr min lq mean median uq max neval | |
# names(assays(se)) 32886.088 35178.628 59443.71397 46207.0240 70830.253 278013.116 100 | |
# names(assays(se, withDimnames = FALSE)) 78.652 87.432 137.93095 123.6345 182.350 363.143 100 | |
# names(se@assays$field("data")) 46.295 49.646 87.77205 62.0195 124.839 379.928 100 | |
sessionInfo() | |
# R Under development (unstable) (2014-11-10 r66951) | |
# Platform: x86_64-apple-darwin10.8.0 (64-bit) | |
# | |
# locale: | |
# [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8 | |
# | |
# attached base packages: | |
# [1] stats4 parallel stats graphics grDevices utils datasets methods base | |
# | |
# other attached packages: | |
# [1] microbenchmark_1.4-2 GenomicRanges_1.19.10 GenomeInfoDb_1.3.7 IRanges_2.1.13 S4Vectors_0.5.6 | |
# [6] BiocGenerics_0.13.1 | |
# | |
# loaded via a namespace (and not attached): | |
# [1] colorspace_1.2-4 digest_0.6.4 ggplot2_1.0.0 grid_3.2.0 gtable_0.1.2 MASS_7.3-35 | |
# [7] munsell_0.4.2 plyr_1.8.1 proto_0.3-10 Rcpp_0.11.3 reshape2_1.4 scales_0.2.4 | |
# [13] stringr_0.6.2 tools_3.2.0 XVector_0.7.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment