list_urls: List data store servers and urls

list_download_urlsR Documentation

List data store servers and urls

Description

In order to download files from openBIS, download urls have to be generated first, which can be done by calling list_download_urls(). This function is used in fetch_files(), which iterates over the selected files, creating download links and executing the downloads. All data store servers registered to an openBIS instance are listed by list_datastores() and data store server urls per data set can be queried by calling list_datastore_urls().

Usage

list_download_urls(token, x, ...)

## S3 method for class 'character'
list_download_urls(token, x, path, timeout = NA, ...)

## S3 method for class 'DataSet'
list_download_urls(token, x, path, timeout = NA, ...)

## S3 method for class 'DatasetIdentifier'
list_download_urls(token, x, path,
  timeout = NA, ...)

## S3 method for class 'DatasetReference'
list_download_urls(token, x, path,
  timeout = NA, ...)

## S3 method for class 'FeatureVectorDatasetReference'
list_download_urls(token, x, path,
  timeout = NA, ...)

## S3 method for class 'FeatureVectorDatasetWellReference'
list_download_urls(token, x,
  path, timeout = NA, ...)

## S3 method for class 'ImageDatasetReference'
list_download_urls(token, x, path,
  timeout = NA, ...)

## S3 method for class 'MicroscopyImageReference'
list_download_urls(token, x, path,
  timeout = NA, ...)

## S3 method for class 'PlateImageReference'
list_download_urls(token, x, path,
  timeout = NA, ...)

## S3 method for class 'DataSetFileDTO'
list_download_urls(token, x, timeout = NA, ...)

list_datastores(token, ...)

list_datastore_urls(token, x = NULL, ...)

## S3 method for class 'NULL'
list_datastore_urls(token, x, ...)

## S3 method for class 'character'
list_datastore_urls(token, x, ...)

## S3 method for class 'DataSet'
list_datastore_urls(token, x, ...)

## S3 method for class 'DatasetIdentifier'
list_datastore_urls(token, x, ...)

## S3 method for class 'DatasetReference'
list_datastore_urls(token, x, ...)

## S3 method for class 'FeatureVectorDatasetReference'
list_datastore_urls(token, x, ...)

## S3 method for class 'FeatureVectorDatasetWellReference'
list_datastore_urls(token, x,
  ...)

## S3 method for class 'ImageDatasetReference'
list_datastore_urls(token, x, ...)

## S3 method for class 'MicroscopyImageReference'
list_datastore_urls(token, x, ...)

## S3 method for class 'PlateImageReference'
list_datastore_urls(token, x, ...)

Arguments

token

Login token as created by login_openbis().

x

Object representing a (set of) dataset(s), e.g. a vector of dataset codes, or a set of DataSets or DatasetIdentifiers.

...

Generic compatibility. Extra arguments will be passed to make_requests().

path

A character vector of file paths within datasets.

timeout

Time-span (in seconds) for which the file download link should be valid.

Details

To specify files for which links are requested by list_download_urls(), both a data set code and a file path are required. Objects, apart from character vectors of data set codes, that may be passed to identify the data set therefore include DataSet, DatasetIdentifier, DatasetReference, FeatureVectorDatasetReference, FeatureVectorDatasetWellReference, ImageDatasetReference, MicroscopyImageReference and PlateImageReference. Additionally, dispatch of list_download_urls() is possible on DataSetFileDTO objects which contain both information on data set and file path of a file. A timeout argument may be specified, determining how long (in seconds) the generated url is valid for. If no specific timeout value is passed the url is valid for what the openBIS documentation calls "a short time".

list_datastore_urls() as list_download_urls() ultimately requires a character vector of data set codes to make the API call and therefore dispatch is possible on, in addition to character vector, DataSet, DatasetIdentifier, DatasetReference, FeatureVectorDatasetReference, FeatureVectorDatasetWellReference, ImageDatasetReference, MicroscopyImageReference and PlateImageReference objects. Dispatch on NULL requests the default data store server url. Datastore sever url related functionality is uninteresting for the InfectX set-up, as only a single data store server exists, the url of which can be retrieved by a call to list_datastores().

Value

Both list_download_urls() and list_datastore_urls() return character vectors while list_datastores() returns either a json_class (single object) or a json_vec (multiple objects), dependent on the number of resulting objects, with sub-type DataStore.

openBIS

  • \Sexpr[results=rd]{infx::docs_link("dsrg", "getDownloadUrlForFileForDataSet")}
  • \Sexpr[results=rd]{infx::docs_link("dsrg", "getDownloadUrlForFileForDataSetWithTimeout")}
  • \Sexpr[results=rd]{infx::docs_link("gis", "listDataStores")}
  • \Sexpr[results=rd]{infx::docs_link("gis", "getDefaultPutDataStoreBaseURL")}
  • \Sexpr[results=rd]{infx::docs_link("gis", "tryGetDataStoreBaseURL")}
  • \Sexpr[results=rd]{infx::docs_link("gis", "getDataStoreBaseURLs")}

See Also

Other resource listing/downloading functions: fetch_images, list_features, list_files

Examples


  tok <- login_openbis()
  
  # data store server information
  list_datastores(tok)

  # search for a cell profiler feature data set from plate KB2-03-1I
  search <- search_criteria(
    attribute_clause("type", "HCS_ANALYSIS_CELL_FEATURES_CC_MAT"),
    sub_criteria = search_sub_criteria(
      search_criteria(attribute_clause("code",
                                       "/INFECTX_PUBLISHED/KB2-03-1I")),
      type = "sample"
    )
  )
  ds <- search_openbis(tok, search)

  # list all files of this data set
  files <- list_files(tok, ds)
  # extract file paths
  file_paths <- get_field(files, "pathInDataSet")
  # select a file
  file_path <- file_paths[grepl("Count_Cells", file_paths)]

  # generate url
  list_download_urls(tok, ds, file_path)

  # generate url and download file
  dat <- read_mat_files(url(list_download_urls(tok, ds, file_path)[[1L]]))
  attributes(dat)
  str(as.integer(dat))

  # set timeout to 2 sec
  file_url <- list_download_urls(tok, ds, file_path, timeout = 2L)
  tmp <- read_mat_files(url(file_url[[1L]]))

  # let timeout expire
  file_url <- list_download_urls(tok, ds, file_path, timeout = 2L)
  Sys.sleep(4L)
  tmp <- read_mat_files(url(file_url[[1L]]))

  logout_openbis(tok)


ropensci/infx documentation built on May 14, 2022, 5:51 p.m.