drs: Access DRS Through terra-notebook-utilities

drs_accessR Documentation

Access DRS Through terra-notebook-utilities

Description

drs_access() acquires a signed URL from a DRS address.

drs_copy() copies DRS URLS to the local file system or google bucket.

drs_head() queries the DRS object for the first few bytes of the object.

drs_info() returns a information about a DRS uri.

Usage

drs_access(
  drs_uri,
  namespace = tnu_workspace_namespace(),
  name = tnu_workspace_name(),
  billing_project = NULL
)

drs_copy(
  drs_uri,
  destination,
  namespace = tnu_workspace_namespace(),
  name = tnu_workspace_name()
)

drs_head(
  drs_uri,
  num_bytes = 1L,
  namespace = tnu_workspace_namespace(),
  name = tnu_workspace_name()
)

drs_info(drs_uri)

Arguments

drs_uri

character(1) DRS URI to be resolved.

namespace

character(1) AnVIL workspace namespace; see ?tnu_workspace for details and default value.

name

character(1) AnVIL workspace name; see ?tnu_workspace for detaials and default value.

billing_project

NULL or character(1) AnVIL billing project.

destination

character(1) directory or google bucket (starting with ⁠gs://⁠) to which the DRS file will be copied.

num_bytes

integer(1) the number of bytes to return from the 'head' of th DRS object.

Value

drs_access() returns a character() vector of signed URLs.

drs_copy() returns the file or bucket path(s) to the copied file(s).

drs_head() returns a list, with one element for each drs_uri, of Python 'memoryview' of the DRS object.

drs_info() returns a list of lists (one element for each drs_uri) with elements

  • name: the name of the DRS file, e.g., "HG00536.final.cram.crai"

  • size: file size in bytes; unfortunately, the size of large files (>3 Gb) is returned as a negative number (integer overflow).

  • updated: date of last DRS resource modification.

  • checksums: a vector of checksums, e.g, md5.

Examples

uri <- c(
    "drs://dg.4503/15fdd543-9875-4edf-8bc2-22985473dab6",
    "drs://dg.4503/3c861ec6-d810-4058-b851-c0b19dd5933e",
    "drs://dg.4503/374a0ad9-b3a2-47f3-8860-5083b302e478"
)
if (tnu_workspace_ok()) {
    print(drs_access(uri))
    print(drs_copy(uri, tempfile())) # local copy
    print(drs_info(uri))
    print(drs_head(uri, 100))        # first 100 bytes of each file
}


vjcitn/BiocTNU documentation built on July 28, 2023, 8:09 p.m.