E. Issues & Solutions

Original version: 16 October, 2023

library(AlphaMissenseR)

Updating duckdb to 0.9.1

The R duckdb client version 0.9.1 cannot read databases created with previous versions of the package. The duckdb error message indicates

am_available() Error in h(simpleError(msg, call)) : error in evaluating the argument ‘drv’ in selecting a method for function ‘dbConnect’: rapi_startup: Failed to open database: IO Error: Trying to read a database file with version number 51, but we can only read version 64.

The database file was created with DuckDB version v0.8.0 or v0.8.1.

The storage of DuckDB is not yet stable; newer versions of DuckDB cannot read old database files and vice versa. The storage will be stabilized when version 1.0 releases.

For now, we recommend that you load the database file in a supported version of DuckDB, and use the EXPORT DATABASE command followed by IMPORT DATABASE on the current version of DuckDB.

See the storage page for more information: https://duckdb.org/internals/storage

but in practice the most straight-forward solution is to remove existing AlphaMissenseR data resources and ‘start again’.

The following attempts to identify AlphaMissenseR data resources cached locally

am_rids <-
    bfcinfo() |>
    dplyr::filter(
        grepl("zenodo", rname) |
        startsWith(rname, "AlphaMissense_")
    ) |>
    pull(rid)

After verifying that these resources have not been created outside AlphaMissenseR, remove them.

BiocFileCache::bfcremove(rids = am_rids)

Commands such as am_available() should report no files cached. The command

am_data("gene_hg38")
#> * [03:45:10][info] retrieving file name 'AlphaMissense_gene_hg38.tsv.gz' (247.7 Kb)
#> * [03:45:10][info] data licensed under 'CC-BY-4.0'
#> * [03:45:10][info] downloading or finding local file
#> adding rname 'AlphaMissense_gene_hg38.tsv.gz'
#> * [03:45:11][info] creating database table 'gene_hg38'
#> * [03:45:11][info] disconnecting all registered connections
#> # Source:   table<gene_hg38> [?? x 2]
#> # Database: DuckDB v1.1.3-dev165 [unknown@Linux 6.5.0-1025-azure:R 4.4.2//github/home/.cache/R/BiocFileCache/1d98621cc728_1d98621cc728]
#>    transcript_id      mean_am_pathogenicity
#>    <chr>                              <dbl>
#>  1 ENST00000000233.10                 0.742
#>  2 ENST00000000412.8                  0.378
#>  3 ENST00000001008.6                  0.422
#>  4 ENST00000001146.6                  0.467
#>  5 ENST00000002125.9                  0.351
#>  6 ENST00000002165.11                 0.406
#>  7 ENST00000002501.10                 0.320
#>  8 ENST00000002596.6                  0.471
#>  9 ENST00000002829.8                  0.524
#> 10 ENST00000003084.10                 0.405
#> # ℹ more rows

will re-download the file and insert it into a database that functions with duckdb 0.9.1.

Resource temporarily unavailable

Trying to access a data resource with am_data() may sometimes result in a DuckDB errors about “Resource unavailable”.

> am_data("hg38")

* [10:05:09][warning] error in evaluating the argument 'drv' in selecting a
    method for function 'dbConnect': rapi_startup: Failed to open database:
    IO Error: Could not set lock on file 
    ".../Caches/org.R-project.R/R/BiocFileCache/1ec5157ddaa2_1ec5157ddaa2":
    Resource unavailable

Error in value[[3L]](cond) :
    failed to connect to DuckDB database, see 'Issues & Solutions' vignette

This occures when the database is being used by an independent R process. The solution is to identify the process and disconnect from the database using, e.g., db_disconnect_all().

Finally

Remember to disconnect and shutdown all managed DuckDB connections.

db_disconnect_all()
#> * [03:45:12][info] disconnecting all registered connections

Database connections that are not closed correctly trigger warning messages.

Session information

sessionInfo()
#> R version 4.4.2 (2024-10-31)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.1 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats4    stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#>  [1] ensembldb_2.31.0        AnnotationFilter_1.31.0 GenomicFeatures_1.59.1 
#>  [4] AnnotationDbi_1.69.0    Biobase_2.67.0          GenomicRanges_1.59.1   
#>  [7] GenomeInfoDb_1.43.2     IRanges_2.41.1          S4Vectors_0.45.2       
#> [10] gghalves_0.1.4          ggplot2_3.5.1           ggdist_3.3.2           
#> [13] tidyr_1.3.1             ExperimentHub_2.15.0    AnnotationHub_3.15.0   
#> [16] BiocFileCache_2.15.0    dbplyr_2.5.0            BiocGenerics_0.53.3    
#> [19] generics_0.1.3          AlphaMissenseR_1.3.0    dplyr_1.1.4            
#> [22] rmarkdown_2.29         
#> 
#> loaded via a namespace (and not attached):
#>   [1] DBI_1.2.3                   bitops_1.0-9               
#>   [3] rlang_1.1.4                 magrittr_2.0.3             
#>   [5] matrixStats_1.4.1           compiler_4.4.2             
#>   [7] RSQLite_2.3.8               png_0.1-8                  
#>   [9] vctrs_0.6.5                 ProtGenerics_1.39.0        
#>  [11] pkgconfig_2.0.3             crayon_1.5.3               
#>  [13] fastmap_1.2.0               XVector_0.47.0             
#>  [15] labeling_0.4.3              utf8_1.2.4                 
#>  [17] Rsamtools_2.23.1            promises_1.3.2             
#>  [19] UCSC.utils_1.3.0            purrr_1.0.2                
#>  [21] bit_4.5.0                   xfun_0.49                  
#>  [23] zlibbioc_1.52.0             cachem_1.1.0               
#>  [25] jsonlite_1.8.9              blob_1.2.4                 
#>  [27] later_1.4.1                 DelayedArray_0.33.2        
#>  [29] BiocParallel_1.41.0         parallel_4.4.2             
#>  [31] spdl_0.0.5                  R6_2.5.1                   
#>  [33] bslib_0.8.0                 rtracklayer_1.67.0         
#>  [35] jquerylib_0.1.4             SummarizedExperiment_1.37.0
#>  [37] Rcpp_1.0.13-1               knitr_1.49                 
#>  [39] BiocBaseUtils_1.9.0         Matrix_1.7-1               
#>  [41] httpuv_1.6.15               tidyselect_1.2.1           
#>  [43] abind_1.4-8                 yaml_2.3.10                
#>  [45] codetools_0.2-20            curl_6.0.1                 
#>  [47] rjsoncons_1.3.1             lattice_0.22-6             
#>  [49] tibble_3.2.1                shiny_1.9.1                
#>  [51] bio3d_2.4-5                 withr_3.0.2                
#>  [53] KEGGREST_1.47.0             evaluate_1.0.1             
#>  [55] r3dmol_0.1.2                Biostrings_2.75.1          
#>  [57] pillar_1.9.0                BiocManager_1.30.25        
#>  [59] filelock_1.0.3              MatrixGenerics_1.19.0      
#>  [61] whisker_0.4.1               distributional_0.5.0       
#>  [63] RCurl_1.98-1.16             BiocVersion_3.21.1         
#>  [65] munsell_0.5.1               scales_1.3.0               
#>  [67] xtable_1.8-4                glue_1.8.0                 
#>  [69] lazyeval_0.2.2              maketools_1.3.1            
#>  [71] tools_4.4.2                 BiocIO_1.17.1              
#>  [73] sys_3.4.3                   GenomicAlignments_1.43.0   
#>  [75] buildtools_1.0.0            XML_3.99-0.17              
#>  [77] grid_4.4.2                  colorspace_2.1-1           
#>  [79] GenomeInfoDbData_1.2.13     RcppSpdlog_0.0.19          
#>  [81] duckdb_1.1.3                restfulr_0.0.15            
#>  [83] cli_3.6.3                   rappdirs_0.3.3             
#>  [85] shiny.gosling_1.3.0         fansi_1.0.6                
#>  [87] S4Arrays_1.7.1              viridisLite_0.4.2          
#>  [89] gtable_0.3.6                sass_0.4.9                 
#>  [91] digest_0.6.37               SparseArray_1.7.2          
#>  [93] rjson_0.2.23                htmlwidgets_1.6.4          
#>  [95] farver_2.1.2                memoise_2.0.1              
#>  [97] htmltools_0.5.8.1           lifecycle_1.0.4            
#>  [99] httr_1.4.7                  mime_0.12                  
#> [101] bit64_4.5.2