galaxy.visualization.plugins package
Submodules
galaxy.visualization.plugins.config_parser module
- exception galaxy.visualization.plugins.config_parser.ParsingException[source]
Bases:
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:
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_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:
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.ScriptVisualizationPlugin(app, path, name, config, context=None, **kwargs)[source]
Bases:
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:
ScriptVisualizationPlugin
- MAKO_TEMPLATE = 'chart_entry_point.mako'
- class galaxy.visualization.plugins.plugin.StaticFileVisualizationPlugin(app, path, name, config, context=None, **kwargs)[source]
Bases:
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 (galaxy.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: Dict[str, Callable[[str], int | float | str]] = {'bool': <function ResourceParser.<lambda>>, 'float': <class 'float'>, 'int': <class 'int'>, 'json': <function ResourceParser.<lambda>>, 'str': <function ResourceParser.<lambda>>}
- 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) Dict[str, Dict[str, int | float | str | HistoryDatasetAssociation | LibraryDatasetDatasetAssociation | Visualization | None]] [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) int | float | str | HistoryDatasetAssociation | LibraryDatasetDatasetAssociation | Visualization | None [source]
Parse any default values for the given param, defaulting the default to None.
galaxy.visualization.plugins.utils module
Utilities for visualization plugins.