@@ -101,6 +101,20 @@ test_that("other CoverageExperiment methods work", {
101
101
})
102
102
103
103
test_that(" aggregate works" , {
104
+
105
+ features <- list (
106
+ TSSs = system.file(" extdata" , " TSSs.bed" , package = " tidyCoverage" ),
107
+ `Convergent transcription` = system.file(" extdata" , " conv_transcription_loci.bed" , package = " tidyCoverage" )
108
+ ) | > map(import ) | > map(filter , strand == ' +' )
109
+ tracks <- list (
110
+ Scc1 = system.file(" extdata" , " Scc1.bw" , package = " tidyCoverage" ),
111
+ RNA_fwd = system.file(" extdata" , " RNA.fwd.bw" , package = " tidyCoverage" ),
112
+ RNA_rev = system.file(" extdata" , " RNA.rev.bw" , package = " tidyCoverage" )
113
+ ) | > map(import , as = ' Rle' )
114
+ CE <- CoverageExperiment(
115
+ tracks , features , width = 100 , scale = TRUE , center = TRUE
116
+ )
117
+
104
118
expect_s4_class(
105
119
AC <- aggregate(CE ),
106
120
" AggregatedCoverage"
@@ -115,6 +129,20 @@ test_that("aggregate works", {
115
129
})
116
130
117
131
test_that(" print/show work" , {
132
+ features <- list (
133
+ TSSs = system.file(" extdata" , " TSSs.bed" , package = " tidyCoverage" ),
134
+ `Convergent transcription` = system.file(" extdata" , " conv_transcription_loci.bed" , package = " tidyCoverage" )
135
+ ) | > map(import ) | > map(filter , strand == ' +' )
136
+ tracks <- list (
137
+ Scc1 = system.file(" extdata" , " Scc1.bw" , package = " tidyCoverage" ),
138
+ RNA_fwd = system.file(" extdata" , " RNA.fwd.bw" , package = " tidyCoverage" ),
139
+ RNA_rev = system.file(" extdata" , " RNA.rev.bw" , package = " tidyCoverage" )
140
+ ) | > map(import , as = ' Rle' )
141
+ CE <- CoverageExperiment(
142
+ tracks , features , width = 100 , scale = TRUE , center = TRUE
143
+ )
144
+ AC <- aggregate(CE )
145
+
118
146
options(restore_SummarizedExperiment_show = TRUE )
119
147
expect_no_error(show(CE ))
120
148
expect_no_error(show(AC ))
@@ -128,16 +156,56 @@ test_that("print/show work", {
128
156
})
129
157
130
158
test_that(" as_tibble methods work" , {
159
+ features <- list (
160
+ TSSs = system.file(" extdata" , " TSSs.bed" , package = " tidyCoverage" ),
161
+ `Convergent transcription` = system.file(" extdata" , " conv_transcription_loci.bed" , package = " tidyCoverage" )
162
+ ) | > map(import ) | > map(filter , strand == ' +' )
163
+ tracks <- list (
164
+ Scc1 = system.file(" extdata" , " Scc1.bw" , package = " tidyCoverage" ),
165
+ RNA_fwd = system.file(" extdata" , " RNA.fwd.bw" , package = " tidyCoverage" ),
166
+ RNA_rev = system.file(" extdata" , " RNA.rev.bw" , package = " tidyCoverage" )
167
+ ) | > map(import , as = ' Rle' )
168
+ CE <- CoverageExperiment(
169
+ tracks , features , width = 100 , scale = TRUE , center = TRUE
170
+ )
171
+ AC <- aggregate(CE )
172
+
131
173
expect_true(all(dim(as_tibble(AC )) == c(600 , 13 )))
132
174
expect_true(all(colnames(as_tibble(AC )) == c(" .sample" , " .feature" , " track" , " features" , " coord" , " mean" , " median" , " min" , " max" , " sd" , " se" , " ci_low" , " ci_high" )))
133
175
})
134
176
135
177
test_that(" expand method works" , {
178
+ features <- list (
179
+ TSSs = system.file(" extdata" , " TSSs.bed" , package = " tidyCoverage" ),
180
+ `Convergent transcription` = system.file(" extdata" , " conv_transcription_loci.bed" , package = " tidyCoverage" )
181
+ ) | > map(import ) | > map(filter , strand == ' +' )
182
+ tracks <- list (
183
+ Scc1 = system.file(" extdata" , " Scc1.bw" , package = " tidyCoverage" ),
184
+ RNA_fwd = system.file(" extdata" , " RNA.fwd.bw" , package = " tidyCoverage" ),
185
+ RNA_rev = system.file(" extdata" , " RNA.rev.bw" , package = " tidyCoverage" )
186
+ ) | > map(import , as = ' Rle' )
187
+ CE <- CoverageExperiment(
188
+ tracks , features , width = 100 , scale = TRUE , center = TRUE
189
+ )
136
190
expect_true(all(dim(expand(CE )) == c(402600 , 7 )))
137
191
expect_true(all(colnames(expand(CE )) == c(" track" , " features" , " chr" , " ranges" , " strand" , " coord" , " coverage" )))
138
192
})
139
193
140
194
test_that(" coarsen method works" , {
195
+ features <- list (
196
+ TSSs = system.file(" extdata" , " TSSs.bed" , package = " tidyCoverage" ),
197
+ `Convergent transcription` = system.file(" extdata" , " conv_transcription_loci.bed" , package = " tidyCoverage" )
198
+ ) | > map(import ) | > map(filter , strand == ' +' )
199
+ tracks <- list (
200
+ Scc1 = system.file(" extdata" , " Scc1.bw" , package = " tidyCoverage" ),
201
+ RNA_fwd = system.file(" extdata" , " RNA.fwd.bw" , package = " tidyCoverage" ),
202
+ RNA_rev = system.file(" extdata" , " RNA.rev.bw" , package = " tidyCoverage" )
203
+ ) | > map(import , as = ' Rle' )
204
+ CE <- CoverageExperiment(
205
+ tracks , features , width = 100 , scale = TRUE , center = TRUE
206
+ )
207
+ AC <- aggregate(CE )
208
+
141
209
expect_s4_class(
142
210
CCE <- coarsen(CE , 10 ),
143
211
" CoverageExperiment"
0 commit comments