commit/galaxy-central: jgoecks: Make a data_sources attribute for data types and remove get_track_type because it is no longer needed.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/46133ca43f32/ Changeset: 46133ca43f32 User: jgoecks Date: 2013-04-17 00:11:09 Summary: Make a data_sources attribute for data types and remove get_track_type because it is no longer needed. Affected #: 8 files diff -r da3b931de04c93ddae85e4999b6911948fdf0b34 -r 46133ca43f322fe8b042ac0c0b393fe72579cecc lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -95,6 +95,7 @@ """Class describing a BAM binary file""" file_ext = "bam" track_type = "ReadTrack" + data_sources = { "data": "bai", "index": [ "bigwig", "summary_tree" ] } MetadataElement( name="bam_index", desc="BAM Index File", param=metadata.FileParameter, file_ext="bai", readonly=True, no_value=None, visible=False, optional=True ) @@ -246,9 +247,7 @@ return dataset.peek except: return "Binary bam alignments file (%s)" % ( data.nice_size( dataset.get_size() ) ) - def get_track_type( self ): - return self.track_type, { "data": "bai", "index": [ "bigwig", "summary_tree" ] } - + Binary.register_sniffable_binary_format("bam", "bam", Bam) class H5( Binary ): @@ -327,6 +326,7 @@ http://bioinformatics.oxfordjournals.org/cgi/content/abstract/btq351v1 """ track_type = "LineTrack" + data_sources = { "data_standalone": "bigwig" } def __init__( self, **kwd ): Binary.__init__( self, **kwd ) @@ -352,20 +352,18 @@ return dataset.peek except: return "Binary UCSC %s file (%s)" % ( self._name, data.nice_size( dataset.get_size() ) ) - def get_track_type( self ): - return self.track_type, {"data_standalone": "bigwig"} - + Binary.register_sniffable_binary_format("bigwig", "bigwig", BigWig) class BigBed(BigWig): """BigBed support from UCSC.""" + data_sources = { "data_standalone": "bigbed" } + def __init__( self, **kwd ): Binary.__init__( self, **kwd ) self._magic = 0x8789F2EB self._name = "BigBed" - def get_track_type( self ): - return self.track_type, {"data_standalone": "bigbed"} Binary.register_sniffable_binary_format("bigbed", "bigbed", BigBed) diff -r da3b931de04c93ddae85e4999b6911948fdf0b34 -r 46133ca43f322fe8b042ac0c0b393fe72579cecc lib/galaxy/datatypes/data.py --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -100,6 +100,9 @@ # Trackster track type. track_type = None + # Data sources. + data_sources = {} + def __init__(self, **kwd): """Initialize the datatype""" object.__init__(self, **kwd) diff -r da3b931de04c93ddae85e4999b6911948fdf0b34 -r 46133ca43f322fe8b042ac0c0b393fe72579cecc lib/galaxy/datatypes/interval.py --- a/lib/galaxy/datatypes/interval.py +++ b/lib/galaxy/datatypes/interval.py @@ -47,6 +47,7 @@ file_ext = "interval" line_class = "region" track_type = "FeatureTrack" + data_sources = { "data": "tabix", "index": "summary_tree" } """Add metadata elements""" MetadataElement( name="chromCol", default=1, desc="Chrom column", param=metadata.ColumnParameter ) @@ -329,18 +330,13 @@ def get_track_resolution( self, dataset, start, end): return None - - def get_track_type( self ): - return self.track_type, {"data": "tabix", "index": "summary_tree"} class BedGraph( Interval ): """Tab delimited chrom/start/end/datavalue dataset""" file_ext = "bedgraph" track_type = "LineTrack" - - def get_track_type( self ): - return self.track_type, { "data": "bigwig", "index": "bigwig" } + data_sources = { "data": "bigwig", "index": "bigwig" } def as_ucsc_display_file( self, dataset, **kwd ): """ @@ -358,6 +354,7 @@ class Bed( Interval ): """Tab delimited data in BED format""" file_ext = "bed" + data_sources = {"data": "tabix", "index": "summary_tree", "feature_search": "fli"} """Add metadata elements""" MetadataElement( name="chromCol", default=1, desc="Chrom column", param=metadata.ColumnParameter ) @@ -512,9 +509,6 @@ else: return False return True except: return False - - def get_track_type( self ): - return self.track_type, {"data": "tabix", "index": "summary_tree", "feature_search": "fli"} class BedStrict( Bed ): """Tab delimited data in strict BED format - no non-standard columns allowed""" @@ -574,6 +568,7 @@ """Tab delimited data in Gff format""" file_ext = "gff" column_names = [ 'Seqname', 'Source', 'Feature', 'Start', 'End', 'Score', 'Strand', 'Frame', 'Group' ] + data_sources = { "data": "interval_index", "index": "summary_tree", "feature_search": "fli" } """Add metadata elements""" MetadataElement( name="columns", default=9, desc="Number of columns", readonly=True, visible=False ) @@ -785,10 +780,6 @@ return True except: return False - - def get_track_type( self ): - return self.track_type, {"data": "interval_index", "index": "summary_tree", "feature_search": "fli"} - class Gff3( Gff ): """Tab delimited data in Gff3 format""" @@ -969,6 +960,7 @@ """Tab delimited data in wiggle format""" file_ext = "wig" track_type = "LineTrack" + data_sources = { "data": "bigwig", "index": "bigwig" } MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True, visible=False ) @@ -1149,9 +1141,6 @@ resolution = min( resolution, 100000 ) resolution = max( resolution, 1 ) return resolution - - def get_track_type( self ): - return self.track_type, { "data": "bigwig", "index": "bigwig" } class CustomTrack ( Tabular ): """UCSC CustomTrack""" @@ -1295,6 +1284,7 @@ file_ext = "encodepeak" column_names = [ 'Chrom', 'Start', 'End', 'Name', 'Score', 'Strand', 'SignalValue', 'pValue', 'qValue', 'Peak' ] + data_sources = { "data": "tabix", "index": "summary_tree" } """Add metadata elements""" MetadataElement( name="chromCol", default=1, desc="Chrom column", param=metadata.ColumnParameter ) @@ -1306,9 +1296,6 @@ def sniff( self, filename ): return False - def get_track_type( self ): - return self.track_type, {"data": "tabix", "index": "summary_tree"} - class ChromatinInteractions( Interval ): ''' Chromatin interactions obtained from 3C/5C/Hi-C experiments. @@ -1316,6 +1303,7 @@ file_ext = "chrint" track_type = "DiagonalHeatmapTrack" + data_sources = { "data": "tabix", "index": "summary_tree" } column_names = [ 'Chrom1', 'Start1', 'End1', 'Chrom2', 'Start2', 'End2', 'Value' ] @@ -1332,11 +1320,6 @@ def sniff( self, filename ): return False - - def get_track_type( self ): - return self.track_type, {"data": "tabix", "index": "summary_tree"} - - if __name__ == '__main__': import doctest, sys diff -r da3b931de04c93ddae85e4999b6911948fdf0b34 -r 46133ca43f322fe8b042ac0c0b393fe72579cecc lib/galaxy/datatypes/tabular.py --- a/lib/galaxy/datatypes/tabular.py +++ b/lib/galaxy/datatypes/tabular.py @@ -359,6 +359,7 @@ class Sam( Tabular ): file_ext = 'sam' track_type = "ReadTrack" + data_sources = { "data": "bam", "index": "summary_tree" } def __init__(self, **kwd): """Initialize taxonomy datatype""" @@ -469,13 +470,11 @@ raise Exception('Result %s from %s' % (result, cmd)) merge = staticmethod(merge) - def get_track_type( self ): - return self.track_type, {"data": "bam", "index": "summary_tree"} - class Pileup( Tabular ): """Tab delimited data in pileup (6- or 10-column) format""" file_ext = "pileup" line_class = "genomic coordinate" + data_sources = { "data": "interval_index" } """Add metadata elements""" MetadataElement( name="chromCol", default=1, desc="Chrom column", param=metadata.ColumnParameter ) @@ -527,10 +526,6 @@ return True except: return False - - def get_track_type( self ): - return self.track_type, { "data": "interval_index" } - class ElandMulti( Tabular ): file_ext = 'elandmulti' @@ -541,6 +536,7 @@ class Vcf( Tabular ): """ Variant Call Format for describing SNPs and other simple genome variations. """ track_type = "VariantTrack" + data_sources = { "data": "tabix", "index": "summary_tree" } file_ext = 'vcf' column_names = [ 'Chrom', 'Pos', 'ID', 'Ref', 'Alt', 'Qual', 'Filter', 'Info', 'Format', 'data' ] @@ -557,9 +553,6 @@ """Returns formated html of peek""" return Tabular.make_html_table( self, dataset, column_names=self.column_names ) - def get_track_type( self ): - return self.track_type, { "data": "tabix", "index": "summary_tree" } - class Eland( Tabular ): """Support for the export.txt.gz file used by Illumina's ELANDv2e aligner""" file_ext = '_export.txt.gz' diff -r da3b931de04c93ddae85e4999b6911948fdf0b34 -r 46133ca43f322fe8b042ac0c0b393fe72579cecc lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -1333,10 +1333,9 @@ with entries of type (<datasource_type> : {<datasource_name>, <indexing_message>}). """ - track_type, data_sources = self.datatype.get_track_type() data_sources_dict = {} msg = None - for source_type, source_list in data_sources.iteritems(): + for source_type, source_list in self.datatype.data_sources.iteritems(): data_source = None if source_type == "data_standalone": # Nothing to do. diff -r da3b931de04c93ddae85e4999b6911948fdf0b34 -r 46133ca43f322fe8b042ac0c0b393fe72579cecc lib/galaxy/visualization/data_providers/registry.py --- a/lib/galaxy/visualization/data_providers/registry.py +++ b/lib/galaxy/visualization/data_providers/registry.py @@ -83,12 +83,12 @@ elif original_dataset: # No name, so look up a provider name from datatype's information. - # Dataset must have get_track_type function to get data. - if not hasattr( original_dataset.datatype, 'get_track_type'): + # Dataset must have data sources to get data. + if not original_dataset.datatype.data_sources: return None # Get data provider mapping and data provider. - _ , data_provider_mapping = original_dataset.datatype.get_track_type() + data_provider_mapping = original_dataset.datatype.data_sources if 'data_standalone' in data_provider_mapping: data_provider = self.get_data_provider( trans, name=data_provider_mapping[ 'data_standalone' ], diff -r da3b931de04c93ddae85e4999b6911948fdf0b34 -r 46133ca43f322fe8b042ac0c0b393fe72579cecc lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -590,12 +590,11 @@ except KeyError: prefs = {} - track_type, _ = dataset.datatype.get_track_type() track_data_provider = trans.app.data_provider_registry.get_data_provider( trans, original_dataset=dataset, source='data' ) return { - "track_type": track_type, + "track_type": dataset.datatype.track_type, "name": track_dict['name'], "hda_ldda": track_dict.get("hda_ldda", "hda"), "dataset_id": trans.security.encode_id( dataset.id ), @@ -666,10 +665,8 @@ Returns track configuration dict for a dataset. """ # Get data provider. - track_type, _ = dataset.datatype.get_track_type() track_data_provider = trans.app.data_provider_registry.get_data_provider( trans, original_dataset=dataset ) - if isinstance( dataset, trans.app.model.HistoryDatasetAssociation ): hda_ldda = "hda" elif isinstance( dataset, trans.app.model.LibraryDatasetDatasetAssociation ): @@ -677,7 +674,7 @@ # Get track definition. return { - "track_type": track_type, + "track_type": dataset.datatype.track_type, "name": dataset.name, "hda_ldda": hda_ldda, "dataset_id": trans.security.encode_id( dataset.id ), diff -r da3b931de04c93ddae85e4999b6911948fdf0b34 -r 46133ca43f322fe8b042ac0c0b393fe72579cecc lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -225,7 +225,7 @@ data_provider = data_provider_registry.get_data_provider( trans, original_dataset=input_dataset, source='data' ) if data_provider and not data_provider.converted_dataset: # Can convert but no converted dataset yet, so return message about why. - _, data_sources = input_dataset.datatype.get_track_type() + data_sources = input_dataset.datatype.data_sources msg = input_dataset.convert_dataset( trans, data_sources[ 'data' ] ) if msg is not None: messages_list.append( msg ) @@ -311,7 +311,7 @@ input_dataset = jida.dataset if input_dataset is None: #optional dataset and dataset wasn't selected tool_params[ jida.name ] = None - elif run_on_regions and hasattr( input_dataset.datatype, 'get_track_type' ): + elif run_on_regions and 'data' in input_dataset.datatype.data_sources: # Dataset is indexed and hence a subset can be extracted and used # as input. @@ -324,8 +324,7 @@ subset_dataset = subset_dataset_association.subset else: # Need to create subset. - track_type, data_sources = input_dataset.datatype.get_track_type() - data_source = data_sources[ 'data' ] + data_source = input_dataset.datatype.data_sources[ 'data' ] converted_dataset = input_dataset.get_converted_dataset( trans, data_source ) deps = input_dataset.get_converted_dataset_deps( trans, data_source ) 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