# 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")
    #> # Source:   table<gene_hg38> [?? x 2]
    #> # Database: DuckDB 1.5.2 [biocbuild@Darwin 25.3.0:R 4.6.0//Users/biocbuild/Library/Caches/org.R-project.R/R/BiocFileCache/3859375c70b9_3859375c70b9]
    #>    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()
    #> * [17:22:42][info] disconnecting all registered connections

Database connections that are not closed correctly trigger warning messages.

# Session information

    sessionInfo()
    #> R version 4.6.0 Patched (2026-04-24 r89963)
    #> Platform: aarch64-apple-darwin23
    #> Running under: macOS Tahoe 26.3.1
    #>
    #> Matrix products: default
    #> BLAS:   /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRblas.0.dylib
    #> LAPACK: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1
    #>
    #> locale:
    #> [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    #>
    #> time zone: America/New_York
    #> tzcode source: internal
    #>
    #> attached base packages:
    #> [1] stats4    stats     graphics  grDevices utils     datasets  methods
    #> [8] base
    #>
    #> other attached packages:
    #>  [1] ensembldb_2.36.0        AnnotationFilter_1.36.0 GenomicFeatures_1.64.0
    #>  [4] AnnotationDbi_1.74.0    Biobase_2.72.0          GenomicRanges_1.64.0
    #>  [7] Seqinfo_1.2.0           IRanges_2.46.0          S4Vectors_0.50.0
    #> [10] ggplot2_4.0.3           ggdist_3.3.3            tidyr_1.3.2
    #> [13] ExperimentHub_3.2.0     AnnotationHub_4.2.0     BiocFileCache_3.2.0
    #> [16] dbplyr_2.5.2            BiocGenerics_0.58.0     generics_0.1.4
    #> [19] AlphaMissenseR_1.8.0    dplyr_1.2.1
    #>
    #> loaded via a namespace (and not attached):
    #>   [1] DBI_1.3.0                   bitops_1.0-9
    #>   [3] httr2_1.2.2                 rlang_1.2.0
    #>   [5] magrittr_2.0.5              otel_0.2.0
    #>   [7] matrixStats_1.5.0           compiler_4.6.0
    #>   [9] RSQLite_2.4.6               png_0.1-9
    #>  [11] vctrs_0.7.3                 ProtGenerics_1.44.0
    #>  [13] pkgconfig_2.0.3             crayon_1.5.3
    #>  [15] fastmap_1.2.0               XVector_0.52.0
    #>  [17] labeling_0.4.3              utf8_1.2.6
    #>  [19] Rsamtools_2.28.0            promises_1.5.0
    #>  [21] rmarkdown_2.31              UCSC.utils_1.8.0
    #>  [23] purrr_1.2.2                 bit_4.6.0
    #>  [25] xfun_0.57                   cachem_1.1.0
    #>  [27] cigarillo_1.2.0             GenomeInfoDb_1.48.0
    #>  [29] jsonlite_2.0.0              blob_1.3.0
    #>  [31] later_1.4.8                 DelayedArray_0.38.0
    #>  [33] BiocParallel_1.46.0         parallel_4.6.0
    #>  [35] spdl_0.0.5                  R6_2.6.1
    #>  [37] bslib_0.10.0                RColorBrewer_1.1-3
    #>  [39] rtracklayer_1.72.0          jquerylib_0.1.4
    #>  [41] SummarizedExperiment_1.42.0 Rcpp_1.1.1-1.1
    #>  [43] knitr_1.51                  BiocBaseUtils_1.14.0
    #>  [45] Matrix_1.7-5                httpuv_1.6.17
    #>  [47] tidyselect_1.2.1            abind_1.4-8
    #>  [49] dichromat_2.0-0.1           yaml_2.3.12
    #>  [51] codetools_0.2-20            curl_7.1.0
    #>  [53] rjsoncons_1.3.2             lattice_0.22-9
    #>  [55] tibble_3.3.1                shiny_1.13.0
    #>  [57] bio3d_2.4-5                 withr_3.0.2
    #>  [59] KEGGREST_1.52.0             S7_0.2.2
    #>  [61] evaluate_1.0.5              r3dmol_0.1.2
    #>  [63] Biostrings_2.80.0           pillar_1.11.1
    #>  [65] BiocManager_1.30.27         filelock_1.0.3
    #>  [67] MatrixGenerics_1.24.0       whisker_0.4.1
    #>  [69] distributional_0.7.0        RCurl_1.98-1.18
    #>  [71] BiocVersion_3.23.1          scales_1.4.0
    #>  [73] xtable_1.8-8                glue_1.8.1
    #>  [75] lazyeval_0.2.3              tools_4.6.0
    #>  [77] BiocIO_1.22.0               GenomicAlignments_1.48.0
    #>  [79] XML_3.99-0.23               grid_4.6.0
    #>  [81] colorspace_2.1-2            RcppSpdlog_0.0.28
    #>  [83] duckdb_1.5.2                restfulr_0.0.16
    #>  [85] cli_3.6.6                   rappdirs_0.3.4
    #>  [87] shiny.gosling_1.8.0         S4Arrays_1.12.0
    #>  [89] viridisLite_0.4.3           gtable_0.3.6
    #>  [91] sass_0.4.10                 digest_0.6.39
    #>  [93] SparseArray_1.12.0          rjson_0.2.23
    #>  [95] htmlwidgets_1.6.4           farver_2.1.2
    #>  [97] memoise_2.0.1               htmltools_0.5.9
    #>  [99] lifecycle_1.0.5             httr_1.4.8
    #> [101] mime_0.13                   bit64_4.8.0