hcp_list_files: List files from HCP bucket

Description Usage Arguments Value Examples

View source: R/hcp_list_files.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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))
}

muschellij2/neurohcp documentation built on Sept. 18, 2021, 7:19 p.m.