-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unexpected behavior when intersecting three tibbles #380
Labels
Comments
thanks for the detailed reprex. I worried that code might not be robust for detecting certain inputs. I'll work on a solution. |
Merged
With the changes introduced by #381 these errors should be resolved. Github actions are not running the build checks for ubuntu for some reason. Once these complete successfully I'll merge the changes and notify you. library(valr)
library(tibble)
x <- tibble::tribble(
~chrom, ~start, ~end,
'chr1', 100, 500,
'chr2', 200, 400,
'chr2', 300, 500,
'chr2', 800, 900
)
y <- tibble::tribble(
~chrom, ~start, ~end, ~value,
'chr1', 150, 400, 100,
'chr1', 500, 550, 100,
'chr2', 230, 430, 200,
'chr2', 350, 430, 300
)
z <- tibble::tribble(
~chrom, ~start, ~end, ~value,
'chr1', 150, 400, 100,
'chr1', 500, 550, 100,
'chr2', 230, 430, 200,
'chr2', 750, 900, 400
)
lst <- list(y, z)
bed_intersect(x, y, z)
#> # A tibble: 11 × 8
#> chrom start.x end.x start.y end.y value.y .source .overlap
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <int>
#> 1 chr1 100 500 150 400 100 y 250
#> 2 chr1 100 500 150 400 100 z 250
#> 3 chr1 100 500 500 550 100 y 0
#> 4 chr1 100 500 500 550 100 z 0
#> 5 chr2 200 400 230 430 200 y 170
#> 6 chr2 200 400 230 430 200 z 170
#> 7 chr2 200 400 350 430 300 y 50
#> 8 chr2 300 500 230 430 200 y 130
#> 9 chr2 300 500 230 430 200 z 130
#> 10 chr2 300 500 350 430 300 y 80
#> 11 chr2 800 900 750 900 400 z 100
bed_intersect(x, list(y, z))
#> # A tibble: 11 × 8
#> chrom start.x end.x start.y end.y value.y .source .overlap
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <int>
#> 1 chr1 100 500 150 400 100 y 250
#> 2 chr1 100 500 150 400 100 z 250
#> 3 chr1 100 500 500 550 100 y 0
#> 4 chr1 100 500 500 550 100 z 0
#> 5 chr2 200 400 230 430 200 y 170
#> 6 chr2 200 400 230 430 200 z 170
#> 7 chr2 200 400 350 430 300 y 50
#> 8 chr2 300 500 230 430 200 y 130
#> 9 chr2 300 500 230 430 200 z 130
#> 10 chr2 300 500 350 430 300 y 80
#> 11 chr2 800 900 750 900 400 z 100
bed_intersect(x, lst[1:2])
#> # A tibble: 11 × 8
#> chrom start.x end.x start.y end.y value.y .source .overlap
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <int>
#> 1 chr1 100 500 150 400 100 1 250
#> 2 chr1 100 500 150 400 100 2 250
#> 3 chr1 100 500 500 550 100 1 0
#> 4 chr1 100 500 500 550 100 2 0
#> 5 chr2 200 400 230 430 200 1 170
#> 6 chr2 200 400 230 430 200 2 170
#> 7 chr2 200 400 350 430 300 1 50
#> 8 chr2 300 500 230 430 200 1 130
#> 9 chr2 300 500 230 430 200 2 130
#> 10 chr2 300 500 350 430 300 1 80
#> 11 chr2 800 900 750 900 400 2 100
bed_intersect(x, lst)
#> # A tibble: 11 × 8
#> chrom start.x end.x start.y end.y value.y .source .overlap
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <int>
#> 1 chr1 100 500 150 400 100 1 250
#> 2 chr1 100 500 150 400 100 2 250
#> 3 chr1 100 500 500 550 100 1 0
#> 4 chr1 100 500 500 550 100 2 0
#> 5 chr2 200 400 230 430 200 1 170
#> 6 chr2 200 400 230 430 200 2 170
#> 7 chr2 200 400 350 430 300 1 50
#> 8 chr2 300 500 230 430 200 1 130
#> 9 chr2 300 500 230 430 200 2 130
#> 10 chr2 300 500 350 430 300 1 80
#> 11 chr2 800 900 750 900 400 2 100
bed_intersect(x, lst[1])
#> # A tibble: 6 × 7
#> chrom start.x end.x start.y end.y value.y .overlap
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <int>
#> 1 chr1 100 500 150 400 100 250
#> 2 chr1 100 500 500 550 100 0
#> 3 chr2 200 400 230 430 200 170
#> 4 chr2 200 400 350 430 300 50
#> 5 chr2 300 500 230 430 200 130
#> 6 chr2 300 500 350 430 300 80
bed_intersect(x, lst[[1]], lst[[2]])
#> # A tibble: 11 × 8
#> chrom start.x end.x start.y end.y value.y .source .overlap
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <int>
#> 1 chr1 100 500 150 400 100 1 250
#> 2 chr1 100 500 150 400 100 2 250
#> 3 chr1 100 500 500 550 100 1 0
#> 4 chr1 100 500 500 550 100 2 0
#> 5 chr2 200 400 230 430 200 1 170
#> 6 chr2 200 400 230 430 200 2 170
#> 7 chr2 200 400 350 430 300 1 50
#> 8 chr2 300 500 230 430 200 1 130
#> 9 chr2 300 500 230 430 200 2 130
#> 10 chr2 300 500 350 430 300 1 80
#> 11 chr2 800 900 750 900 400 2 100 Created on 2021-10-17 by the reprex package (v2.0.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When passing a list of tibbles to bed_intersect an unexpected error is thrown:
The text was updated successfully, but these errors were encountered: