Class representing a Vitessce view config.
Public fields
configThe internal representation of the view config.
base_dirThe base directory for the config.
Methods
Method new()
Create a new config object.
Usage
VitessceConfig$new(schema_version, name = NA, description = NA, base_dir = NA)Method add_dataset()
Add a dataset to the config.
Arguments
nameA name for the dataset.
uidA unique ID for the dataset. Optional. Created automatically if not provided.
Examples
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")Method add_view()
Add a view to the config.
Arguments
datasetThe dataset object to associate with this view.
componentThe name of a component to render in this view.
xThe x-coordinate of the view in the layout.
yThe y-coordinate of the view in the layout.
wThe width of the view in the layout.
hThe height of the view in the layout.
mappingAn optional convenience parameter for setting the
CoordinationType$EMBEDDING_TYPEcoordination value if the component isComponent$SCATTERPLOT.
Examples
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
spatial <- vc$add_view(ds, "spatial")Method add_coordination()
Add a coordination scope to the config, for one or more coordination types.
Examples
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
spatial <- vc$add_view(ds, "spatial")
c_scopes <- vc$add_coordination(c("spatialZoom", "spatialTargetX"))
spatial$use_coordination(c_scopes)Method layout()
Define the layout of views.
Examples
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
spatial <- vc$add_view(ds, "spatial")
scatterplot <- vc$add_view(ds, "scatterplot")Method link_views()
A convenience function for setting up new coordination scopes across a set of views.
Arguments
viewsAn array of view objects to link together.
c_typesThe coordination types on which to coordinate the views.
c_valuesInitial values corresponding to each coordination type. Should have the same length as the c_types array. Optional.
rawShould the coordination values be set using VitessceConfigCoordinationScope$set_value() or VitessceConfigCoordinationScope$set_value_raw()? Use when setting lists or similar more complex values.
Examples
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ref_dataset <- vc$add_dataset("Reference")
qry_dataset <- vc$add_dataset("Query")
ref_plot <- vc$add_view(ref_dataset, Component$SCATTERPLOT, mapping = "umap")
qry_plot <- vc$add_view(qry_dataset, Component$SCATTERPLOT, mapping = "proj.umap")
vc$link_views(
c(ref_plot, qry_plot),
c(CoordinationType$EMBEDDING_TARGET_X, CoordinationType$EMBEDDING_TARGET_Y),
c_values = c(0, 0)
)Method to_list()
Convert the config to an R list. Helpful when converting the config to JSON.
Examples
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
vc_list <- vc$to_list(base_url = "http://localhost:8000")Method get_routes()
Get a list of web server route objects corresponding to any local files which will need to be served.
Method widget()
Create an htmlwidget based on this config.
Arguments
...Passes extra keyword arguments to the
vitessce_widgetfunction.themeThe theme of the widget, either "dark" or "light". Optional. By default, "dark".
widthThe width of the widget as a number or CSS string. Optional.
heightThe height of the widget as a number or CSS string. Optional.
portThe port for the local web server (which serves local dataset objects to the widget). Optional. By default, uses open port between 8000 and 9000.
base_urlThe base URL for the web server. Optional. By default, creates a localhost URL which includes the port.
serveShould local data be served by running a local web server with R plumber? By default, TRUE.
element_idAn element ID. Optional.
Examples
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
dataset <- vc$add_dataset("My dataset")
description <- vc$add_view(dataset, Component$DESCRIPTION)
vc$layout(description)
vc$widget()Method export()
Export the data associated with this configuration to a specified destination.
Arguments
toWhere should the files be exported to? Values currently supported: "files"
with_configShould the Vitessce configuration be saved in the output directory as a JSON file?
base_urlIf
with_configis TRUE, whatbase_urlvalue should be used for creation of the JSON config?...Extra parameters to pass through to the export function.
Examples
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
dataset <- vc$add_dataset("My dataset")
description <- vc$add_view(dataset, Component$DESCRIPTION)
vc$layout(description)
vc$export(with_config = TRUE, base_url = "http://localhost:3000", out_dir = "./data")Examples
## ------------------------------------------------
## Method `VitessceConfig$add_dataset`
## ------------------------------------------------
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
## ------------------------------------------------
## Method `VitessceConfig$add_view`
## ------------------------------------------------
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
spatial <- vc$add_view(ds, "spatial")
## ------------------------------------------------
## Method `VitessceConfig$add_coordination`
## ------------------------------------------------
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
spatial <- vc$add_view(ds, "spatial")
c_scopes <- vc$add_coordination(c("spatialZoom", "spatialTargetX"))
spatial$use_coordination(c_scopes)
## ------------------------------------------------
## Method `VitessceConfig$layout`
## ------------------------------------------------
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
spatial <- vc$add_view(ds, "spatial")
scatterplot <- vc$add_view(ds, "scatterplot")
## ------------------------------------------------
## Method `VitessceConfig$link_views`
## ------------------------------------------------
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ref_dataset <- vc$add_dataset("Reference")
qry_dataset <- vc$add_dataset("Query")
ref_plot <- vc$add_view(ref_dataset, Component$SCATTERPLOT, mapping = "umap")
qry_plot <- vc$add_view(qry_dataset, Component$SCATTERPLOT, mapping = "proj.umap")
vc$link_views(
c(ref_plot, qry_plot),
c(CoordinationType$EMBEDDING_TARGET_X, CoordinationType$EMBEDDING_TARGET_Y),
c_values = c(0, 0)
)
## ------------------------------------------------
## Method `VitessceConfig$to_list`
## ------------------------------------------------
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
vc_list <- vc$to_list(base_url = "http://localhost:8000")
## ------------------------------------------------
## Method `VitessceConfig$widget`
## ------------------------------------------------
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
dataset <- vc$add_dataset("My dataset")
description <- vc$add_view(dataset, Component$DESCRIPTION)
vc$layout(description)
vc$widget()
## ------------------------------------------------
## Method `VitessceConfig$export`
## ------------------------------------------------
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
dataset <- vc$add_dataset("My dataset")
description <- vc$add_view(dataset, Component$DESCRIPTION)
vc$layout(description)
vc$export(with_config = TRUE, base_url = "http://localhost:3000", out_dir = "./data")