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

Commit 7fde5a6

Browse files
committed
Use a versioned counts directory
1 parent 3a99078 commit 7fde5a6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

R/query.R

Lines changed: 5 additions & 3 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
@@ -81,7 +82,8 @@ get_SingleCellExperiment <- function(
8182
inherits(raw_data, "tbl") |> assert_that()
8283
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

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

0 commit comments

Comments
 (0)