downsampleBam: Randomly downsample bam file to a target depth

View source: R/downsampleBam.R

downsampleBamR Documentation

Randomly downsample bam file to a target depth

Description

Randomly downsample bam file to a target depth

Usage

downsampleBam(
  bamfile,
  genome = NA_character_,
  input_depth = NULL,
  input_mapped_reads_count = NULL,
  output_depth = 0.1,
  output_type = c("bam", "rds"),
  output_dir = NULL,
  return_result = TRUE,
  ...
)

Arguments

bamfile

String. A bam file.

genome

Single String or NA. Supported values: "hg19", "hg38", or "GRCh38". Used for setting the seqinfo in the resulting GALP object.

input_depth

Numerical. If not supplied, infer the depth based on the total mapped paired reads in the input bam file.

input_mapped_reads_count

Numerical. If not supplied, infer the depth based on the total mapped reads in the input bam file.

output_depth

Numerical. Default is 0.1, which mean 0.1x target depth after downsampling.

output_type

Vector. Default is c("bam", "rds"), which means saving the downsampled bam as bam file AND rds file (i.e. GAlignmentPairs object).

output_dir

String. If not supplied, it will be set as the same folder with input bamfile.

return_result

Boolean. TRUE(default) means the result will be returned as an R object to console or the designated object.

...

further parameters for bam_to_galp2 function.

Value

GAlignmentPairs object containg the downsampled reads.


hw538/cfDNAPro documentation built on Aug. 13, 2024, 2:58 p.m.