commit/galaxy-central: jgoecks: Refactoring and bug fixes for visualization framework.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/19ed55acf0da/ changeset: 19ed55acf0da user: jgoecks date: 2012-06-14 21:00:30 summary: Refactoring and bug fixes for visualization framework. affected #: 3 files diff -r b761471d759097f03c0fb904e9543f02ed5096c9 -r 19ed55acf0da8e8ed24f805035defab3009eec4f lib/galaxy/web/api/tools.py --- a/lib/galaxy/web/api/tools.py +++ b/lib/galaxy/web/api/tools.py @@ -1,12 +1,11 @@ -from galaxy import config, tools, web, util -from galaxy.web.base.controller import BaseController, BaseAPIController, UsesHistoryDatasetAssociationMixin, messages, get_highest_priority_msg -from galaxy.util.bunch import Bunch +from galaxy import web, util +from galaxy.web.base.controller import BaseAPIController, UsesHistoryDatasetAssociationMixin, UsesVisualizationMixin, messages, get_highest_priority_msg from galaxy.visualization.tracks.visual_analytics import get_dataset_job from galaxy.visualization.genomes import GenomeRegion from galaxy.util.json import to_json_string, from_json_string from galaxy.visualization.tracks.data_providers import * -class ToolsController( BaseAPIController, UsesHistoryDatasetAssociationMixin ): +class ToolsController( BaseAPIController, UsesHistoryDatasetAssociationMixin, UsesVisualizationMixin ): """ RESTful controller for interactions with tools. """ @@ -160,9 +159,12 @@ if not tool: return messages.NO_TOOL tool_params = dict( [ ( p.name, p.value ) for p in original_job.parameters ] ) + + # TODO: rather than set new inputs using dict of json'ed value, unpack parameters and set using set_param_value below. # TODO: need to handle updates to conditional parameters; conditional # params are stored in dicts (and dicts within dicts). - tool_params.update( dict( [ ( key, value ) for key, value in kwargs.items() if key in tool.inputs ] ) ) + new_inputs = payload[ 'inputs' ] + tool_params.update( dict( [ ( key, to_json_string( value ) ) for key, value in new_inputs.items() if key in tool.inputs and new_inputs[ key ] is not None ] ) ) tool_params = tool.params_from_strings( tool_params, self.app ) # @@ -355,5 +357,7 @@ for joda in subset_job.output_datasets: if joda.name == output_name: output_dataset = joda.dataset - - return output_dataset.get_api_value() + + dataset_dict = output_dataset.get_api_value() + dataset_dict[ 'track_config' ] = self.get_new_track_config( trans, output_dataset ); + return dataset_dict diff -r b761471d759097f03c0fb904e9543f02ed5096c9 -r 19ed55acf0da8e8ed24f805035defab3009eec4f lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -542,6 +542,32 @@ return config + def get_new_track_config( self, trans, dataset ): + """ + Returns track configuration dict for a dataset. + """ + # Get data provider. + track_type, _ = dataset.datatype.get_track_type() + track_data_provider_class = get_data_provider( original_dataset=dataset ) + track_data_provider = track_data_provider_class( original_dataset=dataset ) + + if isinstance( dataset, trans.app.model.HistoryDatasetAssociation ): + hda_ldda = "hda" + elif isinstance( dataset, trans.app.model.LibraryDatasetDatasetAssociation ): + hda_ldda = "ldda" + + # Get track definition. + return { + "track_type": track_type, + "name": dataset.name, + "hda_ldda": hda_ldda, + "dataset_id": trans.security.encode_id( dataset.id ), + "prefs": {}, + "filters": { 'filters' : track_data_provider.get_filters() }, + "tool": get_tool_def( trans, dataset ), + "tool_state": {} + } + def get_hda_or_ldda( self, trans, hda_ldda, dataset_id ): """ Returns either HDA or LDDA for hda/ldda and id combination. """ if hda_ldda == "hda": diff -r b761471d759097f03c0fb904e9543f02ed5096c9 -r 19ed55acf0da8e8ed24f805035defab3009eec4f lib/galaxy/web/controllers/tracks.py --- a/lib/galaxy/web/controllers/tracks.py +++ b/lib/galaxy/web/controllers/tracks.py @@ -186,22 +186,7 @@ dataset_id = ldda_id dataset = self.get_hda_or_ldda( trans, hda_ldda, dataset_id ) - # Get data provider. - track_type, _ = dataset.datatype.get_track_type() - track_data_provider_class = get_data_provider( original_dataset=dataset ) - track_data_provider = track_data_provider_class( original_dataset=dataset ) - - # Get track definition. - return { - "track_type": track_type, - "name": dataset.name, - "hda_ldda": hda_ldda, - "dataset_id": trans.security.encode_id( dataset.id ), - "prefs": {}, - "filters": { 'filters' : track_data_provider.get_filters() }, - "tool": get_tool_def( trans, dataset ), - "tool_state": {} - } + return self.get_new_track_config( trans, dataset ) @web.json def bookmarks_from_dataset( self, trans, hda_id=None, ldda_id=None ): 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)
-
Bitbucket