1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/943855e11c85/ changeset: 943855e11c85 user: jgoecks date: 2011-12-05 18:19:48 summary: Look for datasets/indices in metadata and use if found rather than doing conversion. affected #: 2 files diff -r 5e67b3ddbda241bf8a24969ac6caa47e9cbe5d9b -r 943855e11c853ec7c8ab7a64ee07a65daefe4374 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -928,7 +928,10 @@ depends_list = trans.app.datatypes_registry.converter_deps[self.extension][target_ext] except KeyError: depends_list = [] - # See if converted dataset already exists + # See if converted dataset already exists, either in metadata in conversions. + converted_dataset = self.get_metadata_dataset( trans, target_ext ) + if converted_dataset: + return converted_dataset converted_dataset = self.get_converted_files_by_type( target_ext ) if converted_dataset: return converted_dataset @@ -958,6 +961,21 @@ session.add( assoc ) session.flush() return None + def get_metadata_dataset( self, trans, dataset_ext ): + """ + Returns an HDA that points to a metadata file which contains a + converted data with the requested extension. + """ + for name, value in self.metadata.items(): + # HACK: MetadataFile objects do not have a type/ext, so need to use metadata name + # to determine type. + if dataset_ext == 'bai' and name == 'bam_index' and isinstance( value, trans.app.model.MetadataFile ): + # HACK: MetadataFile objects cannot be used by tools, so return + # a fake HDA that points to metadata file. + fake_dataset = trans.app.model.Dataset( state=trans.app.model.Dataset.states.OK, + external_filename=value.file_name ) + fake_hda = trans.app.model.HistoryDatasetAssociation( dataset=fake_dataset ) + return fake_hda def clear_associated_files( self, metadata_safe = False, purge = False ): raise 'Unimplemented' def get_child_by_designation(self, designation): diff -r 5e67b3ddbda241bf8a24969ac6caa47e9cbe5d9b -r 943855e11c853ec7c8ab7a64ee07a65daefe4374 lib/galaxy/web/controllers/tracks.py --- a/lib/galaxy/web/controllers/tracks.py +++ b/lib/galaxy/web/controllers/tracks.py @@ -546,7 +546,7 @@ valid_chroms = indexer.valid_chroms() else: # Standalone data provider - standalone_provider = get_data_provider(data_sources['data_standalone']['name'])( dataset ) + standalone_provider = get_data_provider( data_sources['data_standalone']['name'] )( dataset ) kwargs = {"stats": True} if not standalone_provider.has_data( chrom ): return messages.NO_DATA @@ -609,16 +609,8 @@ else: tracks_dataset_type = data_sources['data']['name'] data_provider_class = get_data_provider( name=tracks_dataset_type, original_dataset=dataset ) - # HACK: Use bai from bam HDA's metadata if available. This saves - # the client from waiting a long time to generate a duplicate - # bam via a converted dataset. - if dataset.ext == "bam" and dataset.metadata.get( "bam_index", None ) is not None: - converted_dataset = dataset.metadata.bam_index - deps = None - else: - # Default behavior. - converted_dataset = dataset.get_converted_dataset( trans, tracks_dataset_type ) - deps = dataset.get_converted_dataset_deps( trans, tracks_dataset_type ) + converted_dataset = dataset.get_converted_dataset( trans, tracks_dataset_type ) + deps = dataset.get_converted_dataset_deps( trans, tracks_dataset_type ) data_provider = data_provider_class( converted_dataset=converted_dataset, original_dataset=dataset, dependencies=deps ) # Get and return data from data_provider. @@ -1037,16 +1029,15 @@ data_sources_dict[ source_type ] = { "name" : data_source, "message": msg } return data_sources_dict - + def _convert_dataset( self, trans, dataset, target_type ): """ Converts a dataset to the target_type and returns a message indicating status of the conversion. None is returned to indicate that dataset was converted successfully. """ - - # Get converted dataset; this will start the conversion if - # necessary. + + # Get converted dataset; this will start the conversion if necessary. try: converted_dataset = dataset.get_converted_dataset( trans, target_type ) except NoConverterException: @@ -1063,7 +1054,7 @@ msg = { 'kind': messages.ERROR, 'message': job.stderr } elif not converted_dataset or converted_dataset.state != model.Dataset.states.OK: msg = messages.PENDING - + return msg def _get_highest_priority_msg( message_list ): 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.