Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit dffa328

Browse files
authored
Merge pull request #75 from stemangiola/update-db-0.2
Update db to 0.2
2 parents 0238471 + 7fde5a6 commit dffa328

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

R/query.R

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ assay_map <- c(
1111
)
1212

1313
REMOTE_URL <- "https://swift.rc.nectar.org.au/v1/AUTH_06d6e008e3e642da99d806ba3ea629c5/harmonised-human-atlas"
14+
COUNTS_VERSION <- "0.2"
1415

1516
#' Given a data frame of HCA metadata, returns a SingleCellExperiment object
1617
#' corresponding to the samples in that data frame
@@ -79,9 +80,10 @@ get_SingleCellExperiment <- function(
7980
cli_alert_info("Realising metadata.")
8081
raw_data <- collect(data)
8182
inherits(raw_data, "tbl") |> assert_that()
82-
has_name(raw_data, c(".cell", "file_id_db")) |> assert_that()
83+
has_name(raw_data, c("_cell", "file_id_db")) |> assert_that()
8384

84-
cache_directory |> dir.create(showWarnings = FALSE)
85+
versioned_cache_directory = file.path(cache_directory, COUNTS_VERSION)
86+
versioned_cache_directory |> dir.create(showWarnings = FALSE, recursive = TRUE)
8587

8688
subdirs <- assay_map[assays]
8789

@@ -100,7 +102,7 @@ get_SingleCellExperiment <- function(
100102
as.character() |>
101103
sync_assay_files(
102104
url = parsed_repo,
103-
cache_dir = cache_directory,
105+
cache_dir = versioned_cache_directory,
104106
files = _,
105107
subdirs = subdirs
106108
)
@@ -111,7 +113,7 @@ get_SingleCellExperiment <- function(
111113
imap(function(current_subdir, current_assay) {
112114
# Build up an SCE for each assay
113115
dir_prefix <- file.path(
114-
cache_directory,
116+
versioned_cache_directory,
115117
current_subdir
116118
)
117119

@@ -172,14 +174,14 @@ group_to_sce <- function(i, df, dir_prefix, features) {
172174
sce <- loadHDF5SummarizedExperiment(sce_path)
173175
# The cells we select here are those that are both available in the SCE
174176
# object, and requested for this particular file
175-
cells <- colnames(sce) |> intersect(df$.cell)
177+
cells <- colnames(sce) |> intersect(df$`_cell`)
176178
# We need to make the cell names globally unique, which we can guarantee
177179
# by adding a suffix that is derived from file_id_db, which is the grouping
178180
# variable
179181
new_cellnames <- paste0(cells, "_", i)
180182
new_coldata <- df |>
181-
mutate(original_cell_id = .data$.cell, .cell = new_cellnames) |>
182-
column_to_rownames(".cell") |>
183+
mutate(original_cell_id = .data$`_cell`, `_cell` = new_cellnames) |>
184+
column_to_rownames("_cell") |>
183185
as("DataFrame")
184186

185187
features |>
@@ -364,10 +366,10 @@ get_seurat <- function(...) {
364366
#' @importFrom httr progress
365367
#' @importFrom cli cli_alert_info
366368
get_metadata <- function(
367-
remote_url = "https://object-store.rc.nectar.org.au/v1/AUTH_06d6e008e3e642da99d806ba3ea629c5/metadata-sqlite/metadata.parquet",
369+
remote_url = "https://object-store.rc.nectar.org.au/v1/AUTH_06d6e008e3e642da99d806ba3ea629c5/metadata/metadata.0.2.2.parquet",
368370
cache_directory = get_default_cache_dir()
369371
) {
370-
db_path <- file.path(cache_directory, "metadata.parquet")
372+
db_path <- file.path(cache_directory, "metadata.0.2.2.parquet")
371373
sync_remote_file(
372374
remote_url,
373375
db_path,

tests/testthat/test-query.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ library(CuratedAtlasQueryR)
22

33
test_that("get_SingleCellExperiment() correctly handles duplicate cell IDs", {
44
meta <- get_metadata() |>
5-
dplyr::filter(.cell == "868417_1") |>
5+
dplyr::filter(`_cell` == "868417_1") |>
66
dplyr::collect()
77
sce <- get_SingleCellExperiment(meta)
88
# This query should return multiple cells, despite querying only 1 cell ID

vignettes/Introduction.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ knitr::include_graphics(c(
3131
"../man/figures/svcf_logo.jpeg",
3232
"../man/figures/czi_logo.png",
3333
"../man/figures/bioconductor_logo.jpg",
34-
"../man/figures/vca_logo.png"
34+
"../man/figures/vca_logo.png"
3535
))
3636
```
3737

0 commit comments

Comments
 (0)