Calculate Jaccard distance between two BED-like data sets

jaccard_bed(
  x,
  y,
  min_overlap = 1,
  min_overlap_type = c("bp", "frac1", "frac2")
)

Arguments

x

A GRanges.

y

A GRanges.

min_overlap

The smallest overlapping region for two intervals to be considered as overlapping. Default is 1.

min_overlap_type

A character value indicating how min_overlap is interpreted. bp means min_overlap is the number of base pairs. frac1 means min_overlap is the minimum overlap required as a fraction of x. Similarly, frac2 means min_overlap is the minimum overlap required as a fraction of y. Similar to bedtools intersect's -f and -F arguments.

Value

The Jaccard statistics.

References

Manual page of bedtools jaccard: https://bedtools.readthedocs.io/en/latest/content/tools/jaccard.html

See also

Examples

# Load BED tables
x <- read_bed(system.file("extdata", "example_merge.bed", package = "bedtorch"), use_gr = FALSE)
y <- read_bed(system.file("extdata", "example_intersect_y.bed", package = "bedtorch"), use_gr = FALSE)

# Basic usages
result <- jaccard_bed(x, y) 
head(result)
#>    intersection union   jaccard n_intersections
#> 1:           33    94 0.3510638               8