UCLouvain-CBIO / depmap

Cancer Dependency Map package
https://uclouvain-cbio.github.io/depmap/
24 stars 7 forks source link

Package cannot be loaded/attached if offline #92

Closed PeteHaitch closed 1 month ago

PeteHaitch commented 3 months ago

I appreciate depmap is mostly about downloading data from a portal, but shouldn't it be possible to load/attach the package if offline? Here's what happens when I try (by simply disabling wifi on my laptop)

library(depmap)
#> Loading required package: dplyr
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
#> Cannot connect to ExperimentHub server, using 'localHub=TRUE' instead
#> Using 'localHub=TRUE'
#>   If offline, please also see BiocManager vignette section on offline use
#> Error: package or namespace load failed for 'depmap':
#>  .onLoad failed in loadNamespace() for 'depmap', details:
#>   call: FUN(X[[i]], ...)
#>   error: 'crispr_22Q1' not found in ExperimentHub

Created on 2024-03-16 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R Under development (unstable) (2024-01-03 r85769) #> os macOS Ventura 13.6.3 #> system aarch64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz Australia/Melbourne #> date 2024-03-16 #> pandoc 3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> AnnotationDbi 1.65.2 2023-11-03 [1] Bioconductor #> AnnotationHub 3.11.1 2023-12-11 [1] Bioconductor 3.19 (R 4.4.0) #> Biobase 2.63.0 2023-10-24 [1] Bioconductor #> BiocFileCache 2.11.1 2023-10-26 [1] Bioconductor #> BiocGenerics 0.49.1 2023-11-01 [1] Bioconductor #> BiocManager 1.30.22 2023-08-08 [1] CRAN (R 4.4.0) #> BiocVersion 3.19.1 2023-10-26 [1] Bioconductor #> Biostrings 2.71.2 2024-01-28 [1] Bioconductor 3.19 (R 4.4.0) #> bit 4.0.5 2022-11-15 [1] CRAN (R 4.4.0) #> bit64 4.0.5 2020-08-30 [1] CRAN (R 4.4.0) #> bitops 1.0-7 2021-04-24 [1] CRAN (R 4.4.0) #> blob 1.2.4 2023-03-17 [1] CRAN (R 4.4.0) #> cachem 1.0.8 2023-05-01 [1] CRAN (R 4.4.0) #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.4.0) #> crayon 1.5.2 2022-09-29 [1] CRAN (R 4.4.0) #> curl 5.2.0 2023-12-08 [1] CRAN (R 4.4.0) #> DBI 1.2.2 2024-02-16 [1] CRAN (R 4.4.0) #> dbplyr 2.4.0 2023-10-26 [1] CRAN (R 4.4.0) #> digest 0.6.34 2024-01-11 [1] CRAN (R 4.4.0) #> dplyr * 1.1.4 2023-11-17 [1] CRAN (R 4.4.0) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.4.0) #> ExperimentHub 2.11.1 2023-12-11 [1] Bioconductor 3.19 (R 4.4.0) #> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0) #> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.4.0) #> filelock 1.0.3 2023-12-11 [1] CRAN (R 4.4.0) #> fs 1.6.3 2023-07-20 [1] CRAN (R 4.4.0) #> generics 0.1.3 2022-07-05 [1] CRAN (R 4.4.0) #> GenomeInfoDb 1.39.6 2024-02-08 [1] Bioconductor 3.19 (R 4.4.0) #> GenomeInfoDbData 1.2.11 2023-10-30 [1] Bioconductor #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.4.0) #> httr 1.4.7 2023-08-15 [1] CRAN (R 4.4.0) #> httr2 1.0.0 2023-11-14 [1] CRAN (R 4.4.0) #> IRanges 2.37.1 2024-01-19 [1] Bioconductor 3.19 (R 4.4.0) #> KEGGREST 1.43.0 2023-10-24 [1] Bioconductor #> knitr 1.45 2023-10-30 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0) #> memoise 2.0.1 2021-11-26 [1] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0) #> png 0.1-8 2022-11-29 [1] CRAN (R 4.4.0) #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0) #> rappdirs 0.3.3 2021-01-31 [1] CRAN (R 4.4.0) #> RCurl 1.98-1.14 2024-01-09 [1] CRAN (R 4.4.0) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.4.0) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.4.0) #> rmarkdown 2.25 2023-09-18 [1] CRAN (R 4.4.0) #> RSQLite 2.3.5 2024-01-21 [1] CRAN (R 4.4.0) #> rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.4.0) #> S4Vectors 0.41.3 2024-01-01 [1] Bioconductor 3.19 (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0) #> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.4.0) #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0) #> xfun 0.42 2024-02-08 [1] CRAN (R 4.4.0) #> XVector 0.43.1 2024-01-12 [1] Bioconductor 3.19 (R 4.4.0) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.4.0) #> zlibbioc 1.49.0 2023-10-24 [1] Bioconductor #> #> [1] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```
lgatto commented 3 months ago

Thank you for the report.

I don't think this is of depmap specifically, it's a feature of ExperimentHub packages. I tried in another of my ExperimentHub packages, but maybe you have a different experience with other packages, and there's a feature I'm missing.

Anyway, this is from ?ExperimentHub::createHubAccessors:

For developers:

     ‘createHubAccessors(pkgname, titles): ’ This helper is intended to
     be used by ExperimentHub package developers in their .onLoad()
     function in zzz.R. It generates and exports functions by resource
     name which allows the resource to be loaded with resource123() in
     addition to the standard method via the ExperimentHub interface,
     e.g., ehub[["EH123"]]. When 'metadata=TRUE' just the metadata are
     displayed, when 'metadata=FALSE' the full resource is loaded, e.g,
     resource123(metadata=TRUE). See vignette for more information.

Here's the line in depmap.

I suppose that one should check if there's connectivity before calling createHubAccessors(). I'll look into this.

lgatto commented 3 months ago

I have asked about this on bioc-devel.

In the meantime, there's branch issue92, where when loading depmap with a disabled wifi, I get:

> suppressPackageStartupMessages(library(depmap))
Warning message:
Not internet connectivity. Unable to create Hub accessors. 
PeteHaitch commented 3 months ago

Thank you for looking into this, Laurent. I only came across this issue because I happened to be working offline when writing a Bioconductor package review (https://github.com/Bioconductor/Contributions/issues/3066) where we had requested the authors use depmap to retrieve data from data portal rather than their existing ad hoc solution.

lgatto commented 3 months ago

OK, thanks for letting me know. You are right, that it is better to be able to use ExeprimentHub packages when offline.

The author got in touch with me and I implemented the features she needed to make use of depmap.

PeteHaitch commented 3 months ago

That's really helpful of you, thank you!

TrinhNguyenP commented 3 months ago

Hi @PeteHaitch,

The features that @lgatto implemented recently will be added into Deeptarget and I will re-submit.

Thanks,

Trinh