Skip to contents

This function subsets a BAM file based on provided features (e.g., cell barcodes) and outputs one or more BAM files.

Usage

subsetbam(
  inputbam,
  features,
  outputbams,
  field = c("tag", "name"),
  dump_bam = NA,
  TAG = "CB",
  cores = 1,
  verbose = F,
  split_bam = F
)

Arguments

inputbam

A string specifying the path to the input BAM file.

features

A list of features (e.g., cell barcodes) to subset.

outputbams

A vector of strings specifying the paths to the output BAM files.

field

A string specifying the field to use for subsetting. Must be either "tag" ( use with TAG 'cb' for cell barcode) or "name". Default is "tag".

dump_bam

A string specifying the path to the dump BAM file. Default is NA.

TAG

A string specifying the BAM tag to use for subsetting. Default is "CB".

cores

An integer specifying the number of cores to use for parallel processing. Default is 1.

verbose

A logical indicating whether to print detailed messages. Default is FALSE.

split_bam

A logical indicating whether to split the BAM file across multiple cores. Default is FALSE.

Value

None

Details

It's important that the length of features is equal to the length of outputbams.