Skip to content

Commit 190d315

Browse files
committed
tests: fix tests
1 parent 465d51e commit 190d315

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

tests/testthat/test-compute-filter-import-plot.R

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ test_that("other CoverageExperiment methods work", {
101101
})
102102

103103
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+
104118
expect_s4_class(
105119
AC <- aggregate(CE),
106120
"AggregatedCoverage"
@@ -115,6 +129,20 @@ test_that("aggregate works", {
115129
})
116130

117131
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+
118146
options(restore_SummarizedExperiment_show = TRUE)
119147
expect_no_error(show(CE))
120148
expect_no_error(show(AC))
@@ -128,16 +156,56 @@ test_that("print/show work", {
128156
})
129157

130158
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+
131173
expect_true(all(dim(as_tibble(AC)) == c(600, 13)))
132174
expect_true(all(colnames(as_tibble(AC)) == c(".sample", ".feature", "track", "features", "coord", "mean", "median", "min", "max", "sd", "se", "ci_low", "ci_high")))
133175
})
134176

135177
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+
)
136190
expect_true(all(dim(expand(CE)) == c(402600, 7)))
137191
expect_true(all(colnames(expand(CE)) == c("track", "features", "chr", "ranges", "strand", "coord", "coverage")))
138192
})
139193

140194
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+
141209
expect_s4_class(
142210
CCE <- coarsen(CE, 10),
143211
"CoverageExperiment"

0 commit comments

Comments
 (0)