-
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
fix build against dev dplyr #353
Comments
Most of the errors are related to library(testthat)
library(valr)
x <- tibble::tribble(
~ chrom, ~ start, ~ end,
"chr1", 1000, 2000,
"chr1", 1000, 400
)
pred <- tibble::tribble(
~ chrom, ~ start, ~ end,
"chr1", 1000, 400,
"chr1", 1000, 2000
)
res <- bed_sort(x)
expect_equal(res, pred)
#> Error: `res` not equal to `pred`.
#> Attributes: < Length mismatch: comparison on first 2 components >
#> Attributes: < Component "class": Lengths (4, 3) differ (string compare on first 3) >
#> Attributes: < Component "class": 3 string mismatches >
class(res)
#> [1] "tbl_ivl" "tbl_df" "tbl" "data.frame"
class(pred)
#> [1] "tbl_df" "tbl" "data.frame"
pred == res
#> chrom start end
#> [1,] TRUE TRUE TRUE
#> [2,] TRUE TRUE TRUE
expect_equivalent(res, pred) Created on 2020-03-20 by the reprex package (v0.3.0) |
Dev dplyr performance: library(valr)
library(dplyr, warn.conflicts = FALSE)
genome <- read_genome(valr_example('hg19.chrom.sizes.gz'))
# number of intervals
n <- 1e7
seed_x <- 1010486
x <- bed_random(genome, n = n, seed = seed_x)
packageVersion("dplyr")
#> [1] '0.8.99.9002'
microbenchmark::microbenchmark(
arrange(x, chrom, start, end),
x[order(x$chrom, x$start, x$end, method = "radix"), ],
times = 2,
unit = "s"
)
#> Unit: seconds
#> expr min lq
#> arrange(x, chrom, start, end) 6.6252349 6.6252349
#> x[order(x$chrom, x$start, x$end, method = "radix"), ] 0.2678227 0.2678227
#> mean median uq max neval cld
#> 6.6921549 6.6921549 6.759075 6.759075 2 b
#> 0.3317684 0.3317684 0.395714 0.395714 2 a Created on 2020-03-21 by the reprex package (v0.3.0) v 0.8.5 performance: library(valr)
library(dplyr, warn.conflicts = FALSE)
genome <- read_genome(valr_example('hg19.chrom.sizes.gz'))
# number of intervals
n <- 1e7
seed_x <- 1010486
x <- bed_random(genome, n = n, seed = seed_x)
packageVersion("dplyr")
#> [1] '0.8.5'
microbenchmark::microbenchmark(
arrange(x, chrom, start, end),
x[order(x$chrom, x$start, x$end, method = "radix"), ],
times = 2,
unit = "s"
)
#> Unit: seconds
#> expr min lq
#> arrange(x, chrom, start, end) 0.4096381 0.4096381
#> x[order(x$chrom, x$start, x$end, method = "radix"), ] 0.2582281 0.2582281
#> mean median uq max neval cld
#> 0.4190501 0.4190501 0.4284621 0.4284621 2 b
#> 0.2600742 0.2600742 0.2619203 0.2619203 2 a Created on 2020-03-21 by the reprex package (v0.3.0) |
There is also a performance hit with summarize that will not be addressed in v1.0.0. This is really noticeable when using library(valr)
library(bench)
library(dplyr, warn.conflicts = FALSE)
packageVersion("dplyr")
#> [1] '0.8.99.9002'
genome <- read_genome(valr_example('hg19.chrom.sizes.gz'))
# number of intervals
n <- 1e6
seed_x <- 1010486
x <- bed_random(genome, n = n, seed = seed_x)
seed_y <- 1010487
y <- bed_random(genome, n = n, seed = seed_y)
mark(bed_map(x, y, .n = n()),
bed_map(x, y, .n = length(end)),
iterations = 2)
#> Warning: Some expressions had a GC in every iteration; so filtering is disabled.
#> # A tibble: 2 x 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 bed_map(x, y, .n = n()) 6.6s 7.06s 0.142 449MB 6.30
#> 2 bed_map(x, y, .n = length(end)) 1.79s 1.85s 0.539 461MB 4.85 Created on 2020-03-22 by the reprex package (v0.3.0) |
New upstream changes are causing multiple test errors due to our custom library(tibble)
library(dplyr, warn.conflicts = F)
library(valr)
x <- tribble(
~ chrom, ~ start, ~ end,
"chr1", 100, 200
)
y <- as.tbl_interval(x)
bind_rows(x, y)
#> Error: No common type for `..1` <tbl_df<
#> chrom: character
#> start: double
#> end : double
#> >> and `..2` <tbl_ivl<
#> chrom: character
#> start: double
#> end : double
#> >>.
class(x)
#> [1] "tbl_df" "tbl" "data.frame"
class(y)
#> [1] "tbl_ivl" "tbl_df" "tbl" "data.frame" Created on 2020-04-02 by the reprex package (v0.3.0) |
Output from newest vctrs. We will need to define some custom functions for vctrs (see r-lib/vctrs#982) in order to keep our library(tibble)
library(dplyr, warn.conflicts = F)
library(valr)
x <- tribble(
~ chrom, ~ start, ~ end,
"chr1", 100, 200
)
y <- as.tbl_interval(x)
bind_rows(x, y)
#> Warning: Can't combine <tbl_df> and <tbl_ivl>.
#> ℹ Convert all inputs to the same class to avoid this warning.
#> ℹ See <https://vctrs.r-lib.org/reference/faq-warning-convert-inputs.html>.
#> ℹ Falling back to <data.frame>.
#> Error: Can't convert <tbl_ivl> to <data.frame>.
class(x)
#> [1] "tbl_df" "tbl" "data.frame"
class(y)
#> [1] "tbl_ivl" "tbl_df" "tbl" "data.frame" Created on 2020-04-21 by the reprex package (v0.3.0) |
We could consider dropping I think the main utility of the |
That's a good idea and will likely make maintenance easier. |
The text was updated successfully, but these errors were encountered: