Bioconductor / AnnotationHub

Client for the Bioconductor AnnotationHub web resource
17 stars 13 forks source link

Select() issue #52

Closed LucasMcNU closed 7 months ago

LucasMcNU commented 7 months ago

Hi there, I thought I had fixed this issue when I updated AnnotationHub and Bioconductor, but it came back. When I try to use Select(), I get the following error:

Error: 'select' is not an exported object from 'namespace:AnnotationHub'

lshep commented 7 months ago

sessionInfo()

LucasMcNU commented 7 months ago

R version 4.3.3 (2024-02-29) Platform: x86_64-apple-darwin20 (64-bit) Running under: macOS Sonoma 14.2.1

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Chicago tzcode source: internal

attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] BiocManager_1.30.22 stringr_1.5.1 forcats_1.0.0 tximport_1.30.0
[5] magrittr_2.0.3 dplyr_1.1.4 ggplot2_3.5.0 DESeq2_1.42.1
[9] SummarizedExperiment_1.32.0 MatrixGenerics_1.14.0 matrixStats_1.3.0 ensembldb_2.26.0
[13] AnnotationFilter_1.26.0 GenomicFeatures_1.54.4 AnnotationDbi_1.64.1 Biobase_2.62.0
[17] GenomicRanges_1.54.1 GenomeInfoDb_1.38.8 IRanges_2.36.0 S4Vectors_0.40.2
[21] AnnotationHub_3.10.1 BiocFileCache_2.10.2 dbplyr_2.5.0 BiocGenerics_0.48.1

loaded via a namespace (and not attached): [1] DBI_1.2.2 bitops_1.0-7 biomaRt_2.58.2 rlang_1.1.3
[5] compiler_4.3.3 RSQLite_2.3.6 png_0.1-8 vctrs_0.6.5
[9] ProtGenerics_1.34.0 pkgconfig_2.0.3 crayon_1.5.2 fastmap_1.1.1
[13] XVector_0.42.0 utf8_1.2.4 Rsamtools_2.18.0 promises_1.3.0
[17] tzdb_0.4.0 pracma_2.4.4 purrr_1.0.2 bit_4.0.5
[21] zlibbioc_1.48.2 cachem_1.0.8 progress_1.2.3 blob_1.2.4
[25] later_1.3.2 DelayedArray_0.28.0 BiocParallel_1.36.0 interactiveDisplayBase_1.40.0 [29] parallel_4.3.3 prettyunits_1.2.0 R6_2.5.1 stringi_1.8.3
[33] rtracklayer_1.62.0 Rcpp_1.0.12 readr_2.1.5 httpuv_1.6.15
[37] Matrix_1.6-5 tidyselect_1.2.1 rstudioapi_0.16.0 abind_1.4-5
[41] yaml_2.3.8 codetools_0.2-20 curl_5.2.1 lattice_0.22-6
[45] tibble_3.2.1 withr_3.0.0 shiny_1.8.1.1 KEGGREST_1.42.0
[49] xml2_1.3.6 Biostrings_2.70.3 pillar_1.9.0 filelock_1.0.3
[53] generics_0.1.3 vroom_1.6.5 RCurl_1.98-1.14 BiocVersion_3.18.1
[57] hms_1.1.3 munsell_0.5.1 scales_1.3.0 xtable_1.8-4
[61] glue_1.7.0 lazyeval_0.2.2 tools_4.3.3 BiocIO_1.12.0
[65] locfit_1.5-9.9 GenomicAlignments_1.38.2 XML_3.99-0.16.1 grid_4.3.3
[69] colorspace_2.1-0 GenomeInfoDbData_1.2.11 restfulr_0.0.15 cli_3.6.2
[73] rappdirs_0.3.3 fansi_1.0.6 S4Arrays_1.2.1 gtable_0.3.4
[77] digest_0.6.35 SparseArray_1.2.4 rjson_0.2.21 memoise_2.0.1
[81] htmltools_0.5.8.1 lifecycle_1.0.4 httr_1.4.7 mime_0.12
[85] bit64_4.0.5

lshep commented 7 months ago

can you should the full code (with any output) you are trying to use that leads up to the ERROR as well?

LucasMcNU commented 7 months ago

Here you are! Error starts when using Select() near the bottom.

`library("AnnotationHub") ah <- AnnotationHub() ## Connect to Annotation Hub

db <- query(ah, c("EnsDb","Homo sapiens","111"))[[1]] ## Make a query to your organism/database results <- data.frame(res.pol1)

keys <- keys(db, c("TXID","GENEID", "TXNAME"))

annotations <- select(db, keys, c("GENEID", "TXNAME", "SYMBOL", "GENENAME","GENEBIOTYPE","TXBIOTYPE", "SEQNAME", "TXSEQSTART","TXSEQEND","EXONID","EXONSEQSTART", "EXONSEQEND"), "TXID") `

lshep commented 7 months ago

I can't reproduce this. But a guess, do you have the package ensembldb installed? It is a required package for this resources, so do you have that installed/loaded?

LucasMcNU commented 7 months ago

I loaded EnsemblDB and it made no difference in the problem. Looking at this older issue from Bioconductor, it looks like this has been a problem before?

lshep commented 7 months ago

So it looks like the solution was posted https://support.bioconductor.org/p/p132709/#p134760 likely you have both dplyr and AnnotationDbi and need to specify which one to use

LucasMcNU commented 7 months ago

No, that doesn't solve the issue. There seems to be something else wrong with AnnotationHub, as calling the function specifically using AnnotationHub::Select() produces the same error.

lshep commented 7 months ago

There is no annotationhub::select function

mtmorgan commented 7 months ago

try, in your original incantation, calling traceback() after the error occurs.

annotations <- select(db, keys, c("GENEID", "TXNAME", "SYMBOL", "GENENAME","GENEBIOTYPE","TXBIOTYPE", "SEQNAME", "TXSEQSTART","TXSEQEND","EXONID","EXONSEQSTART", "EXONSEQEND"), "TXID")

## error, so try...
traceback()
LucasMcNU commented 7 months ago

How would you specify that you're using select() from annotation hub then? is this actually select() from dplyr?

To be clear, these lines of code worked fine until today.

lshep commented 7 months ago

there is no such function. there is not a select method defined in annotationhub. it is select like from annotationDbi or dplyr as the link above indicates

LucasMcNU commented 7 months ago

well, that was my problem - Thank you! And sorry for wasting your time

lshep commented 7 months ago

No worries. Glad we could figure it out.
Is this in a vignette or documentation somewhere that you found? if so we can update it to try to be more explicit about where select comes from

LucasMcNU commented 7 months ago

It's in the main vignette here with no explicit reference to AnnotationDbi and no loading of AnnotationDBI, although it is in the session info at the bottom. I just assumed they were one and the same.

lshep commented 7 months ago

Thanks! I'll look at adding a line to the vignette to show the appropriate AnnotationDbi call. Sorry for the confusion.

lshep commented 7 months ago

Reopening to remind to add AnnotationDbi library call and :: to vignette for more explicit calls to avoid confusion with conflicting dplyr select method that can occur.

LiNk-NY commented 7 months ago

FWIW @LucasMcNU You can use the conflicted package to resolve these issues:

library(conflicted)
## [... code above]
annotations <- select(db, keys, c("GENEID", "TXNAME", "SYMBOL", "GENENAME","GENEBIOTYPE","TXBIOTYPE", "SEQNAME", "TXSEQSTART","TXSEQEND","EXONID","EXONSEQSTART", "EXONSEQEND"), "TXID")
Error:
! [conflicted] select found in 2 packages.
Either pick the one you want with `::`:
• dplyr::select
• ensembldb::select
Or declare a preference with `conflicts_prefer()`:
• `conflicts_prefer(dplyr::select)`
• `conflicts_prefer(ensembldb::select)`
Run `rlang::last_trace()` to see where the error occurred.

The generic lives in AnnotationDbi but the specific method is coming from ensembldb.