Download files from an ENCODE file table, selected-file object, file search,
or file accession. Planned sizes are checked before transfer, existing files
are not overwritten by default, files are written through a unique temporary
.part path, and size/MD5 checks are used when ENCODE provides the metadata.
Usage
encode_download(
x,
file_accession = NULL,
file_format = NULL,
output_type = NULL,
assembly = NULL,
status = "released",
limit = NULL,
directory = NULL,
max_file_size = "250MB",
max_total_size = "500MB",
allow_unknown_size = FALSE,
overwrite = FALSE,
dry_run = FALSE,
prefer_cloud = FALSE,
verify = c("md5", "size"),
quiet = FALSE
)Arguments
- x
ENCFF accession(s), file metadata table, file search result, selected-file object, or ENCSR experiment accession(s). ENCSR input is first passed to
encode_list_files().- file_accession
Optional ENCODE file accession(s), such as
"ENCFF260OJQ", to download fromx. Use this when you want specific files rather than the firstlimitrows.- file_format
Optional file-format filter used when
xis an ENCSR experiment accession.- output_type
Optional output-type filter used when
xis an ENCSR experiment accession.- assembly
Optional genome-assembly filter used when
xis an ENCSR experiment accession.- status
Optional file-status filter used when
xis an ENCSR experiment accession.- limit
Optional number of files to use from the top of
x.- directory
Destination directory. If
NULL, a package cache directory fromtools::R_user_dir("encodeUtils", "cache")is used. Supply an explicit project directory for reusable data.- max_file_size
Maximum ENCODE-reported size accepted per file during planning, as bytes or a string like
"500MB". The observed size is checked after transfer when size verification is enabled.- max_total_size
Maximum total ENCODE-reported size accepted during planning, as bytes or a string.
- allow_unknown_size
Whether to allow real downloads for files whose ENCODE metadata do not include
file_size. Dry-runs are always allowed and report the unknown-size count.- overwrite
Whether existing destination files may be replaced.
- dry_run
If
TRUE, return the planned download table without downloading.- prefer_cloud
Whether to prefer ENCODE cloud URLs when available.
- verify
Verification checks to perform. Supported values are
"md5"and"size". UseNULLto record downloads without size or MD5 verification.- quiet
If
FALSE, print concise progress messages.
Value
An encode_download_result data frame. Dry runs return planned rows
with destination local_path, known-size totals, unknown-size counts, and
download_status = "planned". Transfers return one row per file with
download_status, downloaded_at, downloaded_size, the expected
md5sum, observed_md5, verification flags, and failure_reason.
Printing the result shows the transfer status and local destination; use
encode_results() for the complete table.
Examples
plan <- encode_download(
"ENCFF859GWB",
directory = tempdir(),
dry_run = TRUE,
quiet = TRUE
)
encode_results(plan)
#> ENCODE download
#> - files: 1
#> - experiments: 1
#> - known total size: 59.54 KB
#> Download records:
#> file format output file_size download
#> ENCFF859GWB tsv microRNA quantifications 59.54 KB planned
#> path
#> /tmp/Rtmpi8WRPd/ENCFF859GWB.tsv