bed_intersect_left: Left join intersection of two tibble BEDs

View source: R/bed_intersect_left.R

bed_intersect_leftR Documentation

Left join intersection of two tibble BEDs

Description

Intersect two tibble BEDs and retain the full intervals from the lefthand tibble BED that have any overlap with the righthand tibble BED. Optionally retain the interval coordinates for the righthand tibble in the metadata. If the two input tibble BEDs share any common metadata column names, or if keepBcoords = TRUE, then unique suffixes must be provided. This function is built as a modification of the valr::bed_intersect() function. Equivalent to bedtools -a A.bed -b B.bed -wa

Usage

bed_intersect_left(
  bedA,
  bedB,
  suffix = c("", ""),
  keepBcoords = T,
  keepBmetadata = T,
  suffixMetadataCols = F
)

Arguments

bedA

A tibble BED with columns: chrom, start, end, ...(metadata cols)...

bedB

A tibble BED with columns: chrom, start, end, ...(metadata cols)...

suffix

A character vector of suffixes to add to metadata column names. (If the two input tibble BEDs share any common metadata column names, suffixes must be provided.)

keepBcoords

If TRUE, coordinates from bedB are retained in the metadata. Must provide unique suffix for bedB to avoid start/end column duplication. Default is TRUE.

keepBmetadata

If FALSE, bedB columns are dropped and only the original bedA columns are returned, filtered to those intervals that intersect with any bedB intervals.

suffixMetadataCols

If TRUE, suffixes are also added to the end of metadata column names, not just the coordinate columns. Default is FALSE.

Value

A tibble BED of all intervals from bedA that contain intersects with bedB, plus all metadata columns from both


alextidd/tgp documentation built on June 1, 2022, 9:25 a.m.