read_bam_file {segmenter} | R Documentation

## Read `bam` files

### Description

Count the reads in each range of the `GRanges` object

### Usage

    read_bam_file(file, features, ...)

### Arguments

`file` | A string. The path to the file.
`features` | A `GRanges` object.
`...` | Other arguments passed to `bamCount`.

### Value

A `matrix`

### Examples

    # locate the bam file
    bam_file <- system.file("extdata", "randomBam.bam", package = "bamsignals")

    # load a granges object
    rand_anno <- system.file("extdata",
                             "randomAnnot.Rdata",
                             package = "bamsignals")
    features <- GenomicRanges::promoters(get(load(rand_anno)))

    # count reads in ranges
    read_bam_file(bam_file, features)

[Package segmenter version 1.0.0 Index]