If >1 BAM file provided, merges them into a single BAM file using mergeBam.

merge_bam(
  bam_files,
  destination = tempfile(fileext = ".merged.bam"),
  overwrite = TRUE,
  verbose = TRUE
)

Arguments

bam_files

One or more BAM files.

destination

The character(1) file name of the location where the sorted, filtered, or merged output file will be created. For asBam asSam, and sortBam this is without the “.bam” file suffix.

overwrite

A logical(1) indicating whether the destination can be over-written if it already exists.

verbose

Print messages.

Value

Path to merged BAM file.

Examples

bam_files <- c(system.file("extdata", "querybins.bam", package="Rsamtools"),
               system.file("extdata", "revbins.bam", package="Rsamtools"))
bam_merged <- merge_bam(bam_files = bam_files)
#> Merging 2 BAM files.
#> Merging bam: done in 0 min