Skip to content

Commit 96040a6

Browse files
committed
Updated test with new parameter removeFlankOverlap
1 parent e95697f commit 96040a6

2 files changed

Lines changed: 54 additions & 2 deletions

File tree

tests/testthat/test-cr_add_summit.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test_data_disjoin_filter <- peakCombiner:::crDisjoinFilter(
4949
test_data_reduce <- peakCombiner:::crReduce(data = test_data_disjoin_filter)
5050
test_data_overlap <- peakCombiner:::crOverlapWithSummits(
5151
data = test_data_reduce,
52-
input = test_data_filtered
52+
input = test_data_filtered,
5353
)
5454
##
5555
test_data_combined_with_summit <- peakCombiner:::crAddSummit(

tests/testthat/test-cr_overlap_with_summits.R

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ test_data_reduce <- peakCombiner:::crReduce(
5050
##
5151
test_data_overlap <- peakCombiner:::crOverlapWithSummits(
5252
data = test_data_reduce,
53-
input = test_data_filtered
53+
input = test_data_filtered,
54+
removeFlankOverlaps = TRUE
5455
)
5556
##
5657
### -----------------------------------------------------------------------###
@@ -90,6 +91,57 @@ test_that("Input data frame has the expected structure", {
9091
expect_true(is.character(data$sample_name))
9192
expect_true(sum(stringr::str_detect(data$name, "|")) > 0)
9293
})
94+
##
95+
### -----------------------------------------------------------------------###
96+
### Test removeFlankOverlaps
97+
### -----------------------------------------------------------------------###
98+
##
99+
100+
testthat::expect_no_error(
101+
peakCombiner:::crOverlapWithSummits(
102+
data = test_data_reduce,
103+
input = test_data_filtered,
104+
removeFlankOverlaps = TRUE
105+
)
106+
)
107+
108+
109+
testthat::expect_no_error(
110+
peakCombiner:::crOverlapWithSummits(
111+
data = test_data_reduce,
112+
input = test_data_filtered,
113+
removeFlankOverlaps = FALSE
114+
)
115+
)
116+
117+
testthat::expect_error(
118+
peakCombiner:::crOverlapWithSummits(
119+
data = test_data_reduce,
120+
input = test_data_filtered,
121+
removeFlankOverlaps = NULL
122+
)
123+
)
124+
125+
## See if non-overlaping regions are removed using removeFlankOverlaps
126+
test_data_reduce_1 <-test_data_reduce[1:5,] |>
127+
dplyr::mutate(chrom = "chr5") |>
128+
rbind(test_data_reduce)
129+
130+
testthat::expect_equal(
131+
peakCombiner:::crOverlapWithSummits(
132+
data = test_data_reduce_1,
133+
input = test_data_filtered,
134+
removeFlankOverlaps = FALSE
135+
) |> nrow(), 47
136+
)
137+
testthat::expect_equal(
138+
peakCombiner:::crOverlapWithSummits(
139+
data = test_data_reduce_1,
140+
input = test_data_filtered,
141+
removeFlankOverlaps = TRUE
142+
) |> nrow(), 42
143+
)
144+
93145
##
94146
### -----------------------------------------------------------------------###
95147
### Test Output

0 commit comments

Comments
 (0)