Read in a (list of) BAM file(s) into a GRanges(List) object.

Share:

Description

A wrapper script for coverting the contents of BAM files for use with GenomicRanges classes.

Usage

1
2
3
4
5
6
7
8
  ## S4 method for signature 'character'
BAM2GRanges(path, what = character(),
      flag = scanBamFlag(isUnmappedQuery = FALSE, isDuplicate = FALSE),
      verbose = TRUE)
  ## S4 method for signature 'character'
BAM2GRangesList(paths, what = character(),
      flag = scanBamFlag(isUnmappedQuery = FALSE, isDuplicate = FALSE),
      verbose = TRUE)

Arguments

path

A character vector of length 1. The path of the BAM file.

paths

A character vector of possibly any length. The paths of the BAM files.

what

What optional attributes of a read to retain. See scanBam and the value section.

flag

What kinds of reads to retain. See ScanBamParam and the flag argument.

verbose

Whether to print the progess of processing.

Value

For the single pathname method; a GRanges object. For the multiple pathnames method; a GRangesList object.

Author(s)

Dario Strbenac

Examples

1
2
3
  tiny.BAM <- system.file("extdata", "ex1.bam", package = "Rsamtools")
  if(length(tiny.BAM) > 0)
    print(BAM2GRanges(tiny.BAM))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.