commit/galaxy-central: carlfeberhard: Visualizations registry: break visualizations_conf.xml into one xml file per visualization and place in config/visualizations
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/91de48b4fd3b/ Changeset: 91de48b4fd3b User: carlfeberhard Date: 2013-07-18 21:52:38 Summary: Visualizations registry: break visualizations_conf.xml into one xml file per visualization and place in config/visualizations Affected #: 12 files diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 config/visualizations/circster.xml --- /dev/null +++ b/config/visualizations/circster.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE visualization SYSTEM "visualization.dtd"> +<visualization name="circster"> + <data_sources> + <data_source> + <model_class>HistoryDatasetAssociation</model_class> + <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <to_param param_attr="id">dataset_id</to_param> + <to_param assign="hda">hda_ldda</to_param> + </data_source> + <data_source> + <model_class>LibraryDatasetDatasetAssociation</model_class> + <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <to_param param_attr="id">dataset_id</to_param> + <to_param assign="ldda">hda_ldda</to_param> + </data_source> + </data_sources> + <params> + <param type="visualization">id</param> + <param type="hda_or_ldda">dataset_id</param> + <param_modifier type="string" modifies="dataset_id">hda_ldda</param_modifier> + <param type="dbkey">dbkey</param> + </params> + <template>circster.mako</template> + <render_location>_top</render_location> +</visualization> diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 config/visualizations/example.xml.example --- /dev/null +++ b/config/visualizations/example.xml.example @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE visualization SYSTEM "visualization.dtd"> +<visualization name="test"> + <data_sources> + <data_source> + <model_class>HistoryDatasetAssociation</model_class> + <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <to_param param_attr="id">dataset_id</to_param> + <to_param assign="bler">string</to_param> + <to_param assign="False">boolean</to_param> + <to_param assign="-5">integer</to_param> + <to_param assign="3.14">float</to_param> + <to_param assign="{}">json</to_param> + </data_source> + </data_sources> + <params> + <param>default</param> + <param type="str">string</param> + <param type="bool">boolean</param> + <param type="int">integer</param> + <param type="float">float</param> + <param type="json">json</param> + <param type="str" required="true">string</param> + <param type="visualization" var_name_in_template="visualization">visualization_id</param> + <param type="dataset" var_name_in_template="dataset">dataset_id</param> + <param type="hda_or_ldda">dataset_instance</param> + <param_modifier type="str" modifies="dataset_instance">hda_ldda</param_modifier> + </params> + <template>v_fwork_test.mako</template> +</visualization> diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 config/visualizations/phyloviz.xml --- /dev/null +++ b/config/visualizations/phyloviz.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE visualization SYSTEM "visualization.dtd"> +<visualization name="phyloviz"> + <data_sources> + <data_source> + <model_class>HistoryDatasetAssociation</model_class> + <test type="isinstance" test_attr="datatype" result_type="datatype">data.Newick</test> + <test type="isinstance" test_attr="datatype" result_type="datatype">data.Nexus</test> + <to_param param_attr="id">dataset_id</to_param> + </data_source> + </data_sources> + <params> + <param type="dataset" var_name_in_template="hda" required="true">dataset_id</param> + <param type="integer" default="0">tree_index</param> + </params> + <template>phyloviz.mako</template> + <render_location>_top</render_location> +</visualization> diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 config/visualizations/scatterplot.xml --- /dev/null +++ b/config/visualizations/scatterplot.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE visualization SYSTEM "visualization.dtd"> +<visualization name="scatterplot"> + <data_sources> + <data_source> + <model_class>HistoryDatasetAssociation</model_class> + <test type="isinstance" test_attr="datatype" result_type="datatype">tabular.Tabular</test> + <to_param param_attr="id">dataset_id</to_param> + </data_source> + </data_sources> + <params> + <param type="dataset" var_name_in_template="hda" required="true">dataset_id</param> + <param required="true">bler</param> + </params> + <template>scatterplot.mako</template> +</visualization> diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 config/visualizations/sweepster.xml --- /dev/null +++ b/config/visualizations/sweepster.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE visualization SYSTEM "visualization.dtd"> +<visualization name="sweepster"> + <data_sources> + <data_source> + <model_class>HistoryDatasetAssociation</model_class> + <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <to_param param_attr="id">dataset_id</to_param> + <to_param assign="hda">hda_ldda</to_param> + </data_source> + <data_source> + <model_class>LibraryDatasetDatasetAssociation</model_class> + <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <to_param param_attr="id">dataset_id</to_param> + <to_param assign="ldda">hda_ldda</to_param> + </data_source> + </data_sources> + <params> + <param type="visualization" var_name_in_template="viz">visualization</param> + <param type="hda_or_ldda" var_name_in_template="dataset">dataset_id</param> + <param_modifier type="string" modifies="dataset_id">hda_ldda</param_modifier> + </params> + <template>sweepster.mako</template> + <render_location>_top</render_location> +</visualization> diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 config/visualizations/trackster.xml --- /dev/null +++ b/config/visualizations/trackster.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE visualization SYSTEM "visualization.dtd"> +<visualization name="trackster"> + <!--not tested yet --> + <data_sources> + <data_source> + <model_class>HistoryDatasetAssociation</model_class> + <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <to_param param_attr="id">dataset_id</to_param> + <to_param assign="hda">hda_ldda</to_param> + <to_param param_attr="dbkey">dbkey</to_param> + </data_source> + <data_source> + <model_class>LibraryDatasetDatasetAssociation</model_class> + <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <to_param param_attr="id">dataset_id</to_param> + <to_param assign="ldda">hda_ldda</to_param> + </data_source> + </data_sources> + <params> + <param type="visualization">id</param> + <param type="dataset">dataset_id</param> + <param type="genome_region">genome_region</param> + <param type="dbkey">dbkey</param> + </params> + <template_root>tracks</template_root> + <template>browser.mako</template> + <render_location>_top</render_location> +</visualization> diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 config/visualizations/visualization.dtd --- /dev/null +++ b/config/visualizations/visualization.dtd @@ -0,0 +1,132 @@ +<!-- runnable on NIX with xmllint --> + +<!-- each visualization must have a template (all other elements are optional) --> +<!ELEMENT visualization (data_sources*,params*,template_root*,template,link_text*,render_location*)> +<!-- visualization name (e.g. 'trackster', 'scatterplot', etc.) is required --> +<!ATTLIST visualization + name CDATA #REQUIRED +> + +<!ELEMENT data_sources (data_source*)> +<!-- data sources are elements that describe what objects (HDAs, LDDAs, Job, User, etc.) + are applicable to a visualization. Often these are used to fetch applicable links + to the visualizations that use them. +--> + <!ELEMENT data_source (model_class,(test|to_param)*)> + <!ELEMENT model_class (#PCDATA)> + <!-- model_class is currently the class name of the object you want to make a visualization + applicable to (e.g. HistoryDatasetAssociation). Currently only classes in galaxy.model + can be used. + REQUIRED and currently limited to: 'HistoryDatasetAssociation', 'LibraryDatasetDatasetAssociation' + --> + <!ELEMENT test (#PCDATA)> + <!-- tests help define what conditions the visualization can be applied to the model_class/target. + Currently, all tests are OR'd and there is no logical grouping. Tests are run in order. + (text): the text of this element is what the given target will be compared to (REQUIRED) + type: what type of test to run (e.g. when the target is an HDA the test will often be of type 'isinstance' + and test whether the HDA's datatype isinstace of a class) + DEFAULT: string comparison. + test_attr: what attribute of the target object should be used in the test. For instance, 'datatype' + will attempt to get the HDA.datatype from a target HDA. If the given object doesn't have + that attribute the test will fail (with no error). test_attr can be dot separated attributes, + looking up each in turn. For example, if the target was a history, one could access the + history.user.email by setting test_attr to 'user.email' (why you would want that, I don't know) + DEFAULT: to comparing the object itself (and not any of it's attributes) + result_type: if the result (the text of the element mentioned above) needs to be parsed into + something other than a string, result_type will tell the registry how to do this. E.g. + if result_type is 'datatype' the registry will assume the text is a datatype class name + and parse it into the proper class before the test (often 'isinstance') is run. + DEFAULT: no parsing (result should be a string) + --> + <!ATTLIST test + type CDATA #IMPLIED + test_attr CDATA #IMPLIED + result_type CDATA #IMPLIED + > + + <!ELEMENT to_param (#PCDATA)> + <!-- to_param tells the registry how to parse the data_source into a query string param. + For example, HDA data_sources can set param_to text to 'dataset_id' and param_attr to 'id' and the + the target HDA (if it passes the tests) will be passed as "dataset_id=HDA.id" + (text): the query string param key this source will be parsed into (e.g. dataset_id) + REQUIRED + param_attr: the attribute of the data_source object to use as the value in the query string param. + E.g. param_attr='id' for an HDA data_source would use the (encoded) id. + NOTE: a to_param MUST have either a param_attr or assign + assign: you can use this to directly assign a value to a query string's param. E.g. if the + data_source is a LDDA we can set 'hda_or_ldda=ldda' using assign='ldda'. + NOTE: a to_param MUST have either a param_attr or assign + --> + <!ATTLIST to_param + param_attr CDATA #IMPLIED + assign CDATA #IMPLIED + > + +<!ELEMENT params ((param|param_modifier)*)> +<!-- params describe what data will be sent to a visualization template and + how to convert them from a query string in a URL into variables usable in a template. + For example, + param_modifiers are a special class of parameters that modify other params + (e.g. hda_ldda can be 'hda' or 'ldda' and modifies/informs dataset_id to fetch an HDA or LDDA) +--> + <!ELEMENT param (#PCDATA)> + <!-- param tells the registry how to parse the query string param back into a resource/data_source. + For example, if a query string has "dataset_id=NNN" and the type is 'dataset', the registry + will attempt to fetch the hda with id of NNN from the database and pass it to the template. + (text): the query string param key this source will be parsed from (e.g. dataset_id) + REQUIRED + type: the type of the resource. + Can be: str (DEFAULT), bool, int, float, json, visualization, dbkey, dataset, or hda_ldda. + default: if a param is not passed on the query string (and is not required) OR the given param + fails to parse, this value is used instead. + DEFAULT: None + required: set this to true if the param is required for the template. Rendering will with an error + if the param hasn't been sent. + DEFAULT: false + csv: set this to true if the param is a comma separated list. The registry will attempt to + parse each value as the given type and send the result as a list to the template. + DEFAULT: false + constrain_to: (currently unused) constain a param to a set of values, error if not valid. + DEFAULT: don't constrain + var_name_in_template: a new name for the resource/variable to use in the template. E.g. an initial + query string param key might be 'dataset_id' in the URL, the registry parses it into an HDA, + and if var_name_in_template is set to 'hda', the template will be able to access the HDA + with the variable name 'hda' (as in hda.title). + DEFAULT: keep the original query string name + --> + <!ATTLIST param + type CDATA #IMPLIED + default CDATA #IMPLIED + required CDATA #IMPLIED + csv CDATA #IMPLIED + constrain_to CDATA #IMPLIED + var_name_in_template CDATA #IMPLIED + > + <!-- param_modifiers are the same as param but have a REQUIRED 'modifies' attribute. + 'modifies' must point to the param name (the text part of param element) that it will modify. + E.g. <param_modifier modifies="dataset_id">hda_ldda</param_modifier> + --> + <!ELEMENT param_modifier (#PCDATA)> + <!ATTLIST param_modifier + modifies CDATA #REQUIRED + type CDATA #IMPLIED + default CDATA #IMPLIED + required CDATA #IMPLIED + csv CDATA #IMPLIED + constrain_to CDATA #IMPLIED + var_name_in_template CDATA #IMPLIED + > + +<!-- template_root: the directory to search for the template relative to templates/webapps/galaxy + (optional) DEFAULT: visualizations +--> +<!ELEMENT template_root (#PCDATA)> +<!-- template: the template used to render the visualization. REQUIRED --> +<!ELEMENT template (#PCDATA)> +<!-- link_text: the text component of an html anchor displayed when the registry builds the link information --> +<!ELEMENT link_text (#PCDATA)> +<!-- render_location: used as the target attribute of the link to the visualization. + Can be 'galaxy_main', '_top', '_blank'. DEFAULT: 'galaxy_main' +--> +<!-- TODO: rename -> render_target --> +<!ELEMENT render_location (#PCDATA)> diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 lib/galaxy/app.py --- a/lib/galaxy/app.py +++ b/lib/galaxy/app.py @@ -123,8 +123,10 @@ # Load genome indexer tool. load_genome_index_tools( self.toolbox ) # visualizations registry: associates resources with visualizations, controls how to render - self.visualizations_registry = ( VisualizationsRegistry( self.config.root, self.config.visualizations_conf_path ) - if self.config.visualizations_conf_path else None ) + self.visualizations_registry = None + if self.config.visualizations_config_directory: + self.visualizations_registry = VisualizationsRegistry( self.config.root, + self.config.visualizations_config_directory ) # Load security policy. self.security_agent = self.model.security_agent self.host_security_agent = galaxy.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions ) diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 lib/galaxy/config.py --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -288,8 +288,8 @@ self.fluent_log = string_as_bool( kwargs.get( 'fluent_log', False ) ) self.fluent_host = kwargs.get( 'fluent_host', 'localhost' ) self.fluent_port = int( kwargs.get( 'fluent_port', 24224 ) ) - # visualizations registry config path - self.visualizations_conf_path = kwargs.get( 'visualizations_conf_path', None ) + # visualization registries config directory + self.visualizations_config_directory = kwargs.get( 'visualizations_config_directory', None ) @property def sentry_dsn_public( self ): diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 lib/galaxy/visualization/registry.py --- a/lib/galaxy/visualization/registry.py +++ b/lib/galaxy/visualization/registry.py @@ -6,6 +6,7 @@ """ import os import shutil +import glob from galaxy import util import galaxy.model @@ -26,6 +27,7 @@ some confused vocabulary in docs, var names tests: anding, grouping, not + has_dataprovider data_sources: lists of add description element to visualization. @@ -62,10 +64,9 @@ return 'VisualizationsRegistry(%s)' %( listings_keys_str ) def __init__( self, galaxy_root, configuration_filepath ): - # load the registry from the given xml file using the given parser + # load the registry from the xml files located in configuration_filepath using the given parser configuration_filepath = os.path.join( galaxy_root, configuration_filepath ) - configuration_filepath = self.check_conf_filepath( configuration_filepath ) - self.configuration_filepath = configuration_filepath + self.configuration_filepath = self.check_conf_filepath( configuration_filepath ) self.load() # what to use to parse query strings into resources/vars for the template @@ -73,20 +74,13 @@ def check_conf_filepath( self, configuration_filepath ): """ - If given file at filepath exists, return that filepath. If not, - see if filepath + '.sample' exists and, if so, copy that into filepath. - - If neither original or sample exist, throw an IOError (currently, - this is a requireed file). + Checks for the existence of the given filepath. + :param configurarion_filepath: full filepath to the visualization config directory + :raises IOError: if the given directory doesn't exist """ - if os.path.exists( configuration_filepath ): - return configuration_filepath - else: - sample_file = configuration_filepath + '.sample' - if os.path.exists( sample_file ): - shutil.copy2( sample_file, configuration_filepath ) - return configuration_filepath - raise IOError( 'visualization configuration file (%s) not found' %( configuration_filepath ) ) + if not os.path.exists( configuration_filepath ): + raise IOError( 'visualization configuration directory (%s) not found' %( configuration_filepath ) ) + return configuration_filepath def load( self ): """ @@ -274,11 +268,11 @@ VALID_RENDER_LOCATIONS = [ 'galaxy_main', '_top', '_blank' ] @classmethod - def parse( cls, xml_filepath, debug=True ): + def parse( cls, config_dir, debug=True ): """ - Static class interface + Static class interface. """ - return cls( debug ).parse_file( xml_filepath ) + return cls( debug ).parse_files( config_dir ) def __init__( self, debug=False ): self.debug = debug @@ -288,38 +282,47 @@ self.param_parser = ParamParser() self.param_modifier_parser = ParamModifierParser() - def parse_file( self, xml_filepath ): + def parse_files( self, config_dir ): """ - Parse the given XML file for visualizations data. + Parse each XML file in `config_dir` for visualizations config data. - If an error occurs while parsing a visualizations entry it is skipped. + If an error occurs while parsing a visualizations entry, it is skipped. + :returns: registry data in dictionary form """ returned = {} try: - xml_tree = galaxy.util.parse_xml( xml_filepath ) - for visualization_conf in xml_tree.getroot().findall( 'visualization' ): - visualization = None - visualization_name = visualization_conf.get( 'name' ) - + for xml_filepath in glob.glob( os.path.join( config_dir, '*.xml' ) ): try: - visualization = self.parse_visualization( visualization_conf ) + visualization_name, visualization = self.parse_file( xml_filepath ) # skip vis' with parsing errors - don't shutdown the startup except ParsingException, parse_exc: - log.error( 'Skipped visualization configuration "%s" due to parsing errors: %s', - visualization_name, str( parse_exc ), exc_info=self.debug ) + log.error( 'Skipped visualization config "%s" due to parsing errors: %s', + xml_filepath, str( parse_exc ), exc_info=self.debug ) if visualization: returned[ visualization_name ] = visualization + log.debug( 'Visualization config loaded for: %s', visualization_name ) except Exception, exc: - log.error( 'Error parsing visualization configuration file %s: %s', - xml_filepath, str( exc ), exc_info=( not self.debug ) ) - #TODO: change when this is required + log.error( 'Error parsing visualizations configuration directory %s: %s', + config_dir, str( exc ), exc_info=( not self.debug ) ) + #TODO: change when this framework is on by default if self.debug: raise return returned + def parse_file( self, xml_filepath ): + """ + Parse the given XML file for visualizations data. + :returns: tuple of ( `visualization_name`, `visualization` ) + """ + xml_tree = galaxy.util.parse_xml( xml_filepath ) + visualization_conf = xml_tree.getroot() + visualization_name = visualization_conf.get( 'name' ) + visualization = self.parse_visualization( visualization_conf ) + return visualization_name, visualization + def parse_visualization( self, xml_tree ): """ Parse the template, name, and any data_sources and params from the diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 universe_wsgi.ini.sample --- a/universe_wsgi.ini.sample +++ b/universe_wsgi.ini.sample @@ -174,9 +174,10 @@ # Galaxy. #datatypes_config_file = datatypes_conf.xml -# Visualizations config file, defines what visualizations apply to particular data and how to pass them -# the necessary parameters -#visualizations_conf_path = visualizations_conf.xml +# Visualizations config directory, where to look for individual visualization +# xml configuration files. Those files define how visualizations apply to +# particular data and how to pass them the necessary parameters +visualizations_config_directory = config/visualizations # Each job is given a unique empty directory as its current working directory. # This option defines in what parent directory those directories will be diff -r 3422736c168d6d864ec3c478d3e725b1184e3778 -r 91de48b4fd3b5628d5a434f68bd6cf2473ad62c3 visualizations_conf.xml.sample --- a/visualizations_conf.xml.sample +++ /dev/null @@ -1,292 +0,0 @@ -<?xml version="1.0"?> -<!-- - This is the xml file to edit to add new visualizations to the framework. - NOTE!: this is a work in progress! - - Note: also that visualizations that fail to parse in visualizations/registry will - produce an error in the server log, but otherwise will be skipped and not available. - If you can't find your visualization in the UI, check the server logs for errors - during start up. ---> - -<!-- .......................................................................... DTD --> -<!-- runnable on NIX with xmllint --> -<!DOCTYPE visualizations [ - <!-- 0 or more visualizations --> - <!ELEMENT visualizations (visualization*)> - <!-- each visualization must have a template (all other elements are optional) --> - <!ELEMENT visualization (data_sources*,params*,template_root*,template,link_text*,render_location*)> - <!-- visualization name (e.g. 'trackster', 'scatterplot', etc.) is required --> - <!ATTLIST visualization - name CDATA #REQUIRED - > - - <!ELEMENT data_sources (data_source*)> - <!-- data sources are elements that describe what objects (HDAs, LDDAs, Job, User, etc.) - are applicable to a visualization. Often these are used to fetch applicable links - to the visualizations that use them. - --> - <!ELEMENT data_source (model_class,(test|to_param)*)> - <!ELEMENT model_class (#PCDATA)> - <!-- model_class is currently the class name of the object you want to make a visualization - applicable to (e.g. HistoryDatasetAssociation). Currently only classes in galaxy.model - can be used. - REQUIRED and currently limited to: 'HistoryDatasetAssociation', 'LibraryDatasetDatasetAssociation' - --> - <!ELEMENT test (#PCDATA)> - <!-- tests help define what conditions the visualization can be applied to the model_class/target. - Currently, all tests are OR'd and there is no logical grouping. Tests are run in order. - (text): the text of this element is what the given target will be compared to (REQUIRED) - type: what type of test to run (e.g. when the target is an HDA the test will often be of type 'isinstance' - and test whether the HDA's datatype isinstace of a class) - DEFAULT: string comparison. - test_attr: what attribute of the target object should be used in the test. For instance, 'datatype' - will attempt to get the HDA.datatype from a target HDA. If the given object doesn't have - that attribute the test will fail (with no error). test_attr can be dot separated attributes, - looking up each in turn. For example, if the target was a history, one could access the - history.user.email by setting test_attr to 'user.email' (why you would want that, I don't know) - DEFAULT: to comparing the object itself (and not any of it's attributes) - result_type: if the result (the text of the element mentioned above) needs to be parsed into - something other than a string, result_type will tell the registry how to do this. E.g. - if result_type is 'datatype' the registry will assume the text is a datatype class name - and parse it into the proper class before the test (often 'isinstance') is run. - DEFAULT: no parsing (result should be a string) - --> - <!ATTLIST test - type CDATA #IMPLIED - test_attr CDATA #IMPLIED - result_type CDATA #IMPLIED - > - - <!ELEMENT to_param (#PCDATA)> - <!-- to_param tells the registry how to parse the data_source into a query string param. - For example, HDA data_sources can set param_to text to 'dataset_id' and param_attr to 'id' and the - the target HDA (if it passes the tests) will be passed as "dataset_id=HDA.id" - (text): the query string param key this source will be parsed into (e.g. dataset_id) - REQUIRED - param_attr: the attribute of the data_source object to use as the value in the query string param. - E.g. param_attr='id' for an HDA data_source would use the (encoded) id. - NOTE: a to_param MUST have either a param_attr or assign - assign: you can use this to directly assign a value to a query string's param. E.g. if the - data_source is a LDDA we can set 'hda_or_ldda=ldda' using assign='ldda'. - NOTE: a to_param MUST have either a param_attr or assign - --> - <!ATTLIST to_param - param_attr CDATA #IMPLIED - assign CDATA #IMPLIED - > - - <!ELEMENT params ((param|param_modifier)*)> - <!-- params describe what data will be sent to a visualization template and - how to convert them from a query string in a URL into variables usable in a template. - For example, - param_modifiers are a special class of parameters that modify other params - (e.g. hda_ldda can be 'hda' or 'ldda' and modifies/informs dataset_id to fetch an HDA or LDDA) - --> - <!ELEMENT param (#PCDATA)> - <!-- param tells the registry how to parse the query string param back into a resource/data_source. - For example, if a query string has "dataset_id=NNN" and the type is 'dataset', the registry - will attempt to fetch the hda with id of NNN from the database and pass it to the template. - (text): the query string param key this source will be parsed from (e.g. dataset_id) - REQUIRED - type: the type of the resource. - Can be: str (DEFAULT), bool, int, float, json, visualization, dbkey, dataset, or hda_ldda. - default: if a param is not passed on the query string (and is not required) OR the given param - fails to parse, this value is used instead. - DEFAULT: None - required: set this to true if the param is required for the template. Rendering will with an error - if the param hasn't been sent. - DEFAULT: false - csv: set this to true if the param is a comma separated list. The registry will attempt to - parse each value as the given type and send the result as a list to the template. - DEFAULT: false - constrain_to: (currently unused) constain a param to a set of values, error if not valid. - DEFAULT: don't constrain - var_name_in_template: a new name for the resource/variable to use in the template. E.g. an initial - query string param key might be 'dataset_id' in the URL, the registry parses it into an HDA, - and if var_name_in_template is set to 'hda', the template will be able to access the HDA - with the variable name 'hda' (as in hda.title). - DEFAULT: keep the original query string name - --> - <!ATTLIST param - type CDATA #IMPLIED - default CDATA #IMPLIED - required CDATA #IMPLIED - csv CDATA #IMPLIED - constrain_to CDATA #IMPLIED - var_name_in_template CDATA #IMPLIED - > - <!-- param_modifiers are the same as param but have a REQUIRED 'modifies' attribute. - 'modifies' must point to the param name (the text part of param element) that it will modify. - E.g. <param_modifier modifies="dataset_id">hda_ldda</param_modifier> - --> - <!ELEMENT param_modifier (#PCDATA)> - <!ATTLIST param_modifier - modifies CDATA #REQUIRED - type CDATA #IMPLIED - default CDATA #IMPLIED - required CDATA #IMPLIED - csv CDATA #IMPLIED - constrain_to CDATA #IMPLIED - var_name_in_template CDATA #IMPLIED - > - - <!-- template_root: the directory to search for the template relative to templates/webapps/galaxy - (optional) DEFAULT: visualizations - --> - <!ELEMENT template_root (#PCDATA)> - <!-- template: the template used to render the visualization. REQUIRED --> - <!ELEMENT template (#PCDATA)> - <!-- link_text: the text component of an html anchor displayed when the registry builds the link information --> - <!ELEMENT link_text (#PCDATA)> - <!-- render_location: used as the target attribute of the link to the visualization. - Can be 'galaxy_main', '_top', '_blank'. DEFAULT: 'galaxy_main' - --> - <!-- TODO: rename -> render_target --> - <!ELEMENT render_location (#PCDATA)> -]> - -<!-- .......................................................................... configuration xml --> -<visualizations> - <visualization name="trackster"> - <!--not tested yet --> - <data_sources> - <data_source> - <model_class>HistoryDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> - <to_param param_attr="id">dataset_id</to_param> - <to_param assign="hda">hda_ldda</to_param> - <to_param param_attr="dbkey">dbkey</to_param> - </data_source> - <data_source> - <model_class>LibraryDatasetDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> - <to_param param_attr="id">dataset_id</to_param> - <to_param assign="ldda">hda_ldda</to_param> - </data_source> - </data_sources> - <params> - <param type="visualization">id</param> - <param type="dataset">dataset_id</param> - <param type="genome_region">genome_region</param> - <param type="dbkey">dbkey</param> - </params> - <template_root>tracks</template_root> - <template>browser.mako</template> - <render_location>_top</render_location> - </visualization> - - <visualization name="circster"> - <data_sources> - <data_source> - <model_class>HistoryDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> - <to_param param_attr="id">dataset_id</to_param> - <to_param assign="hda">hda_ldda</to_param> - </data_source> - <data_source> - <model_class>LibraryDatasetDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> - <to_param param_attr="id">dataset_id</to_param> - <to_param assign="ldda">hda_ldda</to_param> - </data_source> - </data_sources> - <params> - <param type="visualization">id</param> - <param type="hda_or_ldda">dataset_id</param> - <param_modifier type="string" modifies="dataset_id">hda_ldda</param_modifier> - <param type="dbkey">dbkey</param> - </params> - <template>circster.mako</template> - <render_location>_top</render_location> - </visualization> - - <!-- - <visualization name="sweepster"> - <data_sources> - <data_source> - <model_class>HistoryDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> - <to_param param_attr="id">dataset_id</to_param> - <to_param assign="hda">hda_ldda</to_param> - </data_source> - <data_source> - <model_class>LibraryDatasetDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> - <to_param param_attr="id">dataset_id</to_param> - <to_param assign="ldda">hda_ldda</to_param> - </data_source> - </data_sources> - <params> - <param type="visualization" var_name_in_template="viz">visualization</param> - <param type="hda_or_ldda" var_name_in_template="dataset">dataset_id</param> - <param_modifier type="string" modifies="dataset_id">hda_ldda</param_modifier> - </params> - <template>sweepster.mako</template> - <render_location>_top</render_location> - </visualization> - --> - - <visualization name="phyloviz"> - <data_sources> - <data_source> - <model_class>HistoryDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Newick</test> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Nexus</test> - <to_param param_attr="id">dataset_id</to_param> - </data_source> - </data_sources> - <params> - <param type="dataset" var_name_in_template="hda" required="true">dataset_id</param> - <param type="integer" default="0">tree_index</param> - </params> - <template>phyloviz.mako</template> - <render_location>_top</render_location> - </visualization> - - <visualization name="scatterplot"> - <data_sources> - <data_source> - <model_class>HistoryDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">tabular.Tabular</test> - <to_param param_attr="id">dataset_id</to_param> - </data_source> - </data_sources> - <params> - <param type="dataset" var_name_in_template="hda" required="true">dataset_id</param> - </params> - <template>scatterplot.mako</template> - </visualization> - - <!-- - <visualization name="test"> - <data_sources> - <data_source> - <model_class>HistoryDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> - <to_param param_attr="id">dataset_id</to_param> - <to_param assign="bler">string</to_param> - <to_param assign="False">boolean</to_param> - <to_param assign="-5">integer</to_param> - <to_param assign="3.14">float</to_param> - <to_param assign="{}">json</to_param> - </data_source> - </data_sources> - <params> - <param>default</param> - <param type="str">string</param> - <param type="bool">boolean</param> - <param type="int">integer</param> - <param type="float">float</param> - <param type="json">json</param> - <param type="str" required="true">string</param> - <param type="visualization" var_name_in_template="visualization">visualization_id</param> - <param type="dataset" var_name_in_template="dataset">dataset_id</param> - <param type="hda_or_ldda">dataset_instance</param> - <param_modifier type="str" modifies="dataset_instance">hda_ldda</param_modifier> - </params> - <template>v_fwork_test.mako</template> - </visualization> - --> - -</visualizations> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org