1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/cfc6b7b246e7/ changeset: cfc6b7b246e7 user: jgoecks date: 2012-05-22 05:38:40 summary: Add flexibility when getting summary tree data. affected #: 2 files diff -r d88ca4e4646c6bd3e601bd8f37fcb813385b3b45 -r cfc6b7b246e72ffcfbf2b88569e426fd22d4839b lib/galaxy/visualization/tracks/data_providers.py --- a/lib/galaxy/visualization/tracks/data_providers.py +++ b/lib/galaxy/visualization/tracks/data_providers.py @@ -589,14 +589,14 @@ Summary tree data provider for the Galaxy track browser. """ - CACHE = LRUCache(20) # Store 20 recently accessed indices for performance + CACHE = LRUCache( 20 ) # Store 20 recently accessed indices for performance def valid_chroms( self ): st = summary_tree_from_file( self.converted_dataset.file_name ) return st.chrom_blocks.keys() - def get_summary( self, chrom, start, end, **kwargs ): + def get_summary( self, chrom, start, end, level=None, resolution=None ): filename = self.converted_dataset.file_name st = self.CACHE[filename] if st is None: @@ -613,19 +613,27 @@ else: return None - resolution = max(1, ceil(float(kwargs['resolution']))) + # Get or compute level. + if level: + level = int( level ) + elif resolution: + resolution = max( 1, ceil( float( resolution ) ) ) + level = ceil( log( resolution, st.block_size ) ) - 1 + level = int( max( level, 0 ) ) + else: + # Either level or resolution is required. + return None - level = ceil( log( resolution, st.block_size ) ) - 1 - level = int(max( level, 0 )) if level <= 1: return "detail" - stats = st.chrom_stats[chrom] - results = st.query(chrom, int(start), int(end), level) + # Use level to get results. + stats = st.chrom_stats[ chrom ] + results = st.query( chrom, int(start), int(end), level ) if results == "detail" or results == "draw": return results else: - return results, stats[level]["max"], stats[level]["avg"], stats[level]["delta"] + return results, stats[ level ][ "max" ], stats[ level ]["avg" ], stats[ level ][ "delta" ] def has_data( self, chrom ): """ diff -r d88ca4e4646c6bd3e601bd8f37fcb813385b3b45 -r cfc6b7b246e72ffcfbf2b88569e426fd22d4839b lib/galaxy/web/controllers/tracks.py --- a/lib/galaxy/web/controllers/tracks.py +++ b/lib/galaxy/web/controllers/tracks.py @@ -382,7 +382,7 @@ tracks_dataset_type = data_sources['index']['name'] converted_dataset = dataset.get_converted_dataset( trans, tracks_dataset_type ) indexer = get_data_provider( tracks_dataset_type )( converted_dataset, dataset ) - summary = indexer.get_summary( chrom, low, high, **kwargs ) + summary = indexer.get_summary( chrom, low, high, resolution=kwargs[ 'resolution' ] ) if summary is None: return { 'dataset_type': tracks_dataset_type, 'data': None } @@ -892,6 +892,14 @@ return msg + def _get_dataset( self, trans, hda_ldda, dataset_id ): + """ Returns either HDA or LDDA for hda/ldda and id combination. """ + if hda_ldda == "hda": + return self.get_dataset( trans, dataset_id, check_ownership=False, check_accessible=True ) + else: + return trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( dataset_id ) ) + + def _get_highest_priority_msg( message_list ): """ Returns highest priority message from a list of messages. 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.