pileup_freqs: Create a table of A,C,G,T nucleotide frequencies for pileup...

Description Usage Arguments Value See Also Examples

View source: R/pileup_freqs.R

Description

Create a table of A,C,G,T nucleotide frequencies for pileup result. Source code from: https://seqqc.wordpress.com/2015/03/10/calculate-nucelotide-frequency-with-rsamtools-pileup/

Usage

1

Arguments

plp

Pileup result returned by Rsamtools::pileup(...).

Value

A data frame (or list, need to check by yourself) of A,C,G,T nucleotide frequencies.

See Also

calc_allelic_freqs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(Rsamtools)

# 1. Not run:
plp <- Rsamtools::pileup(...)

# 2. Not run -  computing the allelic counts for several SNPs
library(VariantAnnotation)

bamfile <- 'Tumor.rmdup.bam'
bf <- BamFile(bamfile)

#read list of SNPs (several)
vcf <- readVcf("vcfExample_chr17.vcf", "hg19")
vcf.ranges <- rowData(vcf) # You can also create a list of SNPs with GRanges

#compute pileup
#param <- ScanBamParam(which=GRanges("chr17",IRanges(start=685640, end=685650)))
param <- ScanBamParam(which=vcf.ranges)

p_param <- PileupParam(max_depth=1000, ignore_query_Ns=FALSE)
plp <- pileup(bf, scanBamParam=param, pileupParam=p_param)
dim(plp)

#create table of nucleotide frequencies
pileup_freqs(plp)

close(bf)

lixiangchun/lxctk documentation built on May 21, 2019, 6:44 a.m.