biovizBase (version 1.20.0)

pileupAsGRanges: Summarize reads for certain region

Description

This function summarize reads from bam files for nucleotides on single base unit in a given region, this allows the downstream mismatch summary analysis.

Usage

pileupAsGRanges(bams, regions, DNABases=c("A", "C", "G", "T", "N"), ...)

Arguments

bams
A character which specify the bam file path.
regions
A GRanges object specifying the region to be summarized. This passed to which arguments in ApplyPileupsParam.
DNABases
Nucleotide type you want to summarize in the result and in specified order. It must be one or more of A,C,G,T,N.
...
Extra parameters passed to ApplyPileupsParam.

Value

elementMetadata contains summary about this position about all nucleotides specified by DNABases. and depth for total reads, bam for file path.

Details

It's a wrapper around applyPileup function in Rsamtools package, more detailed control could be found under manual of ApplyPileupsParam function in Rsamtools. pileupAsGRanges function return a GRanges object which including summary of nucleotides, depth, bam file path. This object could be read directly into pileupGRangesAsVariantTable function for mismatch summary.

Examples

Run this code
## Not run: 
# library(Rsamtools)
# data(genesymbol)
# library(BSgenome.Hsapiens.UCSC.hg19)    
# bamfile <- system.file("extdata", "SRR027894subRBM17.bam", package="biovizBase")
# test <- pileupAsGRanges(bamfile, region = genesymbol["RBM17"])
# test.match <- pileupGRangesAsVariantTable(test, Hsapiens)
# head(test[,-7])
# head(test.match[,-5])
# ## End(Not run)

Run the code above in your browser using DataLab