View source: R/bam_to_bigwig.R
bam_to_bigwig | R Documentation |
Given an input BAM file, convert this to the BigWig format which can then be
used in get_coverage()
.
bam_to_bigwig(
bam_file,
prefix = file.path(tempdir(), basename(bam_file)),
min_unique_qual = FALSE,
double_count = FALSE,
overwrite = FALSE
)
bam_file |
A |
prefix |
A |
min_unique_qual |
A |
double_count |
A |
overwrite |
A |
Note that this functionality is currently not supported on Windows by Megadepth.
A character()
with the path to the output files(s).
## Install the latest version if necessary
install_megadepth(force = TRUE)
## Find the example BAM file
example_bam <- system.file("tests", "test.bam",
package = "megadepth", mustWork = TRUE
)
## Create the BigWig file
## Currently Megadepth does not support this on Windows
if (!xfun::is_windows()) {
example_bw <- bam_to_bigwig(example_bam, overwrite = TRUE)
## Path to the output file(s) generated by bam_to_bigwig()
example_bw
## Use the all.bw file in get_coverage(), first find an annotation file
annotation_file <- system.file("tests", "testbw2.bed",
package = "megadepth", mustWork = TRUE
)
## Compute the coverage
bw_cov <- get_coverage(
example_bw["all.bw"],
op = "mean",
annotation = annotation_file
)
bw_cov
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.