Skip to content

Commit

Permalink
Fixed error in tests with bam index.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanek committed Nov 2, 2023
1 parent c566d51 commit 866a84b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ sam <- c(
)
samfile <- tempfile(fileext = ".sam")
cat(paste(sam, collapse = "\n"), file = samfile)
bamfile <- Rsamtools::asBam(samfile, indexDestination = TRUE)
bamfile <- Rsamtools::asBam(samfile, indexDestination = FALSE)
Rsamtools::indexBam(bamfile)

## FASTA
fastafile <- system.file("extdata/test.fa", package = "Gviz")
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test_Gviz.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ test_that("import of alignments from BAM file works", {

unlink(paste(bamfile, "bai", sep = "."))
expect_error(.import.bam.alignments(bamfile, GRanges("chr1", IRanges(189891401, 189894000))), "Unable to find index for BAM file")
bamfile <- Rsamtools::asBam(samfile, indexDestination = TRUE, overwrite = TRUE)
bamfile <- Rsamtools::asBam(samfile, indexDestination = FALSE, overwrite = TRUE)
Rsamtools::indexBam(bamfile)

expect_identical(.import.bam.alignments(bamfile, GRanges("chr1", IRanges(189891401, 189894000))), bamgr)
expect_identical(.import.bam.alignments(bamfile, GRanges("chr2", IRanges(1, 2))), empty)
Expand Down

0 comments on commit 866a84b

Please sign in to comment.