Skip to contents

Class representing a dataset in a Vitessce view config.

Details

Dataset in a VitessceConfig

Public fields

dataset

The dataset as a list.

base_dir

The base directory for the config.

Methods


Method new()

Create a new dataset object.

Usage

VitessceConfigDataset$new(uid, name, base_dir = NA)

Arguments

uid

A unique identifier string for the dataset.

name

A name for the dataset

base_dir

A directory which local files are configured relative to.

Returns

A new VitessceConfigDataset object.


Method get_name()

Get the dataset name.

Usage

VitessceConfigDataset$get_name()

Returns

The name as a string.


Method get_uid()

Get the dataset UID.

Usage

VitessceConfigDataset$get_uid()

Returns

The uid as a string.


Method add_file()

Add a file to this dataset.

Usage

VitessceConfigDataset$add_file(
  url = NA,
  file_type = NA,
  options = NA,
  coordination_values = NA,
  data_type = NA
)

Arguments

url

The URL to the file.

file_type

The file type for the file.

options

Optional. An options list for the file.

data_type

The data type for the file.

Returns

Invisible self, to allow chaining.

Examples

base_url <- "http://localhost:8000/"
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
dataset <- vc$add_dataset("My dataset")$add_file(
  url = paste0(base_url, "cells.json"),
  data_type = DataType$CELLS,
  file_type = FileType$CELLS_JSON
)


Method add_object()

Add a data object to this dataset.

Usage

VitessceConfigDataset$add_object(obj)

Arguments

obj

The data object to add.

Returns

Invisible self, to allow chaining.


Method get_routes()

Get a list of web server route objects corresponding to any local files which will need to be served.

Usage

VitessceConfigDataset$get_routes()

Returns

A list of VitessceConfigServerStaticRoute.


Method to_list()

Convert the dataset to an R list. Helpful when converting the config to JSON.

Usage

VitessceConfigDataset$to_list(base_url = NA)

Arguments

base_url

The base URL to prepend to web server file paths.

Returns

A list that can be serialized to JSON using rjson.


Method clone()

The objects of this class are cloneable with this method.

Usage

VitessceConfigDataset$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `VitessceConfigDataset$add_file`
## ------------------------------------------------

base_url <- "http://localhost:8000/"
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
dataset <- vc$add_dataset("My dataset")$add_file(
  url = paste0(base_url, "cells.json"),
  data_type = DataType$CELLS,
  file_type = FileType$CELLS_JSON
)