| VitessceConfig | R Documentation |
Class representing a Vitessce view config.
VitessceConfig
configThe internal representation of the view config.
base_dirThe base directory for the config.
new()Create a new config object.
VitessceConfig$new(schema_version, name = NA, description = NA, base_dir = NA)
schema_versionThe Vitessce config schema version to use.
nameA name for the config.
descriptionA description for the config.
A new VitessceConfig object.
add_dataset()Add a dataset to the config.
VitessceConfig$add_dataset(name, uid = NA)
nameA name for the dataset.
uidA unique ID for the dataset. Optional. Created automatically if not provided.
A new VitessceConfigDataset object.
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
add_view()Add a view to the config.
VitessceConfig$add_view( dataset, component, x = NA, y = NA, w = NA, h = NA, mapping = NA )
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_TYPE coordination value if the component isComponent$SCATTERPLOT.
A new VitessceConfigView object.
vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")
ds <- vc$add_dataset("My dataset")
spatial <- vc$add_view(ds, "spatial")
add_coordination()Add a coordination scope to the config, for one or more coordination types.
VitessceConfig$add_coordination(c_types)
c_typesThe coordination types for which to create new coordination scopes.
A list of new VitessceConfigCoordinationScope objects.
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)
add_meta_coordination()VitessceConfig$add_meta_coordination()
add_coordination_by_dict()VitessceConfig$add_coordination_by_dict(input_val)
link_views_by_dict()VitessceConfig$link_views_by_dict(views, input_val, meta = TRUE)
layout()Define the layout of views.
VitessceConfig$layout(view_concat)
view_concatA concatenation of views.
Self, to allow chaining.
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")
link_views()A convenience function for setting up new coordination scopes across a set of views.
VitessceConfig$link_views(views, c_types, c_values = NA, raw = FALSE)
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.
Self, to allow chaining.
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)
)
to_list()Convert the config to an R list. Helpful when converting the config to JSON.
VitessceConfig$to_list(base_url = NA)
base_urlAn base URL to prepend to file paths.
A list that can be serialized to JSON.
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")
get_routes()Get a list of web server route objects corresponding to any local files which will need to be served.
VitessceConfig$get_routes()
A list of VitessceConfigServerStaticRoute.
widget()Create an htmlwidget based on this config.
VitessceConfig$widget(...)
...Passes extra keyword arguments to the vitessce_widget function.
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.
The Vitessce htmlwidget.
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()
export()Export the data associated with this configuration to a specified destination.
VitessceConfig$export(to = "files", with_config = FALSE, base_url = NA, ...)
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_config is TRUE, what base_url value should be used for creation of the JSON config?
...Extra parameters to pass through to the export function.
The Vitessce configuration as a list, with the base_url filled in.
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")
clone()The objects of this class are cloneable with this method.
VitessceConfig$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------
## 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.