This function returns all intervals in a genome that are not covered by at least one interval in the input.

complement_bed(x, genome = NULL)

Arguments

x

A GRanges.

genome

Specify the reference genome for the BED file. genome can be a valid genome name in GenomeInfoDb::Seqinfo(), e.g. GRCh37, or hs37-1kg, which is a genome shipped with this package, or any custom chromosome size files (local or remote). If NULL, will try to obtain such information from input data. Refer to read_bed().

Value

A GRanges which is the complement of x.

References

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

See also

Examples

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

# Basic usage
result <- complement_bed(tbl, "hs37-1kg")
head(result)
#>    chrom start       end
#> 1:     1     0 249250621
#> 2:     2     0 243199373
#> 3:     3     0 198022430
#> 4:     4     0 191154276
#> 5:     5     0 180915260
#> 6:     6     0 171115067
#> -------
#> genome: unspecified.