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.

Methods


Method new()

Create a new dataset object.

Usage

VitessceConfigDataset$new(uid, name)

Arguments

uid

A unique identifier string for the dataset.

name

A name for the dataset

Returns

A new VitessceConfigDataset object.


Method add_file()

Add a file to this dataset.

Usage

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

Arguments

url

The URL to the file.

data_type

The data type for the file.

file_type

The file type for the file.

options

Optional. An options list for the file.

Returns

Invisible self, to allow chaining.

Examples

base_url <- "http://localhost:8000/"
vc <- VitessceConfig$new("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("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
)