hcp_list_files: List files from HCP bucket

View source: R/hcp_list_files.R

hcp_list_filesR Documentation

List files from HCP bucket

Description

Lists a set of files from an HCP bucket for a specific sub-folder

Usage

hcp_list_files(prefix = "", delimiter = NULL, query = NULL, marker = NULL, ...)

fcp_list_files(prefix = "", delimiter = NULL, query = NULL, marker = NULL, ...)

openneuro_list_files(
  prefix = "",
  delimiter = NULL,
  query = NULL,
  marker = NULL,
  ...
)

hcp_list_dirs(prefix = "HCP/", ...)

fcp_list_dirs(prefix = "data/Projects/", ...)

openneuro_list_dirs(prefix = NULL, ...)

Arguments

prefix

directory folder to list files. If "", then it will be the root path

delimiter

Delimiter to list files. For example ".mat", for ".mat"

query

Additional query arguments

marker

the marker to start the listing, needed for pagination of results

...

additional arguments passed to get_hcp_file

Value

List with the result of the GET command, the parsed result, and the content from the result.

Examples

if (have_aws_key()){
x = hcp_list_files(prefix = "HCP/100307/unprocessed/3T/Diffusion",
   delimiter="bval")
stopifnot(x$parsed_result$ListBucketResult$Name[[1]] == "hcp-openaccess")
t1_niis = hcp_list_files(prefix ="HCP/100307/T1w",
delimiter = ".nii.gz")
all_dirs = hcp_list_dirs("HCP/")
}

if (have_aws_key()){
  res = hcp_list_dirs("HCP/")
  projects = unlist(parse_list_files(res)$prefixes)
  projects = unname(projects)
  projects = unname(projects)
  head(projects)
  head(basename(projects))
  stopifnot("100307" %in% basename(projects))
}
if (have_aws_key()){
res = fcp_list_dirs()
projects = unlist(parse_list_files(res)$prefixes)
projects = unname(projects)
head(projects)
head(basename(projects))
stopifnot("ABIDE" %in% basename(projects))
}
res = openneuro_list_dirs()
projects = unlist(parse_list_files(res)$prefixes)
projects = unname(projects)
head(projects)
if (length(projects) > 0) {
head(basename(projects))
stopifnot("ds000002" %in% basename(projects))
}

neuroconductor/neurohcp documentation built on Feb. 5, 2023, 6:19 a.m.