getBamCounts: Get count data for multiple exomes

View source: R/countBamInGranges.R

getBamCountsR Documentation

Get count data for multiple exomes

Description

Essentially a wrapper for the accessory function countBamInGRanges which only considers a single BAM file at a time.

Usage

getBamCounts(
  bed.frame = NULL,
  bed.file = NULL,
  bam.files,
  index.files = bam.files,
  min.mapq = 20,
  read.width = 300,
  include.chr = FALSE,
  referenceFasta = NULL
)

Arguments

bed.frame

data.frame containing the definition of the regions. The first three columns must be chromosome, start, end.

bed.file

character file name. Target BED file with the definition of the regions. This file will only be used if no bed.frame argument is provided. No headers are assumed so remove them if they exist. Either a bed.file or a bed.frame must be provided for this function to run.

bam.files

character, list of BAM files to extract read count data from.

index.files

Optional character argument with the list of indexes for the BAM files, without the '.bai' suffix. If the indexes are simply obtained by adding .bai to the BAM files, this argument does not need to be specified.

min.mapq

numeric, minimum mapping quality to include a read.

read.width

numeric, maximum distance between the side of the target region and the middle of the paired read to include the paired read into that region.

include.chr

logical, if set to TRUE, this function will add the string 'chr' to the chromosome names of the target BED file.

referenceFasta

character, file name for the reference genome in fasta format. If available, GC content will be computed and added to the output.

Details

This function is largely a copy of a similar one available in the exomeCopy package.

Value

A GenomicRanges object that stores the read count data for the BAM files listed as argument.

Author(s)

Vincent Plagnol

References

exomeCopy R package.

Examples


data(exons.hg19)
exons.hg19.RHD <- subset(exons.hg19, grepl(pattern = '^RHD', exons.hg19[['name']]))
minimum_bam_file <- system.file('extdata/minimum_1_25630000_25650000.bam',
                                package = 'ExomeDepth')
my_counts <- getBamCounts(bed.frame = exons.hg19.RHD,
                          bam.files = minimum_bam_file)
print(my_counts)


ExomeDepth documentation built on Nov. 3, 2022, 5:05 p.m.