-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bench.R
149 lines (137 loc) · 2.82 KB
/
bench.R
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
library(tidyverse)
library(UpSetR)
library(upsetjs)
# loading example files
toyset_1 <- read_delim(
file = gzfile("./tests/testthat/data/toyset_1.tsv.gz"),
delim = "\t",
escape_double = FALSE,
trim_ws = TRUE
) %>%
data.frame()
toyset_2 <- read_delim(
file = gzfile("./tests/testthat/data/toyset_2.tsv.gz"),
delim = "\t",
escape_double = FALSE,
trim_ws = TRUE
) %>%
data.frame()
# for upsetR aesthetics
count <- toyset_1 %>%
group_by(attribute1) %>%
count() %>%
arrange(attribute1)
# upsetR version of toyset_1
## basic
start <- Sys.time()
upset(
data = toyset_1,
sets = c(
"toy1",
"toy2",
"toy3",
"toy4",
"toy5",
"toy6"
),
order.by = "freq",
set_size.show = TRUE,
set_size.scale_max = 20000,
)
end <- Sys.time()
cat("Plotted in", format(end - start), "\n")
## advanced (would be really nice to have such coloring options)
start <- Sys.time()
upset(
data = toyset_1,
sets = c(
"toy1",
"toy2",
"toy3",
"toy4",
"toy5",
"toy6"
),
query.legend = "top",
queries = list(
list(
query = elements,
params = list(
"attribute1",
c(
count[1, 1],
count[2, 1],
count[3, 1]
)
),
active = TRUE,
color = "#b2df8a",
query.name = "kin"
),
list(
query = elements,
params = list(
"attribute1",
c(
count[3, 1],
count[2, 1]
)
),
active = TRUE,
color = "#1f78b4",
query.name = "ord"
),
list(
query = elements,
params = list(
"attribute1",
c(count[3, 1])
),
active = TRUE,
color = "#a6cee3",
query.name = "spe"
)
),
order.by = "freq",
set_size.show = TRUE,
set_size.scale_max = 20000
)
end <- Sys.time()
cat("Plotted in", format(end - start), "\n")
## bigger matrix () 209'301 x 33 (still not that big imho)
start <- Sys.time()
upset(
toyset_2,
order.by = "freq",
set_size.show = TRUE,
set_size.scale_max = 250000
)
end <- Sys.time()
cat("Plotted in", format(end - start), "\n")
# upsetjs version of toyset_1
## works nicely
start <- Sys.time()
upsetjs() %>%
fromDataFrame(toyset_1[,1:6], c_type="distinctIntersection") %>%
interactiveChart()
end <- Sys.time()
cat("Plotted in", format(end - start), "\n")
start <- Sys.time()
upset(
toyset_2,
order.by = "freq",
set_size.show = TRUE,
set_size.scale_max = 250000,
nsets = 33
)
end <- Sys.time()
cat("Plotted in", format(end - start), "\n")
# upsetjs version of toyset_2
## last for ages, no idea why... never had the patience to wait until the end
start <- Sys.time()
upsetjs() %>%
fromDataFrame(toyset_2, c_type="distinctIntersection", store.elems=FALSE, limit = 40) %>%
interactiveChart()
end <- Sys.time()
cat("Plotted in", format(end - start), "\n")
# Thanks a lot