@@ -11,6 +11,7 @@ assay_map <- c(
1111)
1212
1313REMOTE_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
366368get_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 ,
0 commit comments