This document is for an old release 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


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 the given XML file for visualizations data. :returns: visualization config dictionary


Parse the template, name, and any data_sources and params from the given xml_tree for a visualization.


Parse the config file for an appropriate entry point: a mako template, a script tag, or an html file, returning as dictionary with: type, file, and `attr`ibutes of the element.

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']

Return a visualization data_source dictionary parsed from the given XML element.


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.


Returns a list of test dictionaries that the registry can use against a given object to determine if the visualization can be used with the object.


Given a list of to_param elements, returns a dictionary that allows the registry to convert the data_source into one or more appropriate params for the visualization.

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.


Parse a visualization parameter from the given xml_tree.


Parse a param type from the given xml_tree.

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.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 number of templates to search for plugin template lookup


default encoding of plugin templates

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.

__init__(app, path, name, config, context=None, **kwargs)[source]
render(trans=None, embedded=None, **kwargs)[source]

Render and return the text of the non-saved plugin webpage/fragment.

render_saved(visualization, trans=None, embedded=None, **kwargs)[source]

Render and return the text of the plugin webpage/fragment using the config/data of a saved visualization.

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.


alias of galaxy.visualization.plugins.interactive_environments.InteractiveEnvironmentRequest

__init__(app, path, name, config, context=None, **kwargs)[source]
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:
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.

  • 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

Wrap to throw error if plugin not in registry.

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.

get_visualization(trans, visualization_name, target_object)[source]

Return data to build a url to the visualization with the given visualization_name if it’s applicable to target_object or None if it’s not.

is_object_applicable(trans, target_object, data_source_tests)[source]

Run a visualization’s data_source tests to find out if it can be applied to the target_object.

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 0x7f6a5cf2acf8>, 'float': <type 'float'>, 'int': <type 'int'>, 'json': <function <lambda> at 0x7f6a5cf2ad70>, 'str': <function <lambda> at 0x7f6a5cf2ac80>}
__init__(app, *args, **kwargs)[source]
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.

parse_parameter_default(trans, param_config)[source]

Parse any default values for the given param, defaulting the default to None.

parse_parameter(trans, expected_param_data, query_param, recurse=True, param_modifiers=None)[source]

Use data in expected_param_data to parse query_param from a string into a resource usable directly by a template.

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.

galaxy.visualization.plugins.utils.getattr_recursive(item, attr_key, *args)[source]

Allows dot member notation in attribute name when getting an item’s attribute.

NOTE: also searches dictionaries

galaxy.visualization.plugins.utils.hasattr_recursive(item, attr_key)[source]

Allows dot member notation in attribute name when getting an item’s attribute.

NOTE: also searches dictionaries