View source: R/downsampleBam.R
downsampleBam | R Documentation |
Downsampling a BAM file to achieve a specified sequencing depth. Exports the data as a BAM file and/or an RDS file containing a 'GAlignmentPairs' object.
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,
...
)
bamfile |
Path to a BAM file. |
genome |
Supported values: "hg19", "hg38", "GRCh38", or NA. Sets seqinfo. |
input_depth |
Target depth, inferred if not supplied. |
input_mapped_reads_count |
Mapped reads count to infer depth if not supplied. |
output_depth |
Target output depth after downsampling, default is 0.1. |
output_type |
Output file formats, default is c("bam", "rds"). |
output_dir |
Directory for output files, defaults to input file directory. |
return_result |
If TRUE (default), returns result as an R object. |
... |
Additional parameters for 'bam_to_galp2' function. |
'GAlignmentPairs' object with the downsampled reads if return_result.
## Not run:
# Downsample a BAM file to 10% of its original depth
result <- downsampleBam("/path/to/your.bam", genome = "hg38",
output_depth = 0.1, output_type = c("bam", "rds"),
return_result = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.