@@ -342,16 +342,16 @@ get_seurat <- function(...) {
342342 get_SingleCellExperiment(... ) | > as.Seurat(data = NULL )
343343}
344344
345- # ' Downloads an SQLite database of the Human Cell Atlas metadata to a local
345+ # ' Downloads a parquet database of the Human Cell Atlas metadata to a local
346346# ' cache, and then opens it as a data frame. It can then be filtered and
347347# ' passed into [get_SingleCellExperiment()]
348348# ' to obtain a [`SingleCellExperiment`](SingleCellExperiment::SingleCellExperiment-class)
349349# '
350350# ' @param remote_url Optional character vector of length 1. An HTTP URL pointing
351- # ' to the location of the sqlite database.
351+ # ' to the location of the parquet database.
352352# ' @param cache_directory Optional character vector of length 1. A file path on
353353# ' your local system to a directory (not a file) that will be used to store
354- # ' metadata.sqlite
354+ # ' metadata.parquet
355355# ' @return A lazy data.frame subclass containing the metadata. You can interact
356356# ' with this object using most standard dplyr functions. For string matching,
357357# ' it is recommended that you use `stringr::str_like` to filter character
@@ -368,30 +368,22 @@ get_seurat <- function(...) {
368368# ' )
369369# '
370370# ' @importFrom DBI dbConnect
371- # ' @importFrom RSQLite SQLite SQLITE_RO
371+ # ' @importFrom duckdb duckdb
372372# ' @importFrom dplyr tbl
373373# ' @importFrom httr progress
374374# ' @importFrom cli cli_alert_info
375375# ' @importFrom utils untar
376376get_metadata <- function (
377- remote_url = " https://object-store.rc.nectar.org.au/v1/AUTH_06d6e008e3e642da99d806ba3ea629c5/metadata-sqlite/metadata.tar.xz " ,
377+ remote_url = " https://object-store.rc.nectar.org.au/v1/AUTH_06d6e008e3e642da99d806ba3ea629c5/metadata-sqlite/metadata.parquet " ,
378378 cache_directory = get_default_cache_dir()
379379) {
380- tar_path <- file.path(cache_directory , " metadata.tar.xz" )
381- sqlite_path <- file.path(cache_directory , " metadata.sqlite" )
382- if (! file.exists(sqlite_path )){
383- tar_dir <- tempdir()
384- tar_file <- file.path(tar_dir , " metadata.tar.xz" )
385- cli_alert_info(" Downloading tar archive. The following procedure is performed once and will take approximately 3 minutes." )
386- sync_remote_file(
387- remote_url ,
388- tar_file ,
389- progress(type = " down" , con = stderr())
390- )
391- cli_alert_info(" Decompressing tar archive" )
392- untar(tar_file , exdir = cache_directory )
393- }
394- SQLite() | >
395- dbConnect(drv = _, dbname = sqlite_path , flags = SQLITE_RO ) | >
396- tbl(" metadata" )
380+ db_path <- file.path(cache_directory , " metadata.parquet" )
381+ sync_remote_file(
382+ remote_url ,
383+ db_path ,
384+ progress(type = " down" , con = stderr())
385+ )
386+ table <- duckdb() | >
387+ dbConnect(drv = _, read_only = TRUE ) | >
388+ tbl(db_path )
397389}
0 commit comments