View config API
The VitessceConfig
class provides functionality for
creating view configs using a pythonic syntax, with
support for exporting to dict or JSON format.
vitessce.config
- class vitessce.config.VitessceConfig(schema_version, name=None, description=None, base_dir=None)[source]
A class to represent a Vitessce view config.
Construct a Vitessce view config object.
- Parameters
schema_version (str) – The view config schema version.
name (str) – A name for the view config. Optional.
description (str) – A description for the view config. Optional.
base_dir (str) – A local path to a directory to be served. If provided, local data objects will be configured relative to this directory. Optional.
from vitessce import VitessceConfig vc = VitessceConfig(schema_version="1.0.15", name='My Config')
- add_coordination(*c_types)[source]
Add scope(s) for new coordination type(s) to the config.
- Parameters
*c_types (str or vitessce.constants.CoordinationType) – A variable number of coordination types.
- Returns
The instances for the new scope objects corresponding to each coordination type. These can be linked to views via the
VitessceConfigView.use_coordination()
method.- Return type
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v2 = vc.add_view(vt.SPATIAL, dataset=my_dataset) zoom_scope, x_scope, y_scope = vc.add_coordination( ct.SPATIAL_ZOOM, ct.SPATIAL_TARGET_X, ct.SPATIAL_TARGET_Y, ) v1.use_coordination(zoom_scope, x_scope, y_scope) v2.use_coordination(zoom_scope, x_scope, y_scope) zoom_scope.set_value(2) x_scope.set_value(0) y_scope.set_value(0)
- add_coordination_by_dict(input_val)[source]
Set up the initial values for multi-level coordination in the coordination space. Get a reference to these values to pass to the
useCoordinationByObject
method of either view or meta coordination scope instances.- Parameters
input_val (dict) – A (potentially nested) object with coordination types as keys and values being either the initial coordination value, a
VitessceConfigCoordinationScope
instance, or aCoordinationLevel
instance. The CoordinationLevel constructor takes an array of objects as its argument to support nesting.- Returns
A (potentially nested) object with coordination types as keys and values being either
{ scope }
,{ scope, children }
, or an array of these. Not intended to be manipulated before being passed to auseCoordinationByObject
function.- Return type
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') spatial_view = vc.add_view(vt.SPATIAL, dataset=my_dataset) lc_view = vc.add_view(vt.LAYER_CONTROLLER, dataset=my_dataset) scopes = vc.add_coordination_by_dict({ ct.SPATIAL_ZOOM: 2, ct.SPATIAL_TARGET_X: 0, ct.SPATIAL_TARGET_Y: 0, })
- add_dataset(name='', uid=None, files=None, objs=None)[source]
Add a dataset to the config.
- Parameters
- Returns
The instance for the new dataset.
- Return type
from vitessce import VitessceConfig, DataType as dt, FileType as ft vc = VitessceConfig(schema_version="1.0.15", name='My Config') my_dataset = ( vc.add_dataset(name='My Dataset') .add_file( url="http://example.com/cells.json", file_type=ft.CELLS_JSON, ) )
- add_meta_coordination()[source]
Initialize a new meta coordination scope in the coordination space, and get a reference to it in the form of a meta coordination scope instance.
- Returns
A new meta coordination scope instance.
- Return type
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') spatial_view = vc.add_view(vt.SPATIAL, dataset=my_dataset) lc_view = vc.add_view(vt.LAYER_CONTROLLER, dataset=my_dataset) scopes = vc.add_coordination_by_dict({ ct.SPATIAL_ZOOM: 2, ct.SPATIAL_TARGET_X: 0, ct.SPATIAL_TARGET_Y: 0, }) meta_scopes = vc.add_meta_coordination() meta_scopes.use_coordination_by_dict(scopes) spatial_view.use_meta_coordination(meta_scopes) lc_view.use_meta_coordination(meta_scopes)
- add_view(view_type, dataset=None, dataset_uid=None, x=0, y=0, w=1, h=1, mapping=None, coordination_scopes=None, props=None)[source]
Add a view to the config.
- Parameters
view_type (str or vitessce.constants.ViewType) – A component name, either as a string or using the ViewType enum values.
dataset (VitessceConfigDataset or None) – A dataset instance to be used for the data visualized in this view. Must provide dataset or dataset_uid, but not both.
dataset_uid (str or None) – A unique ID for a dataset to be used for the data visualized in this view. Must provide dataset or dataset_uid, but not both.
mapping (str) – An optional convenience parameter for setting the EMBEDDING_TYPE coordination scope value. This parameter is only applicable to the SCATTERPLOT component.
x (int) – The horizontal position of the view. Must be an integer between 0 and 11. Optional. This will be ignored if you call the layout method of this class using VitessceConfigViewHConcat and VitessceConfigViewVConcat objects.
y (int) – The vertical position of the view. Must be an integer between 0 and 11. Optional. This will be ignored if you call the layout method of this class using VitessceConfigViewHConcat and VitessceConfigViewVConcat objects.
w (int) – The width of the view. Must be an integer between 1 and 12. Optional. This will be ignored if you call the layout method of this class using VitessceConfigViewHConcat and VitessceConfigViewVConcat objects.
h (int) – The height of the view. Must be an integer between 1 and 12. Optional. This will be ignored if you call the layout method of this class using VitessceConfigViewHConcat and VitessceConfigViewVConcat objects.
coordination_scopes (dict or None) – A mapping from coordination types to coordination scope names for this view.
props (dict or None) – Props to set for the view using the VitessceConfigView.set_props method.
- Returns
The instance for the new view.
- Return type
from vitessce import VitessceConfig, ViewType as vt vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v2 = vc.add_view(vt.SCATTERPLOT, dataset=my_dataset, mapping="X_umap")
- display(**kwargs)[source]
As a fallback to widget, render Vitessce using functions from IPython.display. This method does not support bi-directional communication (i.e., user interactions in Vitessce cannot be sent back to Python).
- Parameters
theme (str) – The theme name, either “light” or “dark”. By default, “auto”, which selects light or dark based on operating system preferences.
port (int) – The port to use when serving data objects on localhost. By default, 8000.
base_url (str or None) – If the web app is being accessed remotely (i.e. the data is being served from a remote machine), specify the base URL here. If serving and accessing the data on the same machine, keep as None to use a localhost URL.
host_name (str or None) – The host name where the Jupyter server is running, e.g. “http://localhost:8888”. By default, None.
proxy (bool) – Is this widget being served through a proxy, for example with a cloud notebook? If True, host_name should be provided.
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) vc.layout(v1) vc.display()
- export(to, *args, **kwargs)[source]
Export this config’s data objects to the local file system or a cloud storage system and get the resulting view config.
- Parameters
to (str) – The export destination. Valid values include “S3” and “files”.
**kwargs – Keyword arguments to pass to the export function.
- Returns
The config as a dict, with URLs for the bucket filled in.
- Return type
from vitessce import VitessceConfig, ViewType as cvtm, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) vc.layout(v1) config_dict = vc.export(to="S3")
- static from_dict(config)[source]
Helper function to construct a Vitessce view config object from an existing config.
- Parameters
config (dict) – An existing Vitessce view config as a dict to allow manipulation through the
VitessceConfig
API.- Returns
The config instance.
- Return type
from vitessce import VitessceConfig vc = VitessceConfig.from_dict(my_existing_config)
- static from_object(obj, schema_version, name=None, description=None)[source]
Helper function to automatically construct a Vitessce view config object from a single-cell dataset object. Particularly helpful when using the
VitessceWidget
Jupyter widget.- Parameters
obj (anndata.AnnData or loompy.LoomConnection or zarr.Store) – A single-cell dataset in the format of a commonly-used single-cell or imaging data analysis package.
schema_version (str) – The schema version to pass to the VitessceConfig constructor.
- Returns
The config instance.
- Return type
from vitessce import VitessceConfig vc = VitessceConfig.from_object(my_scanpy_object, schema_version="1.0.15")
- get_dataset_by_coordination_scope_name(query_scope_name)[source]
Get a dataset associated with this configuration based on a coordination scope.
- Parameters
query_scope_name (str) – The unique identifier for the dataset coordination scope of interest.
- Returns
The dataset object.
- Return type
- get_dataset_by_uid(uid)[source]
Get a dataset associated with this configuration based on its uid.
- Parameters
uid (str) – The unique identifier for the dataset of interest.
- Returns
The dataset object.
- Return type
- get_datasets()[source]
Get the datasets associated with this configuration.
- Returns
The list of dataset objects.
- Return type
list of VitessceConfigDataset
- get_first_view_by_type(view_type)[source]
Get a view from the layout by view type (component) specified by the ‘view_type’ parameter.
- Parameters
view_type (str) – The view type (str) of the view in the Layout array.
- Returns
The view corresponding to the provided view_type.
- Return type
VitessceConfigView or None if not found
- get_routes()[source]
Convert the routes for this view config from the datasets.
- Returns
A list of server routes.
- Return type
list[starlette.routing.Route]
- get_stores(base_url=None)[source]
Convert the routes for this view config from the datasets.
- Returns
A list of server routes.
- Return type
list[starlette.routing.Route]
- get_view_by_index(index)[source]
Get a view from the layout by the index specified by the ‘index’ parameter.
- Parameters
index (int) – Index (int) of the view in the Layout array.
- Returns
The view corresponding to the provided index
- Return type
VitessceConfigView or None if not found
- get_views()[source]
Provides all the views in the config.layout object list
- Returns
A list of VitessceConfigView objects.
- layout(view_concat)[source]
Create a multi-view layout based on (potentially recursive) view concatenations.
- Parameters
view_concat (VitessceConfigViewHConcat or VitessceConfigViewVConcat or VitessceConfigView) – Views arranged by concatenating vertically or horizontally. Alternatively, a single view can be passed.
- Returns
Self, to allow chaining.
- Return type
from vitessce import VitessceConfig, ViewType as vt, hconcat, vconcat vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v2 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v3 = vc.add_view(vt.SPATIAL, dataset=my_dataset) vc.layout(hconcat(v1, vconcat(v2, v3)))
from vitessce import VitessceConfig, ViewType as vt vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v2 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v3 = vc.add_view(vt.SPATIAL, dataset=my_dataset) vc.layout(v1 | (v2 / v3)) # * magic * (alternative syntax)
- link_views(views, c_types, c_values=None, allow_multiple_scopes_per_type=False)[source]
A convenience function for setting up new coordination scopes across a set of views.
- Parameters
views (list of VitessceConfigView) – views An array of view objects to link together.
c_types (list of str or list of vitessce.constants.CoordinationType) – The coordination types on which to coordinate the views.
c_values (list) – Initial values corresponding to each coordination type. Should have the same length as the c_types array. Optional.
allow_multiple_scopes_per_type (bool) – Whether to allow multiple coordination scopes per coordination type. If true, multiple values for the same coordination type are treated as a list. If false, latest value for same coordination type is used. Defaults to False.
- Returns
Self, to allow chaining.
- Return type
- link_views_by_dict(views, input_val, meta=True, scope_prefix=None)[source]
A convenience function for setting up multi-level and meta-coordination scopes across a set of views.
- Parameters
views (list[VitessceConfigView]) – An array of view objects to link together.
input_val (dict) – A (potentially nested) object with coordination types as keys and values being either the initial coordination value, a
VitessceConfigCoordinationScope
instance, or aCoordinationLevel
instance. The CoordinationLevel constructor takes an array of objects as its argument to support nesting.meta (bool) – Whether or not to use meta-coordination to link the views. Optional.
- Returns
Self, to allow chaining.
- Return type
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') spatial_view = vc.add_view(vt.SPATIAL, dataset=my_dataset) lc_view = vc.add_view(vt.LAYER_CONTROLLER, dataset=my_dataset) scopes = vc.link_views_by_dict([spatial_view, lc_view], { ct.SPATIAL_ZOOM: 2, ct.SPATIAL_TARGET_X: 0, ct.SPATIAL_TARGET_Y: 0, })
- remove_first_view_by_type(view_type)[source]
Removes a view from the layout by the view type (component) specified by the ‘view_type’ parameter.
- Parameters
view_by (str) – A component view_type (str).
- Returns
The layout component of the config corresponding to the specified view_type
- Return type
VitessceConfigView or None if not found
- remove_view_by_index(index)[source]
Removes a view from the layout by the index specified by the ‘index’ parameter.
- Parameters
index (int) – the index (int) of the view
- Returns
The layout component of the config corresponding to the specified index
- Return type
VitessceConfigView or None if not found
- set_coordination_value(c_type, c_scope, c_value)[source]
Set the value for a coordination scope. If a coordination object for the coordination type does not yet exist in the coordination space, it will be created.
- Parameters
- Returns
The coordination scope instance.
- Return type
- to_python()[source]
Convert the VitessceConfig instance to a one-line Python code snippet that can be used to generate it.
- web_app(**kwargs)[source]
Launch the http://vitessce.io web app using this config.
- Parameters
theme (str) – The theme name, either “light” or “dark”. By default, “auto”, which selects light or dark based on operating system preferences.
port (int) – The port to use when serving data objects on localhost. By default, 8000.
base_url (str or None) – If the web app is being accessed remotely (i.e. the data is being served from a remote machine), specify the base URL here. If serving and accessing the data on the same machine, keep as None to use a localhost URL.
host_name (str or None) – The host name where the Jupyter server is running, e.g. “http://localhost:8888”. By default, None.
proxy (bool) – Is this widget being served through a proxy, for example with a cloud notebook? If True, host_name should be provided.
open (bool) – Should the browser be opened to the web app URL? By default, True.
- Returns
The URL of the web app (containing the Vitessce configuration as URL-encoded JSON).
- Return type
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) vc.layout(v1) vc.web_app()
- widget(**kwargs)[source]
Instantiate a VitessceWidget object based on this config.
- Parameters
theme (str) – The theme name, either “light” or “dark”. By default, “auto”, which selects light or dark based on operating system preferences.
height (int) – The height of the widget, in pixels. By default, 600.
port (int) – The port to use when serving data objects on localhost. By default, 8000.
proxy (bool) – Is this widget being served through a proxy, for example with a cloud notebook (e.g. Binder)?
- Returns
The Jupyter widget.
- Return type
VitessceWidget
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) vc.layout(v1) vw = vc.widget() vw
- class vitessce.config.VitessceChainableConfig(schema_version, **kwargs)[source]
A class to represent a Vitessce view config, where the methods
add_dataset
,add_view
, andset_coordination_value
return self (the config instance). This class inherits fromVitessceConfig
.Construct a Vitessce view config object.
- Parameters
**kwargs – Takes the same arguments as the constructor on the
VitessceConfig
class.
from vitessce import VitessceChainableConfig vc = VitessceChainableConfig(schema_version='1.0.15', name='My Config')
- add_dataset(copy=True, **kwargs)[source]
Add a dataset to this config.
- Parameters
**kwargs – Takes the same arguments as the
add_dataset
method on theVitessceConfig
class.- Returns
The config instance.
- Return type
- add_view(component, copy=True, **kwargs)[source]
Add a view to this config.
- Parameters
component – Takes the same arguments as the
add_view
method on theVitessceConfig
class.**kwargs – Takes the same arguments as the
add_view
method on theVitessceConfig
class.
- Returns
The config instance.
- Return type
- set_coordination_value(c_type, c_scope, c_value, copy=True)[source]
Add a coordination value to this config.
- Parameters
c_type – Takes the same arguments as the
set_coordination_value
method on theVitessceConfig
class.c_scope – Takes the same arguments as the
set_coordination_value
method on theVitessceConfig
class.c_value – Takes the same arguments as the
set_coordination_value
method on theVitessceConfig
class.
- Returns
The config instance.
- Return type
- class vitessce.config.VitessceConfigDatasetFile(file_type, url=None, coordination_values=None, options=None, data_type=None, request_init=None)[source]
A class to represent a file (described by a URL, data type, and file type) in a Vitessce view config dataset.
Not meant to be instantiated directly, but instead created and returned by the
VitessceConfigDataset.add_file()
method.- Parameters
file_type (str) – A file type.
url (str or None) – A URL to this file. Can be a localhost URL or a remote URL.
coordination_values (dict or None) – Coordination values to pass to the file loader class.
options (dict or list or None) – Extra options to pass to the file loader class.
data_type – Deprecated / not used. Only included for backwards compatibility with the old API.
request_init (dict or None) – Optional request init object to pass to the fetch API.
- class vitessce.config.VitessceConfigDataset(uid, name, base_dir=None)[source]
A class to represent a dataset (i.e. list of files containing common biological entities) in the Vitessce view config.
Not meant to be instantiated directly, but instead created and returned by the
VitessceConfig.add_dataset()
method.- add_file(file_type, url=None, coordination_values=None, options=None, data_type=None, request_init=None)[source]
Add a new file definition to this dataset instance.
- Parameters
file_type (str or vitessce.constants.FileType) – The file type. Must be compatible with the specified data type.
url (str or None) – The URL for the file, pointing to either a local or remote location.
coordination_values (dict or None) – Coordination values to pass to the file loader class. Optional.
options (dict or list or None) – Extra options to pass to the file loader class. Optional.
data_type – Deprecated / not used. Only included for backwards compatibility with the old API.
request_init (dict or None) – Optional request init object to pass to the fetch API.
- Returns
Self, to allow function chaining.
- Return type
from vitessce import VitessceConfig, DataType as dt, FileType as ft vc = VitessceConfig(schema_version="1.0.15", name='My Config') my_dataset = ( vc.add_dataset(name='My Dataset') .add_file( url="http://example.com/cells.json", data_type=dt.CELLS, file_type=ft.CELLS_JSON, ) )
- class vitessce.config.VitessceConfigViewHConcat(views, split=None)[source]
A class to represent a horizontal concatenation of view instances.
Not meant to be instantiated directly, but instead created and returned by the
hconcat
helper function.
- vitessce.config.hconcat(*views, split=None)[source]
A helper function to create a
VitessceConfigViewHConcat
instance.- Parameters
*views (VitessceConfigView or VitessceConfigViewVConcat or VitessceConfigViewHConcat) – A variable number of views to concatenate horizontally.
split (list of int) – Optional list of relative width fractions for each view.
- Returns
The concatenated view instance.
- Return type
from vitessce import VitessceConfig, ViewType as vt, hconcat, vconcat vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v2 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v3 = vc.add_view(vt.SPATIAL, dataset=my_dataset) vc.layout(hconcat(v1, vconcat(v2, v3), split = [1,2])) split = [1,2] would give v1 (1/3) width, and vconcat(v2, v3) 2/3 width
- class vitessce.config.VitessceConfigViewVConcat(views, split=None)[source]
A class to represent a vertical concatenation of view instances.
Not meant to be instantiated directly, but instead created and returned by the
vconcat
helper function.
- vitessce.config.vconcat(*views, split=None)[source]
A helper function to create a
VitessceConfigViewVConcat
instance.- Parameters
*views (VitessceConfigView or VitessceConfigViewVConcat or VitessceConfigViewHConcat) – A variable number of views to concatenate vertically.
split (list of int) – Optional list of relative height fractions for each view.
- Returns
The concatenated view instance.
- Return type
from vitessce import VitessceConfig, ViewType as vt, hconcat, vconcat vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v2 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v3 = vc.add_view(vt.SPATIAL, dataset=my_dataset) vc.layout(hconcat(v1, vconcat(v2, v3, [1,2]))) split = [1,2] would give v2 (1/3) height, and v3, 2/3 height
- class vitessce.config.VitessceConfigView(component, coordination_scopes, x, y, w, h)[source]
A class to represent a view (i.e. visualization component) in the Vitessce view config layout.
Not meant to be instantiated directly, but instead created and returned by the
VitessceConfig.add_view()
method.- Parameters
component (str) – The name of the component used for this view.
coordination_scopes (dict) – A mapping of coordination types to coordination scopes.
x (int) – An x-coordinate for this view in the grid.
y (int) – A y-coordinate for this view in the grid.
w (int) – A width for this view in the grid.
h (int) – A height for this view in the grid.
- get_coordination_scope(c_type)[source]
Get the coordination scope name for a particular coordination type.
- use_coordination(*c_scopes, allow_multiple_scopes_per_type=False)[source]
Attach a coordination scope to this view instance. All views using the same coordination scope for a particular coordination type will effectively be linked together.
- Parameters
*c_scopes (VitessceConfigCoordinationScope) – A variable number of coordination scope instances can be passed.
allow_multiple_scopes_per_type (bool) – Whether to allow multiple coordination scopes per coordination type. If true, multiple values for the same coordination type are treated as a list. If false, latest value for same coordination type is used. Defaults to False.
- Returns
Self, to allow chaining.
- Return type
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v2 = vc.add_view(vt.SPATIAL, dataset=my_dataset) zoom_scope, x_scope, y_scope = vc.add_coordination( ct.SPATIAL_ZOOM, ct.SPATIAL_TARGET_X, ct.SPATIAL_TARGET_Y, ) v1.use_coordination(zoom_scope, x_scope, y_scope) v2.use_coordination(zoom_scope, x_scope, y_scope) zoom_scope.set_value(2) x_scope.set_value(0) y_scope.set_value(0)
- use_coordination_by_dict(scopes)[source]
Attach potentially multi-level coordination scopes to this view.
- Parameters
scopes (dict) – A value returned by
VitessceConfig.add_coordination_by_dict
. Not intended to be a manually-constructed object.- Returns
Self, to allow chaining.
- Return type
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') spatial_view = vc.add_view(vt.SPATIAL, dataset=my_dataset) scopes = vc.add_coordination_by_dict({ ct.SPATIAL_ZOOM: 2, ct.SPATIAL_TARGET_X: 0, ct.SPATIAL_TARGET_Y: 0, }) spatial_view.use_coordination_by_dict(scopes)
- use_meta_coordination(meta_scope)[source]
Attach meta coordination scopes to this view. :param meta_scope: A meta coordination scope instance. :type meta_scope: VitessceConfigMetaCoordinationScope :returns: Self, to allow chaining. :rtype: VitessceConfigView
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') spatial_view = vc.add_view(vt.SPATIAL, dataset=my_dataset) lc_view = vc.add_view(vt.LAYER_CONTROLLER, dataset=my_dataset) scopes = vc.add_coordination_by_dict({ ct.SPATIAL_ZOOM: 2, ct.SPATIAL_TARGET_X: 0, ct.SPATIAL_TARGET_Y: 0, }) meta_scopes = vc.add_meta_coordination() meta_scopes.use_coordination_by_dict(scopes) spatial_view.use_meta_coordination(meta_scopes) lc_view.use_meta_coordination(meta_scopes)
- set_xywh(x, y, w, h)[source]
Set the dimensions for this view.
- Parameters
- Returns
Self, to allow chaining.
- Return type
- class vitessce.config.VitessceConfigCoordinationScope(c_type, c_scope, c_value=None)[source]
A class to represent a coordination scope in the Vitessce view config coordination space.
Not meant to be instantiated directly, but instead created and returned by the
VitessceConfig.add_coordination()
method.- Parameters
- set_value(c_value)[source]
Set the value of the coordination scope.
- Parameters
c_value (any) – The coordination value to be set. Can be any value that is valid for the coordination type. Must be serializable to JSON.
- Returns
Self, to allow chaining.
- Return type
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') v1 = vc.add_view(vt.SPATIAL, dataset=my_dataset) v2 = vc.add_view(vt.SPATIAL, dataset=my_dataset) zoom_scope, x_scope, y_scope = vc.add_coordination( ct.SPATIAL_ZOOM, ct.SPATIAL_TARGET_X, ct.SPATIAL_TARGET_Y, ) v1.use_coordination(zoom_scope, x_scope, y_scope) v2.use_coordination(zoom_scope, x_scope, y_scope) zoom_scope.set_value(2) x_scope.set_value(0) y_scope.set_value(0)
- class vitessce.config.VitessceConfigMetaCoordinationScope(meta_scope, meta_by_scope)[source]
A class representing a pair of coordination scopes, for metaCoordinationScopes and metaCoordinationScopesBy, respectively, in the coordination space.
Not meant to be instantiated directly, but instead created and returned by the
VitessceConfig.add_meta_coordination()
method.- Parameters
- use_coordination(*c_scopes)[source]
Attach coordination scopes to this meta scope.
- Parameters
*c_scopes (VitessceConfigCoordinationScope) – A variable number of coordination scope instances.
- Returns
Self, to allow chaining.
- Return type
- use_coordination_by_dict(scopes)[source]
Attach potentially multi-level coordination scopes to this meta-scopes instance.
- Parameters
scopes (dict) – A value returned by
VitessceConfig.add_coordination_by_dict
. Not intended to be a manually-constructed object.- Returns
Self, to allow chaining.
- Return type
from vitessce import VitessceConfig, ViewType as vt, CoordinationType as ct vc = VitessceConfig(schema_version="1.0.15") my_dataset = vc.add_dataset(name='My Dataset') spatial_view = vc.add_view(vt.SPATIAL, dataset=my_dataset) lc_view = vc.add_view(vt.LAYER_CONTROLLER, dataset=my_dataset) scopes = vc.add_coordination_by_dict({ ct.SPATIAL_ZOOM: 2, ct.SPATIAL_TARGET_X: 0, ct.SPATIAL_TARGET_Y: 0, }) meta_scopes = vc.add_meta_coordination() meta_scopes.use_coordination_by_dict(scopes) spatial_view.use_meta_coordination(meta_scopes) lc_view.use_meta_coordination(meta_scopes)
vitessce.constants
- class vitessce.constants.CoordinationType(value)[source]
An enum type representing a coordination type in the Vitessce coordination model. The term coordination type refers to a parameter to be coordinated, and its programming-language-like type. For example, the
SPATIAL_ZOOM
coordination type represents a coordination of the zoom level of a spatial view, which can take a float value.
- class vitessce.constants.DataType(value)[source]
An enum type representing the type of data contained in a file.
- class vitessce.constants.FileType(value)[source]
An enum type representing the file format or schema to which a file conforms.