Description Usage Arguments Value Functions See Also Examples
View source: R/read_coverage.R
Read an *annotation.tsv
file created by get_coverage()
or manually by
the user using Megadepth.
1 2 3 | read_coverage(tsv_file, verbose = TRUE)
read_coverage_table(tsv_file)
|
tsv_file |
A |
verbose |
A |
A GRanges-class object with the coverage summarization across the annotation ranges.
A tibble::tible()
with columns chr
, start
, end
and score
.
read_coverage_table
: Read a coverage TSV file created by Megadepth as
a table
Other Coverage functions:
get_coverage()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Install if necessary
install_megadepth()
## Locate example BigWig and annotation files
example_bw <- system.file("tests", "test.bam.all.bw",
package = "megadepth", mustWork = TRUE
)
annotation_file <- system.file("tests", "testbw2.bed",
package = "megadepth", mustWork = TRUE
)
## Compute the coverage
bw_cov <- get_coverage(example_bw, op = "mean", annotation = annotation_file)
bw_cov
## Read in the coverage file again, using read_coverage()
## First, lets locate the tsv file that was generated by get_coverage()
tsv_file <- file.path(tempdir(), "bw.mean.annotation.tsv")
bw_cov_manual <- read_coverage(tsv_file)
stopifnot(identical(bw_cov, bw_cov_manual))
## To get an RleList object, just like the one you would get
## from using rtracklayer::import.bw(as = "RleList") directly on the
## BigWig file, use:
GenomicRanges::coverage(bw_cov_manual)
## The coverage data can also be read as a `tibble::tibble()`
read_coverage_table(tsv_file)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.