Skip to contents

Bed files can contain peak or blacklist annotations. These utilities help read thos annotations

Usage

read_bed(
  path,
  additional_columns = character(0),
  backup_url = NULL,
  timeout = 300
)

read_encode_blacklist(
  dir,
  genome = c("hg38", "mm10", "hg19", "dm6", "dm3", "ce11", "ce10"),
  timeout = 300
)

Arguments

path

Path to file (or desired save location if backup_url is used)

additional_columns

Names for additional columns in the bed file

backup_url

If path does not exist, provides a URL to download the gtf from

timeout

Maximum time in seconds to wait for download from backup_url

dir

Output directory to cache the downloaded gtf file

genome

genome name

Value

Data frame with coordinates using the 0-based convention.

Details

read_bed

Read a bed file from disk or a url.

read_encode_blacklist

Downloads the Boyle Lab blacklist, as described in https://doi.org/10.1038/s41598-019-45839-z

Examples

## Dummy bed file creation
data.frame(
 chrom = rep("chr1", 6),
 start = seq(20, 121, 20),
 end = seq(39, 140, 20)
) %>% write.table("./references/example.bed", row.names = FALSE, col.names = FALSE, sep = "\t")


#######################################################################
## read_bed() example
#######################################################################
read_bed("./references/example.bed")
#> # A tibble: 6 × 3
#>   chr   start   end
#>   <chr> <dbl> <dbl>
#> 1 chr1     20    39
#> 2 chr1     40    59
#> 3 chr1     60    79
#> 4 chr1     80    99
#> 5 chr1    100   119
#> 6 chr1    120   139


#######################################################################
## read_encode_blacklist() example
#######################################################################
read_encode_blacklist("./reference")
#> # A tibble: 636 × 4
#>    chr       start       end reason            
#>    <chr>     <dbl>     <dbl> <chr>             
#>  1 chr10         0     45700 Low Mappability   
#>  2 chr10  38481300  38596500 High Signal Region
#>  3 chr10  38782600  38967900 High Signal Region
#>  4 chr10  39901300  41712900 High Signal Region
#>  5 chr10  41838900  42107300 High Signal Region
#>  6 chr10  42279400  42322500 High Signal Region
#>  7 chr10 126946300 126953400 Low Mappability   
#>  8 chr10 133625800 133797400 High Signal Region
#>  9 chr11         0    194500 Low Mappability   
#> 10 chr11    518900    520700 Low Mappability   
#> # ℹ 626 more rows