get_snv_read_count: Get Nucleotide Read Counts

Description Usage Arguments Value Examples

Description

Wrapper function over Rsamtools::pileup to retrieve nucleotide read count values over a set of positions. This function serves more as a way to document how to use the pileup function.

Usage

1
get_snv_read_count(bamfile, scan.bam.param, pileup.param)

Arguments

bamfile

Path to the input bam file.

pileup.param

Rsamtools::PileupParam object which specifies specific pileup parameters for filtering.

scan.bam.params

Rsamtools::ScanBamParam object which specifies positions to lookup and additional read filtering. See the ScanBamParam documentation for specific details.

Value

data.frame containing the nucleotide and read count information for each position specified.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library("GenomicRanges")
library("Rsamtools")

bamfile <- system.file("extdata", "ex1.bam", package = "Rsamtools")

# Setup Lookup Positions 
positions.df <- data.frame(chr = c("seq1", "seq1", "seq1"),
                           start = c(50, 891, 1000),
                           stop = c(50, 891, 1000))
positions.gr <- makeGRangesFromDataFrame(positions.df)
scan.bam.param <- ScanBamParam(which = positions.gr)

# Setup Read Filters
pileup.param <- PileupParam(max_depth = 1000, min_mapq = 13, 
                            min_base_quality = 20, 
                            distinguish_strands = FALSE, 
                            min_nucleotide_depth = 0)

get_snv_read_count(bamfile, scan.bam.param)

tinyheero/tinyutils documentation built on May 31, 2019, 3:36 p.m.