Title: | R / Bioconductor Support for the AnVIL Azure Platform |
---|---|
Description: | The AnVIL is a cloud computing resource developed in part by the National Human Genome Research Institute. The AnVILAz package supports end-users and developers using the AnVIL platform in the Azure cloud. The package provides a programmatic interface to AnVIL resources, including workspaces, notebooks, tables, and workflows. The package also provides utilities for managing resources, including copying files to and from Azure Blob Storage, and creating shared access signatures (SAS) for secure access to Azure resources. |
Authors: | Martin Morgan [aut, ctb] , Marcel Ramos [aut, cre] |
Maintainer: | Marcel Ramos <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.1.0 |
Built: | 2024-10-29 23:14:45 UTC |
Source: | https://github.com/Bioconductor/AnVILAz |
avnotebooks()
lists the notebooks in the current workspace.
## S4 method for signature 'azure' avnotebooks(local = FALSE, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avnotebooks_localize( destination = "./analyses", dry = TRUE, ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avnotebooks_delocalize( source = "./", dry = TRUE, ..., platform = cloud_platform() )
## S4 method for signature 'azure' avnotebooks(local = FALSE, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avnotebooks_localize( destination = "./analyses", dry = TRUE, ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avnotebooks_delocalize( source = "./", dry = TRUE, ..., platform = cloud_platform() )
local |
|
... |
Additional arguments passed to lower level functions (not used) |
platform |
|
destination |
|
dry |
|
source |
|
avnotebooks()
returns a character vector of files located
in the workspace 'analyses/' folder path, or on the local file
system.
avnotebooks(azure)
: List the notebooks in the current workspace
avnotebooks_localize(azure)
: Sync notebooks between the Azure Blob Storage
Container and the local runtime
avnotebooks_delocalize(azure)
: Sync notebooks between the local runtime and
the Azure Blob Storage Container
if (has_avworkspace(strict = TRUE, platform = azure())) avnotebooks()
if (has_avworkspace(strict = TRUE, platform = azure())) avnotebooks()
Methods for working with AnVIL Azure tables. These are referred to as "types" in the AnVIL Workspace Data Service (WDS) API.
## S4 method for signature 'azure' avtable(table, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avtables(..., platform = cloud_platform()) ## S4 method for signature 'azure' avtable_import( .data, table, entity = names(.data)[[1L]], ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avtable_import_set( .data, origin, set = names(.data)[[1]], member = names(.data)[[2]], ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avtable_delete(table, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avtable_delete_values(table, values, ..., platform = cloud_platform())
## S4 method for signature 'azure' avtable(table, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avtables(..., platform = cloud_platform()) ## S4 method for signature 'azure' avtable_import( .data, table, entity = names(.data)[[1L]], ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avtable_import_set( .data, origin, set = names(.data)[[1]], member = names(.data)[[2]], ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avtable_delete(table, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avtable_delete_values(table, values, ..., platform = cloud_platform())
table |
|
... |
Additional arguments passed to lower level functions (not used) |
platform |
|
.data |
|
entity |
The entity name, i.e., the name of the column in the table that
provides the keys for the data (a.k.a. |
origin |
|
set |
|
member |
|
values |
|
avtable_import_set()
creates new rows in a table <origin>_set
.
One row will be created for each distinct value in the column identified by
set
. Each row entry has a corresponding column <origin>
linking to one
or more rows in the <origin>
table, as given in the member
column. The
operation is somewhat like split(member, set)
.
avtable
: a tibble()
corresponding to the data with the name as
given by table
avtables
: a tibble()
with columns table
, count
, and
colnames
corresponding to the tables / types available in the current
workspace
avtable_import()
: called for the side effect of uploading the data
to the DATA tab
avtable_import_set()
: a character(1)
name of the imported
tibble.
avtable_delete
: a logical(1)
indicating success or failure
avtable_delete_values()
: a logical(1)
vector indicating success
or failure for each value in values
avtable(azure)
: List the contents of a particular table / type
avtables(azure)
: List the available tables / types
avtable_import(azure)
: Upload a dataset to the DATA tab
avtable_import_set(azure)
: Create a grouping table from an origin dataset
avtable_delete(azure)
: Delete a table / type
avtable_delete_values(azure)
: Delete rows from a table / type
if (interactive()) { library(dplyr) mtcars_tbl <- mtcars |> as_tibble(rownames = "model_id") |> mutate(model_id = gsub(" ", "-", model_id)) avtable_import( mtcars_tbl, table = "testData", entity = "model_id" ) avtable("testData") avtable("testData") |> # new 'testData_set' table avtable_import_set("testData", "cyl", "model_id") avtable_delete("testData_set") avtable_delete_values("testData", "Mazda-RX4") }
if (interactive()) { library(dplyr) mtcars_tbl <- mtcars |> as_tibble(rownames = "model_id") |> mutate(model_id = gsub(" ", "-", model_id)) avtable_import( mtcars_tbl, table = "testData", entity = "model_id" ) avtable("testData") avtable("testData") |> # new 'testData_set' table avtable_import_set("testData", "cyl", "model_id") avtable_delete("testData_set") avtable_delete_values("testData", "Mazda-RX4") }
avworkflow_jobs()
reports the status of workflow executions
in the current workspace.
## S4 method for signature 'azure' avworkflow_jobs(..., platform = cloud_platform()) avworkflow_jobs_inputs()
## S4 method for signature 'azure' avworkflow_jobs(..., platform = cloud_platform()) avworkflow_jobs_inputs()
... |
Additional arguments passed to lower level functions (not used) |
platform |
|
The avworkflow_jobs_inputs()
function returns the input parameters
for the workflow jobs as a tibble
.
avworkflow_jobs()
returns a tibble with the status of the
jobs in the current workspace.
avworkflow_jobs(azure)
: List the status of workflow jobs
if (has_avworkspace(strict = TRUE, platform = azure())) ## from within AnVIL avworkflow_jobs()
if (has_avworkspace(strict = TRUE, platform = azure())) ## from within AnVIL avworkflow_jobs()
AnVIL Azure Workspace methods
## S4 method for signature 'azure' avworkspaces(..., platform = cloud_platform()) ## S4 method for signature 'azure' avworkspace_namespace(..., platform = cloud_platform()) ## S4 method for signature 'azure' avworkspace_name(..., platform = cloud_platform()) ## S4 method for signature 'azure' avworkspace(..., platform = cloud_platform()) ## S4 method for signature 'azure' avworkspace_clone( namespace = avworkspace_namespace(), name = avworkspace_name(), to_namespace = namespace, to_name, bucket_location = "US", ..., platform = cloud_platform() )
## S4 method for signature 'azure' avworkspaces(..., platform = cloud_platform()) ## S4 method for signature 'azure' avworkspace_namespace(..., platform = cloud_platform()) ## S4 method for signature 'azure' avworkspace_name(..., platform = cloud_platform()) ## S4 method for signature 'azure' avworkspace(..., platform = cloud_platform()) ## S4 method for signature 'azure' avworkspace_clone( namespace = avworkspace_namespace(), name = avworkspace_name(), to_namespace = namespace, to_name, bucket_location = "US", ..., platform = cloud_platform() )
... |
Additional arguments passed to lower level functions (not used) |
platform |
|
namespace |
|
name |
|
to_namespace |
|
to_name |
|
bucket_location |
|
avworkspaces()
: a tibble
table of available workspaces
avworkspace_namespace()
: a character string of the workspace
namespace
avworkspace_name()
: a character string of the workspace name
avworkspace()
: a character string of the workspace namespace and
name combination
avworkspace_clone()
: called for the side-effect of cloning a
workspace to a new namespace and name.
avworkspaces(azure)
: List workspaces
avworkspace_namespace(azure)
: List the workspace namespace
avworkspace_name(azure)
: Obtain the workspace name
avworkspace(azure)
: Obtain the current workspace namespace and
name combination
avworkspace_clone(azure)
: Clone a workspace
The function provides a user delegation SAS token for management of resources. Mainly used in other functions to move files to and from the Azure Storage Container
az_sas_token(sasExpirationDuration = 28800)
az_sas_token(sasExpirationDuration = 28800)
sasExpirationDuration |
|
A list of two elements named token
and url
if (interactive()) { sas <- az_sas_token() sas[["token"]] sas[["url"]] }
if (interactive()) { sas <- az_sas_token() sas[["token"]] sas[["url"]] }
These functions provide checks for essential workspace tools and
variables. az_exists
checks for the presence of the az
command line
utility. az_healthcheck
checks for the presence of the az
command line
as well as the essential environment variables.
az_exists() az_health_check()
az_exists() az_health_check()
az_exists returns a logical value indicating the presence of the az
command line utility. az_healthcheck
returns a logical value indicating
the presence of the az
command line utility and the essential environment
variables.
if (interactive()) { az_exists() az_healthcheck() }
if (interactive()) { az_exists() az_healthcheck() }
This class represents the Azure platform.
azure()
azure()
az <- azure() az showClass(class(az))
az <- azure() az showClass(class(az))
A number of methods compatible with the Azure platform class.
## S4 method for signature 'azure' avcopy(source, destination, dry = TRUE, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avlist(..., platform = cloud_platform()) ## S4 method for signature 'azure' avremove(source, recursive = FALSE, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avbackup( source, destination, recursive = TRUE, ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avrestore( source, destination, recursive = TRUE, ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avstorage(..., platform = cloud_platform())
## S4 method for signature 'azure' avcopy(source, destination, dry = TRUE, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avlist(..., platform = cloud_platform()) ## S4 method for signature 'azure' avremove(source, recursive = FALSE, ..., platform = cloud_platform()) ## S4 method for signature 'azure' avbackup( source, destination, recursive = TRUE, ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avrestore( source, destination, recursive = TRUE, ..., platform = cloud_platform() ) ## S4 method for signature 'azure' avstorage(..., platform = cloud_platform())
source |
|
destination |
|
dry |
|
... |
Additional arguments passed to lower level functions (not used) |
platform |
|
recursive |
|
The recursive
argument for avbackup
and avrestore
is set to
TRUE
by default and FALSE
for avremove
. Note that wildcards are not
supported for local or remote paths.
avlist
- a tibble
of files and metadata
avcopy
- called for the side effect of copying a file to or from
the Azure Storage Container depending on the source
and destination
inputs
avremove
- called for the side effect of removing a file or folder
avbackup
- called for the side effect of copying a directory to
the Azure Storage Container
avrestore
- called for the side effect of copying a directory
from the Azure Storage Container
avstorage
- a URL string of the Azure Storage Container location
avworkspaces
- a tibble of workspaces on AnVIL
avtable_import
- a response list indicating successful upload
avtable_delete_values
- when successful, a NULL
value
avcopy(azure)
: a generalized interface for either
az_copy_from_storage
or az_copy_to_storage
; deduced from the source
and destination
inputs
avlist(azure)
: list all the files in the Azure Storage Container
avremove(azure)
: remove a file or directory from the Azure Storage
avbackup(azure)
: copy a directory from the workspace environment to
the Azure Storage Container
avrestore(azure)
: copy a file or directory from the Azure Storage
Container to the workspace environment
avstorage(azure)
: The base URI string used to move data to and from
the Azure Storage Container
if (interactive()) { avlist() ## local -> remote ## using general interface avcopy avcopy("jupyter.log", "analyses/jupyter.log") ## upload a directory avbackup("./test/", "analyses/test/") ## using general interface az_copy avcopy("analyses/jupyter.log", "./jupyter.log") ## download a directory avrestore("analyses/test/", "./test/") avremove("analyses/jupyter.log") }
if (interactive()) { avlist() ## local -> remote ## using general interface avcopy avcopy("jupyter.log", "analyses/jupyter.log") ## upload a directory avbackup("./test/", "analyses/test/") ## using general interface az_copy avcopy("analyses/jupyter.log", "./jupyter.log") ## download a directory avrestore("analyses/test/", "./test/") avremove("analyses/jupyter.log") }
has_avworkspace()
checks that the AnVIL environment is set up
to work with Azure. If strict = TRUE
, it also checks that the workspace
name is set.
## S4 method for signature 'azure' has_avworkspace(strict = FALSE, ..., platform = cloud_platform())
## S4 method for signature 'azure' has_avworkspace(strict = FALSE, ..., platform = cloud_platform())
strict |
|
... |
Arguments passed to the methods. |
platform |
A Platform derived class indicating the AnVIL environment,
currently, |
logical(1)
TRUE
if the AnVIL environment is set up properly to
interact with Azure, otherwise FALSE
.
has_avworkspace(azure)
: Check if the AnVIL environment is set up
has_avworkspace(platform = azure())
has_avworkspace(platform = azure())
A group of functions that return environment variables in the
Terra Azure workspace. The Workspace Data Service URL sends out an API
GET
request to obtain the data services URL for uploading data to the
workspace "DATA" tab.
workspace_id() workspace_storage_cont_id() workspace_storage_cont_url() wds_api_version() workspace_data_service_url() cbas_url()
workspace_id() workspace_storage_cont_id() workspace_storage_cont_url() wds_api_version() workspace_data_service_url() cbas_url()
workspace_id
- A UUID string referring to "workspaceId" or "workspaceid"
in API calls
workspace_storage_cont_id
- A UUID string identifiying the resource
storage container owned by the user account, a.k.a. "resourceId"
workspace_storage_cont_url
- The base URI string used to move data
to and from the Azure Storage Container
wds_api_version
- The version of the Workspace Data Service API, defaults
to "v0.2"
workspace_data_service_url
- The base URI string used to move data to
to and from the workspace "DATA" tab
cbas_url
- The base URI string used to query the workflow submission
history
workspace_id() workspace_storage_cont_id() workspace_storage_cont_url() if (interactive()) { workspace_data_service_url() cbas_url() }
workspace_id() workspace_storage_cont_id() workspace_storage_cont_url() if (interactive()) { workspace_data_service_url() cbas_url() }