getAlleleCount: Get alternative allele count for positions of interest

Description Usage Arguments Value Examples

Description

Get alternative allele count for positions of interest

Usage

1
getAlleleCount(gr, bamFile, indexFile, verbose = FALSE)

Arguments

gr

GenomicRanges object for positions of interest

bamFile

bam file

indexFile

bai index file

verbose

Boolean of whether or not to print progress and info

Value

refCount reference allele count information for each position of interest altCount alternative allele count information for each position of interest

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
# Sites of interest (chr1:4600000, chr2:2000)
gr <- GRanges(c('chr1', 'chr2'), IRanges(start=c(4600000, 2000), width=1))
# we can get the coverage at these SNP sites from our bams
path <- '../data-raw/bams/'
files <- list.files(path = path)
files <- files[grepl('.bam$', files)]
alleleCounts <- lapply(files, function(f) {
   bamFile <- paste0(path, f)
   indexFile <- paste0(path, paste0(f, '.bai'))
   getAlleleCount(gr, bamFile, indexFile)
})
altCounts <- do.call(cbind, lapply(1:length(gr), function(i) alleleCounts[[i]][[1]]))
refCounts <- do.call(cbind, lapply(1:length(gr), function(i) alleleCounts[[i]][[2]]))
colnames(altCounts) <- colnames(refCounts) <- files

## End(Not run)

JEFworks/HoneyBADGER documentation built on July 24, 2021, 3:01 p.m.