readBamFileAsGRanges: Import BAM file into GRanges

View source: R/importReads.R

readBamFileAsGRangesR Documentation

Import BAM file into GRanges

Description

Import aligned reads from a BAM file into a GRanges-class object.

Usage

readBamFileAsGRanges(
  file,
  bamindex = file,
  chromosomes = NULL,
  pairedEndReads = FALSE,
  min.mapq = 10,
  remove.duplicate.reads = TRUE,
  pair2frgm = FALSE,
  filtAlt = FALSE
)

Arguments

file

Bamfile with aligned reads.

bamindex

Bam-index file with or without the .bai ending. If this file does not exist it will be created and a warning is issued.

chromosomes

If only a subset of the chromosomes should be binned, specify them here.

pairedEndReads

Set to TRUE if you have paired-end reads in your file.

min.mapq

Minimum mapping quality when importing from BAM files.

remove.duplicate.reads

A logical indicating whether or not duplicate reads should be kept.

pair2frgm

Set to TRUE if every paired-end read should be merged into a single fragment.

filtAlt

Set to TRUE if you want to filter out alternative alignments defined in 'XA' tag.

Value

A GRanges-class object.

Author(s)

David Porubsky, Aaron Taudt, Ashley Sanders

Examples

## Get an example file 
exampleFolder <- system.file("extdata", "example_bams", package="breakpointRdata")
exampleFile <- list.files(exampleFolder, full.names=TRUE)[1]
## Load the file
fragments <- readBamFileAsGRanges(exampleFile, pairedEndReads=FALSE, chromosomes='chr22')

daewoooo/BreakPointR documentation built on May 8, 2024, 10:43 p.m.