-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstep1a.Rmd
74 lines (59 loc) · 1.84 KB
/
step1a.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: "Increase DelayedArray block size"
output:
html_document: default
---
<style>
pre {
overflow-x: auto;
}
pre code {
word-wrap: normal;
white-space: pre;
}
</style>
```{r global_options, echo = FALSE, include = FALSE}
options(width = 150)
```
```{r, exhub, echo = FALSE, message = FALSE}
if(packageVersion('rhdf5') > "2.23.1") {
BiocInstaller::biocLite('grimbough/rhdf5', ref = "6713b80", suppressUpdates = TRUE, ask = FALSE)
}
if(packageVersion('DelayedArray') > "0.5.6") {
BiocInstaller::biocLite('Bioconductor/DelayedArray', ref = "82d7d8b", suppressUpdates = TRUE, ask = FALSE)
BiocInstaller::biocLite("Bioconductor/HDF5Array", ref = "bd5760c", suppressUpdates = TRUE, ask = FALSE)
}
```
Loading the 10X brain data
```{r, load-libs, message=FALSE}
library(TENxBrainData)
library(microbenchmark)
```
```{r, load-data, message=FALSE}
tenx <- TENxBrainData()
tenx.sub <- tenx[,1:13000]
```
Here we increase the **DelayedArray** block size. First we'll look at the current block size. Then we'll adjust it to use 2Gb.
```{r, increase-block-size}
options()$DelayedArray.block.size
options(DelayedArray.block.size=2e9)
```
Now we'll calculate the column sums again. Hopefully the time will decrease now there is less time spent loading data into memory.
```{r, save-results}
systime <- system.time(res1a <- colSums(counts(tenx.sub)))
save(res1a, file = "res1a.rda")
systime
```
Run 5 more times to check consistency.
```{r, bigger-block}
bm1a <- microbenchmark(colSums(counts(tenx.sub)),
times = 5L, unit = "s",
control = list(order = "block", warmup = 0))
bm1a <- rbind(data.frame(expr = "", time = as.numeric(systime[3]) * 1e9), bm1a)
bm1a$expr <- "2GB block size"
save(bm1a, file = "bm1a.rda")
bm1a
```
```{r, sessionInfo}
devtools::session_info(c("HDF5Array", "DelayedArray"))
```