rnabioco / valr

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

complement reports 1-based start interval #275

Closed jayhesselberth closed 7 years ago

jayhesselberth commented 7 years ago

Should be 0-based.

library(valr)
library(dplyr, warn.conflicts = FALSE)

x <- read_bed12(valr_example('mm9.refGene.bed.gz'))
genome <- read_genome(valr_example('hg19.chrom.sizes.gz'))

bed_merge(x) %>% bed_complement(genome)
#> # A tibble: 89 x 3
#>    chrom    start      end
#>    <chr>    <dbl>    <int>
#>  1  chr1        1  3204562
#>  2  chr1  3661579  4280926
#>  3  chr1  4399322  4847774
#>  4  chr1  4887990  4899656
#>  5  chr1  5060366  5073166
#>  6  chr1  5152630  8349819
#>  7  chr1  9289958 10314799
#>  8  chr1 10710026 11404185
#>  9  chr1 11965983 13615979
#> 10  chr1 13650590 20941706
#> # ... with 79 more rows
kriemo commented 7 years ago

Strange, I'm unable to reproduce the same behavior on my end.

suppressMessages(devtools::install_github("rnabioco/valr", force = T))
library(valr)
library(dplyr, warn.conflicts = FALSE)

x <- read_bed12(valr_example('mm9.refGene.bed.gz'))
genome <- read_genome(valr_example('hg19.chrom.sizes.gz'))

bed_merge(x) %>% bed_complement(genome)
#> # A tibble: 89 x 3
#>    chrom    start      end
#>    <chr>    <dbl>    <int>
#>  1  chr1        0  3204562
#>  2  chr1  3661579  4280926
#>  3  chr1  4399322  4847774
#>  4  chr1  4887990  4899656
#>  5  chr1  5060366  5073166
#>  6  chr1  5152630  8349819
#>  7  chr1  9289958 10314799
#>  8  chr1 10710026 11404185
#>  9  chr1 11965983 13615979
#> 10  chr1 13650590 20941706
#> # ... with 79 more rows
jayhesselberth commented 7 years ago

Yep, reinstall fixed it. Weird.