bed_genomecov: Calculate coverage across a genome

View source: R/bed_genomecov.R

bed_genomecovR Documentation

Calculate coverage across a genome

Description

This function is useful for calculating interval coverage across an entire genome.

Usage

bed_genomecov(x, genome, zero_depth = FALSE)

Arguments

x

ivl_df

genome

genome_df

zero_depth

If TRUE, report intervals with zero depth. Zero depth intervals will be reported with respect to groups.

Details

input tbls are grouped by chrom by default, and additional groups can be added using dplyr::group_by(). For example, grouping by strand will constrain analyses to the same strand. To compare opposing strands across two tbls, strands on the y tbl can first be inverted using flip_strands().

Value

ivl_df with the an additional column:

  • .depth depth of interval coverage

See Also

https://bedtools.readthedocs.io/en/latest/content/tools/genomecov.html

Other single set operations: bed_cluster(), bed_complement(), bed_flank(), bed_merge(), bed_partition(), bed_shift(), bed_slop()

Examples

x <- tibble::tribble(
  ~chrom, ~start, ~end, ~strand,
  "chr1", 20, 70, "+",
  "chr1", 50, 100, "-",
  "chr1", 200, 250, "+",
  "chr1", 220, 250, "+"
)

genome <- tibble::tribble(
  ~chrom, ~size,
  "chr1", 500,
  "chr2", 1000
)

bed_genomecov(x, genome)

bed_genomecov(dplyr::group_by(x, strand), genome)

bed_genomecov(dplyr::group_by(x, strand), genome, zero_depth = TRUE)


rnabioco/valr documentation built on April 25, 2024, 11:22 a.m.