Skip to content

Commit d9a771d

Browse files
committed
Add example data with sequence mismatches between mates in informative position
1 parent 59a1410 commit d9a771d

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed
574 Bytes
Binary file not shown.
3.39 KB
Binary file not shown.

tests/testthat/test-countMismatchStatePairs.R

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ test_that("countMismatchStatePairs works", {
55
"BisSeq_bismark_paired.bam",
66
"BisSeq_quasr_single.bam",
77
"BisSeq_quasr_paired_discordant.bam",
8-
"BisSeq_quasr_single_indels.bam"),
8+
"BisSeq_quasr_single_indels.bam",
9+
"BisSeq_quasr_paired_discordantseq.bam"),
910
package = "SingleMoleculeGenomicsIO")
1011
names(bamfiles) <- c("quasr", "bismark", "quasrsingle", "quasrdiscordant",
11-
"quasrindels")
12+
"quasrindels", "quasrdiscordantseq")
1213

1314
# fails with incorrect arguments
1415
expect_error(countMismatchStatePairs(bamfile = "error",
@@ -67,7 +68,7 @@ test_that("countMismatchStatePairs works", {
6768
sequenceReference = ref,
6869
BPPARAM = BiocParallel::SerialParam()),
6970
"Ignoring .regions. because .nAlnsToSample. is greater than zero"),
70-
"Cannot sample 1000 alignments from a total of ")
71+
"Cannot sample 1000 alignments from a total of ")
7172
expect_error(
7273
expect_warning(countMismatchStatePairs(bamfile = bamfiles[1],
7374
regions = NULL,
@@ -258,14 +259,29 @@ test_that("countMismatchStatePairs works", {
258259
expect_identical(res[33, 3], 2)
259260
expect_identical(unname(colSums(as.data.frame(res))), c(20100, 78, 32, 16, 10))
260261

262+
# ... reads where some read pairs display a sequence mismatch between the mates,
263+
# so that some positions are only recorded in the second
264+
resb <- countMismatchStatePairs(bamfile = bamfiles[6],
265+
bamFormat = "QuasR",
266+
regions = "chr1",
267+
sequenceContext = "C",
268+
windowSize = 200,
269+
sequenceReference = ref,
270+
BPPARAM = BiocParallel::SerialParam())
271+
expect_s4_class(resb, "DFrame")
272+
expect_identical(dim(resb), c(200L, 5L))
273+
expect_named(resb, c("S", "unmod_unmod", "unmod_mod", "mod_unmod", "mod_mod"))
274+
## compare to e.g. nomeR::get_ctable_from_SE(readMismatchBam(bamfiles = bamfiles[6], bamFormat = "QuasR", regions = "chr1:9784500-16452600", sequenceReference = ref, sequenceContext = "C"), "mod_prob", 0.5, 0.5, 0, 0, 200, FALSE, 1, FALSE)
275+
expect_identical(res, resb)
276+
261277
# ... reads with indels
262278
res1 <- countMismatchStatePairs(bamfile = bamfiles[5],
263-
bamFormat = "QuasR",
264-
regions = "chr1:1-7000000",
265-
sequenceContext = "C",
266-
windowSize = 200,
267-
sequenceReference = ref,
268-
BPPARAM = BiocParallel::SerialParam())
279+
bamFormat = "QuasR",
280+
regions = "chr1:1-7000000",
281+
sequenceContext = "C",
282+
windowSize = 200,
283+
sequenceReference = ref,
284+
BPPARAM = BiocParallel::SerialParam())
269285
expect_s4_class(res1, "DFrame")
270286
expect_identical(dim(res1), c(200L, 5L))
271287
expect_named(res1, c("S", "unmod_unmod", "unmod_mod", "mod_unmod", "mod_mod"))

0 commit comments

Comments
 (0)