You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bfcquery returns inconsistent column types for empty rows #26
The column header types for the columns create_time and access_time are character vectors when non-empty, and double vectors when empty.
I expect that they should consistently return the same type; maybe character vectors always; although it's not clear why they are not date or datetime types instead.
Returning inconsistent types throws an error when trying to row bind join multiple queries using purrr::map_df where some of the queries are successful and some of them fail:
>files_remote
[1] "ftp://ftp.ncbi.nlm.nih.gov/geo/samples/GSM1480nnn/GSM1480327/suppl/GSM1480327_K562_PROseq_minus.bw"
[2] "ftp://ftp.ncbi.nlm.nih.gov/geo/samples/GSM1480nnn/GSM1480327/suppl/GSM1480327_K562_PROseq_plus.bw"> map_df(files_remote, bfcquery, x=bfc)
Error:Can't combine `create_time` <character> and `create_time` <double>.Run `rlang::last_error()` to see where the error occurred.> map_df(files_remote[1], bfcquery, x = bfc)# A tibble: 1 x 10 rid rname create_time access_time rpath rtype fpath last_modified_t… etag <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>1 BFC6 ftp:… 2020-06-29… 2020-06-29… /hom… web ftp:… NA NA # … with 1 more variable: expires <dbl>> map_df(files_remote[2], bfcquery, x = bfc)# A tibble: 0 x 10# … with 10 variables: rid <chr>, rname <chr>, create_time <dbl>,# access_time <dbl>, rpath <chr>, rtype <chr>, fpath <chr>,# last_modified_time <dbl>, etag <chr>, expires <dbl>>
Sorry for the long delay. I'm looking into this and I'm not quite sure how to correct it. It seems like a bug when using dplyr::filter that somehow changes the columns type.
If I omit dplyr::filter, using an empty BiocFileCache defaults to double for time columns or - in the second bfcquery below - columns only containing NA. Can empty maintain preserve a consistent type?
library(purrr)
library(stringr)
library(BiocFileCache)
path<- tempfile()
bfc<- BiocFileCache(path, ask=FALSE)
files_remote<-
str_c(file.path("ftp://ftp.ncbi.nlm.nih.gov",
"geo/samples/GSM1480nnn/GSM1480327/suppl",
"GSM1480327_K562_PROseq_"),
c("minus", "plus"),
".bw")
map_df(files_remote, bfcquery, x=bfc)
# A tibble: 0 × 10# ℹ 10 variables: rid <chr>, rname <chr>, create_time <dbl>, access_time <dbl>,# rpath <chr>, rtype <chr>, fpath <chr>, last_modified_time <dbl>,# etag <chr>, expires <dbl>
bfcadd(bfc, files_remote[1])
#> |======================================================================| 100%#> BFC1 #> "/tmp/RtmpDRIP5H/file2ff2a62a8acdc8/2ff2a64678a220_GSM1480327_K562_PROseq_minus.bw"
map_df(files_remote[1], bfcquery, x=bfc)
#> # A tibble: 1 × 10#> rid rname create_time access_time rpath rtype fpath last_modified_time etag #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>#> 1 BFC1 ftp:… 2024-12-06… 2024-12-06… /tmp… web ftp:… NA NA #> # ℹ 1 more variable: expires <dbl>
map_df(files_remote, bfcquery, x=bfc)
#> Error in `dplyr::bind_rows()`:#> ! Can't combine `..1$create_time` <character> and `..2$create_time` <double>.#> Run `rlang::last_trace()` to see where the error occurred.
Activity
omsai commentedon Jun 29, 2020
I'm a little behind on my R installation and can update if you can't reproduce the problem:
lshep commentedon Apr 1, 2021
Sorry for the long delay. I'm looking into this and I'm not quite sure how to correct it. It seems like a bug when using dplyr::filter that somehow changes the columns type.
omsai commentedon Dec 6, 2024
If I omit
dplyr::filter, using an empty BiocFileCache defaults to double for time columns or - in the secondbfcquerybelow - columns only containing NA. Can empty maintain preserve a consistent type?