Warning
This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
galaxy.visualization.plugins package¶
Submodules¶
galaxy.visualization.plugins.config_parser module¶
-
exception
galaxy.visualization.plugins.config_parser.
ParsingException
[source]¶ Bases:
exceptions.ValueError
An exception class for errors that occur during parsing of the visualizations framework configuration XML file.
-
class
galaxy.visualization.plugins.config_parser.
VisualizationsConfigParser
[source]¶ Bases:
object
Class that parses a visualizations configuration XML file.
- Each visualization will get the following info:
- how to load a visualization:
- – how to find the proper template – how to convert query string into DB models
- when/how to generate a link to the visualization
- – what provides the data – what information needs to be added to the query string
-
ALLOWED_ENTRY_POINT_TYPES
= ['mako', 'html', 'script', 'chart']¶ what are the allowed ‘entry_point_type’ for entry_point elements
-
VALID_RENDER_TARGETS
= ['galaxy_main', '_top', '_blank']¶ what are the allowed href targets when clicking on a visualization anchor
-
parse_file
(xml_filepath)[source]¶ Parse the given XML file for visualizations data. :returns: visualization config dictionary
-
class
galaxy.visualization.plugins.config_parser.
DataSourceParser
[source]¶ Bases:
object
Component class of VisualizationsConfigParser that parses data_source elements within visualization elements.
data_sources are (in the extreme) any object that can be used to produce data for the visualization to consume (e.g. HDAs, LDDAs, Jobs, Users, etc.). There can be more than one data_source associated with a visualization.
-
ALLOWED_MODEL_CLASSES
= ['Visualization', 'HistoryDatasetAssociation', 'LibraryDatasetDatasetAssociation']¶
-
ATTRIBUTE_SPLIT_CHAR
= '.'¶
-
ALLOWED_DATA_SOURCE_ATTRIBUTES
= ['datatype']¶
-
parse
(xml_tree)[source]¶ Return a visualization data_source dictionary parsed from the given XML element.
-
parse_model_class
(xml_tree)[source]¶ Convert xml model_class element to a galaxy model class (or None if model class is not found).
This element is required and only the first element is used. The model_class string must be in ALLOWED_MODEL_CLASSES.
-
-
class
galaxy.visualization.plugins.config_parser.
ListParser
(aList)[source]¶ Bases:
list
Converts a xml structure into an array See: http://code.activestate.com/recipes/410469-xml-as-dictionary/
-
class
galaxy.visualization.plugins.config_parser.
DictParser
(parent_element)[source]¶ Bases:
dict
Converts a xml structure into a dictionary See: http://code.activestate.com/recipes/410469-xml-as-dictionary/
-
class
galaxy.visualization.plugins.config_parser.
ParamParser
[source]¶ Bases:
object
Component class of VisualizationsConfigParser that parses param elements within visualization elements.
params are parameters that will be parsed (based on their type, etc.) and sent to the visualization template by controllers.visualization.render.
-
DEFAULT_PARAM_TYPE
= 'str'¶
-
-
class
galaxy.visualization.plugins.config_parser.
ParamModifierParser
[source]¶ Bases:
galaxy.visualization.plugins.config_parser.ParamParser
Component class of VisualizationsConfigParser that parses param_modifier elements within visualization elements.
param_modifiers are params from a dictionary (such as a query string) that are not standalone but modify the parsing/conversion of a separate (normal) param (e.g. ‘hda_ldda’ can equal ‘hda’ or ‘ldda’ and control whether a visualizations ‘dataset_id’ param is for an HDA or LDDA).
galaxy.visualization.plugins.interactive_environments module¶
-
class
galaxy.visualization.plugins.interactive_environments.
InteractiveEnvironmentRequest
(trans, plugin)[source]¶ Bases:
object
-
get_conf_dict
()[source]¶ Build up a configuration dictionary that is standard for ALL IEs.
TODO: replace hashed password with plaintext.
-
url_template
(url_template)[source]¶ Process a URL template
There are several variables accessible to the user:
- ${PROXY_URL} will be replaced with the dynamically create proxy’s url
- ${PROXY_PREFIX} will be replaced with the prefix that may occur
-
docker_cmd
(image, env_override=None, volumes=None)[source]¶ Generate and return the docker command to execute
-
use_volumes
¶
-
launch
(image=None, additional_ids=None, env_override=None, volumes=None)[source]¶ Launch a docker image.
Parameters: - image (str) – Optional image name. If not provided, self.default_image is used, which is the first image listed in the allowed_images.yml{,.sample} file.
- additional_ids (str) – comma separated list of encoded HDA IDs. These are transformed into Volumes and added to that argument
- env_override (dict) – dictionary of environment variables to add.
- volumes (list of :class:`galaxy.containers.docker_model.DockerVolume`s) – dictionary of docker volume mounts
-
inspect_container
(container_id)[source]¶ Runs docker inspect on a container and returns json response as python dictionary inspect_data.
Parameters: container_id (str) – a docker container ID Returns: inspect_data, a dict of docker inspect output
-
get_container_host
(inspect_data)[source]¶ Determine the ip address on the container. If inspect_data contains Node.IP return that (e.g. running in Docker Swarm). If the hostname is “localhost”, look for NetworkSettings.Gateway. Otherwise, just return the configured docker_hostname.
Parameters: inspect_data (dict) – output of docker inspect Returns: IP address or hostname of the node the conatainer is running on.
-
get_container_port_mapping
(inspect_data)[source]¶ Parameters: inspect_data (dict) – output of docker inspect Returns: a list of triples containing (internal_port, external_ip, external_port), of which the ports are probably the only useful information. Someday code that calls this should be refactored whenever we get containers with multiple ports working.
-
galaxy.visualization.plugins.plugin module¶
Visualization plugins: instantiate/deserialize data and models from a query string and render a webpage based on those data.
-
class
galaxy.visualization.plugins.plugin.
ServesTemplatesPluginMixin
[source]¶ Bases:
object
An object that renders (mako) template files from the server.
-
DEFAULT_TEMPLATE_COLLECTION_SIZE
= 10¶ default number of templates to search for plugin template lookup
-
-
class
galaxy.visualization.plugins.plugin.
VisualizationPlugin
(app, path, name, config, context=None, **kwargs)[source]¶ Bases:
galaxy.visualization.plugins.plugin.ServesTemplatesPluginMixin
A plugin that instantiates resources, serves static files, and uses mako templates to render web pages.
-
render
(trans=None, embedded=None, **kwargs)[source]¶ Render and return the text of the non-saved plugin webpage/fragment.
-
-
class
galaxy.visualization.plugins.plugin.
InteractiveEnvironmentPlugin
(app, path, name, config, context=None, **kwargs)[source]¶ Bases:
galaxy.visualization.plugins.plugin.VisualizationPlugin
Serves web-based REPLs such as Jupyter and RStudio.
-
INTENV_REQUEST_FACTORY
¶ alias of
galaxy.visualization.plugins.interactive_environments.InteractiveEnvironmentRequest
-
-
class
galaxy.visualization.plugins.plugin.
ScriptVisualizationPlugin
(app, path, name, config, context=None, **kwargs)[source]¶ Bases:
galaxy.visualization.plugins.plugin.VisualizationPlugin
A visualization plugin that starts by loading a single (js) script.
- The script is loaded into a pre-defined mako template:
- config/plugins/visualizations/common/templates/script_entry_point.mako
-
MAKO_TEMPLATE
= 'script_entry_point.mako'¶
-
class
galaxy.visualization.plugins.plugin.
ChartVisualizationPlugin
(app, path, name, config, context=None, **kwargs)[source]¶ Bases:
galaxy.visualization.plugins.plugin.ScriptVisualizationPlugin
-
MAKO_TEMPLATE
= 'chart_entry_point.mako'¶
-
-
class
galaxy.visualization.plugins.plugin.
StaticFileVisualizationPlugin
(app, path, name, config, context=None, **kwargs)[source]¶ Bases:
galaxy.visualization.plugins.plugin.VisualizationPlugin
A visualization plugin that starts by loading a static html file defined in the visualization’s config file.
galaxy.visualization.plugins.registry module¶
- Lower level of visualization framework which does three main things:
- associate visualizations with objects
- create urls to visualizations based on some target object(s)
- unpack a query string into the desired objects needed for rendering
-
class
galaxy.visualization.plugins.registry.
VisualizationsRegistry
(app, template_cache_dir=None, directories_setting=None, skip_bad_plugins=True, **kwargs)[source]¶ Bases:
object
- Main responsibilities are:
- discovering visualization plugins in the filesystem
- testing if an object has a visualization that can be applied to it
- generating a link to controllers.visualization.render with
- the appropriate params
- validating and parsing params into resources (based on a context)
- used in the visualization template
-
BASE_URL
= 'visualizations'¶ base url to controller endpoint
-
TEMPLATE_PATHS_CONFIG
= 'additional_template_paths.xml'¶ name of files to search for additional template lookup directories
-
BUILT_IN_VISUALIZATIONS
= ['trackster', 'circster', 'sweepster', 'phyloviz']¶ built-in visualizations
-
__init__
(app, template_cache_dir=None, directories_setting=None, skip_bad_plugins=True, **kwargs)[source]¶ Set up the manager and load all visualization plugins.
Parameters: - app (UniverseApplication) – the application (and its configuration) using this manager
- base_url (string) – url to prefix all plugin urls with
- template_cache_dir (string) – filesytem path to the directory where cached templates are kept
-
get_visualizations
(trans, target_object)[source]¶ Get the names of visualizations usable on the target_object and the urls to call in order to render the visualizations.
galaxy.visualization.plugins.resource_parser module¶
Deserialize Galaxy resources (hdas, ldas, datasets, genomes, etc.) from a dictionary of string data/ids (often from a query string).
-
class
galaxy.visualization.plugins.resource_parser.
ResourceParser
(app, *args, **kwargs)[source]¶ Bases:
object
Given a parameter dictionary (often a converted query string) and a configuration dictionary (curr. only VisualizationsRegistry uses this), convert the entries in the parameter dictionary into resources (Galaxy models, primitive types, lists of either, etc.) and return in a new dictionary.
The keys used to store the new values can optionally be re-mapped to new keys (e.g. dataset_id=”NNN” -> hda=<HistoryDatasetAssociation>).
-
primitive_parsers
= {'bool': <function <lambda> at 0x7fe8f52ddb18>, 'float': <type 'float'>, 'int': <type 'int'>, 'json': <function <lambda> at 0x7fe8f52ddb90>, 'str': <function <lambda> at 0x7fe8f52ddaa0>}¶
-
parse_parameter_dictionary
(trans, param_config_dict, query_params, param_modifiers=None)[source]¶ Parse all expected params from the query dictionary query_params.
If param is required and not present, raises a KeyError.
-
parse_config
(trans, param_config_dict, query_params)[source]¶ Return query_params dict parsing only JSON serializable params. Complex params such as models, etc. are left as the original query value. Keys in query_params not found in the param_config_dict will not be returned.
-
parse_parameter_modifiers
(trans, param_modifiers, query_params)[source]¶ Parse and return parameters that are meant to modify other parameters, be grouped with them, or are needed to successfully parse other parameters.
-
galaxy.visualization.plugins.utils module¶
Utilities for visualization plugins.
-
class
galaxy.visualization.plugins.utils.
OpenObject
[source]¶ Bases:
dict
A dict that allows assignment and attribute retrieval using the dot operator.
If an attribute isn’t contained in the dict None is returned (no KeyError). JSON-serializable.