@@ -148,7 +148,6 @@ get_SingleCellExperiment <- function(
148148}
149149
150150# ' Converts a data frame into a single SCE
151- # '
152151# ' @param i Suffix to be added to the column names, to make them unique
153152# ' @param df The data frame to be converted
154153# ' @param dir_prefix The path to the single cell experiment, minus the final segment
@@ -216,7 +215,6 @@ group_to_sce <- function(i, df, dir_prefix, features) {
216215}
217216
218217# ' Synchronises one or more remote assays with a local copy
219- # '
220218# ' @param url A character vector of length one. The base HTTP URL from which to
221219# ' obtain the files.
222220# ' @param cache_dir A character vector of length one. The local filepath to
@@ -226,14 +224,10 @@ group_to_sce <- function(i, df, dir_prefix, features) {
226224# ' @param files A character vector containing one or more file_id_db entries
227225# ' @returns A character vector consisting of file paths to all the newly
228226# ' downloaded files
229- # '
230227# ' @return A character vector of files that have been downloaded
231- # ' @importFrom purrr pmap_chr transpose
232- # ' @importFrom httr modify_url GET write_disk stop_for_status parse_url
233- # ' @importFrom dplyr tibble transmute filter full_join
234- # ' @importFrom glue glue
235- # ' @importFrom assertthat assert_that
236- # ' @importFrom cli cli_alert_success cli_alert_info cli_abort
228+ # ' @importFrom purrr pmap_chr map_chr
229+ # ' @importFrom httr modify_url
230+ # ' @importFrom dplyr transmute filter
237231# ' @noRd
238232# '
239233sync_assay_files <- function (
@@ -244,7 +238,7 @@ sync_assay_files <- function(
244238) {
245239 # Find every combination of file name, sample id, and assay, since each
246240 # will be a separate file we need to download
247- expand.grid(
241+ files = expand.grid(
248242 filename = c(" assays.h5" , " se.rds" ),
249243 sample_id = files ,
250244 subdir = subdirs ,
@@ -261,7 +255,7 @@ sync_assay_files <- function(
261255 .data $ sample_id ,
262256 " /" ,
263257 .data $ filename
264- ) | > map (~ modify_url(url , path = . )),
258+ ) | > map_chr (~ modify_url(url , path = . )),
265259
266260 # Path to save the file on local disk (and its parent directory)
267261 # We use file.path since the file separator will differ on other OSs
@@ -281,14 +275,19 @@ sync_assay_files <- function(
281275 # proceed with the download if it has. However this is low
282276 # importance as the repository is not likely to change often
283277 ! file.exists(.data $ output_file )
284- ) | >
285- pmap_chr(function (full_url , output_dir , output_file ) {
286- sync_remote_file(full_url , output_file )
287- output_file
288- }, .progress = list (name = " Downloading files" ))
278+ )
279+
280+ report_file_sizes(files $ full_url )
281+
282+ pmap_chr(files , function (full_url , output_dir , output_file ) {
283+ sync_remote_file(full_url , output_file )
284+ output_file
285+ }, .progress = list (name = " Downloading files" ))
289286}
290287
291288# ' Synchronises a single remote file with a local path
289+ # ' @importFrom httr write_disk GET stop_for_status
290+ # ' @importFrom cli cli_abort cli_alert_info
292291# ' @noRd
293292sync_remote_file <- function (full_url , output_file , ... ) {
294293 if (! file.exists(output_file )) {
0 commit comments