Learn R Programming

ExomeDepth (version 1.1.16)

getBamCounts: 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
)

Value

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

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.

Author

Vincent Plagnol

Details

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

References

exomeCopy R package.

Examples

Run this code

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)

Run the code above in your browser using DataLab