inst/unitTests/off_test_bam_tally.R
b22faf0d
 test_bam_tally <- function() {
   f <- system.file("extdata", "test_data_aln",
                    "test_data_aln.concordant_uniq.bam", package = "gmapR")
   bf <- BamFile(f)
   
16509777
   bam_tally(bf, BamTallyParam(genome))
b22faf0d
 }
 
 test_bam_tally_C <- function() {
   library(BSgenome.Dmelanogaster.UCSC.dm3)
 
   genome <- GmapGenome(Dmelanogaster, create = TRUE)
 
   library(pasillaBamSubset)
   bam <- untreated3_chr4()
   
   bf <- Rsamtools::BamFile(bam)
99c8aa8d
   which <- GRanges("chr4", IRanges(1e6, 1.3e6))
6b504615
   gr <- bam_tally(bf, BamTallyParam(genome, indels=TRUE, which = which))
16509777
   gr <- bam_tally(bf, BamTallyParam(genome, variant_strand = 1L))
   gr <- bam_tally(bf, BamTallyParam(genome, which = which, variant_strand = 1L))
99c8aa8d
   empty <- GRanges("chr2L", IRanges(1e6, 2e6))
16509777
   gr <- bam_tally(bf, BamTallyParam(genome, which = empty))
b22faf0d
   
59c36844
   gr <- bam_tally(bf, BamTallyParam(genome, read_pos_breaks = c(1, 15, 30, 40)))
6b504615
 
   genome <- GmapGenome("hg19_IGIS21")
99c8aa8d
   which <- GRanges("1", IRanges(1e6, 2e6))
6b504615
   bam <- "~/share/data/R1047_LIB6635_SAM636095_L1_NXG2449.analyzed.bam"
   bf <- Rsamtools::BamFile(bam)
1a08f356
   gr <- bam_tally(bf, BamTallyParam(genome, which = which, variant_strand = 1L,
59c36844
                                     read_pos_breaks = c(0L, 10L, 75L),
1a08f356
                                     indels = TRUE))
6b504615
   
b22faf0d
 }