rnabioco / valr

Genome Interval Arithmetic in R
http://rnabioco.github.io/valr/
Other
88 stars 25 forks source link

bed_slop failed test "going beyond the end of the chrom" #323

Closed raysinensis closed 6 years ago

raysinensis commented 6 years ago

start output did not respect chrom size similar to issue with bed_shift

library(valr)
tiny.genome <- tibble::tribble(
  ~chrom, ~size,
  "chr1", 1000
)
b <- tibble::tribble(
  ~chrom, ~start, ~end, ~name, ~score, ~strand,
  "chr1", 950, 970, "a1", 5, "-"
)
res <- bed_slop(b, tiny.genome, left = 60, right = -60, strand = TRUE, trim = TRUE)
res
#> # A tibble: 1 x 6
#>   chrom start   end  name score strand
#>   <chr> <dbl> <dbl> <chr> <dbl>  <chr>
#> 1  chr1  1010  1000    a1     5      -

Created on 2018-01-19 by the reprex package (v0.1.1.9000).

kriemo commented 6 years ago

Expected output based on bedtools test

res <- tibble::tribble(
  ~chrom, ~start, ~end, ~name, ~score, ~strand,
  "chr1", 999, 1000, "a1", 5, "-"
)