commit/galaxy-central: jgoecks: Create and use mixin method for getting dataset's genome data.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/220b6683e8da/ changeset: 220b6683e8da user: jgoecks date: 2012-10-10 05:49:01 summary: Create and use mixin method for getting dataset's genome data. affected #: 4 files diff -r 3231b9ca8d82219cbef87cfeb4fc57013c11f3c5 -r 220b6683e8dad3028939ff6e5a7acd76d9e994b1 lib/galaxy/visualization/data_providers/genome.py --- a/lib/galaxy/visualization/data_providers/genome.py +++ b/lib/galaxy/visualization/data_providers/genome.py @@ -186,7 +186,6 @@ chrom_data = self.get_data( chrom, 0, chrom_len, **kwargs ) if chrom_data: chrom_data[ 'region' ] = "%s:%i-%i" % ( chrom, 0, chrom_len ) - chrom_data[ 'dataset_type' ] = self.dataset_type genome_data.append( chrom_data ) return { diff -r 3231b9ca8d82219cbef87cfeb4fc57013c11f3c5 -r 220b6683e8dad3028939ff6e5a7acd76d9e994b1 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -602,6 +602,33 @@ return visualization + def _get_genome_data( self, trans, dataset, dbkey=None ): + """ + Returns genome-wide data for dataset if available; if not, message is returned. + """ + rval = None + + # Get data sources. + data_sources = dataset.get_datasources( trans ) + query_dbkey = dataset.dbkey + if query_dbkey == "?": + query_dbkey = dbkey + chroms_info = self.app.genomes.chroms( trans, dbkey=query_dbkey ) + + # If there are no messages (messages indicate data is not ready/available), preload data. + messages_list = [ data_source_dict[ 'message' ] for data_source_dict in data_sources.values() ] + message = get_highest_priority_msg( messages_list ) + if message: + rval = message + else: + data_provider = trans.app.data_provider_registry.get_data_provider( trans, + original_dataset=dataset, + source='index' ) + # HACK: pass in additional params, which are only used for summary tree data, not BBI data. + rval = data_provider.get_genome_data( chroms_info, level=4, detail_cutoff=0, draw_cutoff=0 ) + + return rval + class UsesStoredWorkflowMixin( SharableItemSecurityMixin ): """ Mixin for controllers that use StoredWorkflow objects. """ def get_stored_workflow( self, trans, id, check_ownership=True, check_accessible=False ): diff -r 3231b9ca8d82219cbef87cfeb4fc57013c11f3c5 -r 220b6683e8dad3028939ff6e5a7acd76d9e994b1 lib/galaxy/webapps/galaxy/api/datasets.py --- a/lib/galaxy/webapps/galaxy/api/datasets.py +++ b/lib/galaxy/webapps/galaxy/api/datasets.py @@ -51,6 +51,8 @@ rval = self._raw_data( trans, dataset, **kwd ) elif data_type == 'track_config': rval = self.get_new_track_config( trans, dataset ) + elif data_type == 'genome_data': + rval = self._get_genome_data( self, trans, dataset, kwd.get('dbkey', None) ) else: # Default: return dataset as API value. rval = dataset.get_api_value() diff -r 3231b9ca8d82219cbef87cfeb4fc57013c11f3c5 -r 220b6683e8dad3028939ff6e5a7acd76d9e994b1 lib/galaxy/webapps/galaxy/controllers/visualization.py --- a/lib/galaxy/webapps/galaxy/controllers/visualization.py +++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py @@ -772,18 +772,10 @@ # Add genome-wide summary tree data to each track in viz. tracks = viz_config.get( 'tracks', [] ) for track in tracks: - # Get dataset and data sources. dataset = self.get_hda_or_ldda( trans, track[ 'hda_ldda'], track[ 'dataset_id' ] ) - data_sources = dataset.get_datasources( trans ) - - # If there are no messages (messages indicate data is not ready/available), preload data. - messages_list = [ data_source_dict[ 'message' ] for data_source_dict in data_sources.values() ] - if not get_highest_priority_msg( messages_list ): - data_provider = trans.app.data_provider_registry.get_data_provider( trans, - original_dataset=dataset, - source='index' ) - # HACK: pass in additional params, which are only used for summary tree data, not BBI data. - track[ 'preloaded_data' ] = data_provider.get_genome_data( chroms_info, level=4, detail_cutoff=0, draw_cutoff=0 ) + genome_data = self._get_genome_data( trans, dataset, dbkey ) + if not isinstance( genome_data, str ): + track[ 'preloaded_data' ] = genome_data return trans.fill_template( 'visualization/circster.mako', viz_config=viz_config, genome=genome ) 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