commit/galaxy-central: carlfeberhard: Dataproviders: change 'map' providers to 'dict' for better consistency w/ python
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/3422736c168d/ Changeset: 3422736c168d User: carlfeberhard Date: 2013-07-18 18:46:21 Summary: Dataproviders: change 'map' providers to 'dict' for better consistency w/ python Affected #: 5 files diff -r 416e08c46ed6b03598581c5d6c6b44587aa9f170 -r 3422736c168d6d864ec3c478d3e725b1184e3778 lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -285,23 +285,23 @@ settings[ 'comment_char' ] = '@' return dataproviders.column.ColumnarDataProvider( samtools_source, **settings ) - @dataproviders.decorators.dataprovider_factory( 'map', dataproviders.column.MapDataProvider.settings ) - def map_dataprovider( self, dataset, **settings ): + @dataproviders.decorators.dataprovider_factory( 'dict', dataproviders.column.DictDataProvider.settings ) + def dict_dataprovider( self, dataset, **settings ): samtools_source = dataproviders.dataset.SamtoolsDataProvider( dataset ) settings[ 'comment_char' ] = '@' - return dataproviders.column.MapDataProvider( samtools_source, **settings ) + return dataproviders.column.DictDataProvider( samtools_source, **settings ) - # these can't be used directly - may need BamColumn, BamMap (Bam metadata -> column/map) + # these can't be used directly - may need BamColumn, BamDict (Bam metadata -> column/dict) # OR - see genomic_region_dataprovider #@dataproviders.decorators.dataprovider_factory( 'dataset-column', dataproviders.column.ColumnarDataProvider.settings ) #def dataset_column_dataprovider( self, dataset, **settings ): # settings[ 'comment_char' ] = '@' # return super( Sam, self ).dataset_column_dataprovider( dataset, **settings ) - #@dataproviders.decorators.dataprovider_factory( 'dataset-map', dataproviders.column.MapDataProvider.settings ) - #def dataset_map_dataprovider( self, dataset, **settings ): + #@dataproviders.decorators.dataprovider_factory( 'dataset-dict', dataproviders.column.DictDataProvider.settings ) + #def dataset_dict_dataprovider( self, dataset, **settings ): # settings[ 'comment_char' ] = '@' - # return super( Sam, self ).dataset_map_dataprovider( dataset, **settings ) + # return super( Sam, self ).dataset_dict_dataprovider( dataset, **settings ) @dataproviders.decorators.dataprovider_factory( 'header', dataproviders.line.RegexLineDataProvider.settings ) def header_dataprovider( self, dataset, **settings ): @@ -309,12 +309,12 @@ samtools_source = dataproviders.dataset.SamtoolsDataProvider( dataset, '-H' ) return dataproviders.line.RegexLineDataProvider( samtools_source, **settings ) - @dataproviders.decorators.dataprovider_factory( 'id-seq-qual', dataproviders.column.MapDataProvider.settings ) + @dataproviders.decorators.dataprovider_factory( 'id-seq-qual', dataproviders.column.DictDataProvider.settings ) def id_seq_qual_dataprovider( self, dataset, **settings ): settings[ 'indeces' ] = [ 0, 9, 10 ] settings[ 'column_types' ] = [ 'str', 'str', 'str' ] settings[ 'column_names' ] = [ 'id', 'seq', 'qual' ] - return self.map_dataprovider( dataset, **settings ) + return self.dict_dataprovider( dataset, **settings ) @dataproviders.decorators.dataprovider_factory( 'genomic-region', dataproviders.column.ColumnarDataProvider.settings ) def genomic_region_dataprovider( self, dataset, **settings ): @@ -330,12 +330,12 @@ settings[ 'column_types' ] = [ 'str', 'int', 'int' ] return self.column_dataprovider( dataset, **settings ) - @dataproviders.decorators.dataprovider_factory( 'genomic-region-map', dataproviders.column.MapDataProvider.settings ) - def genomic_region_map_dataprovider( self, dataset, **settings ): + @dataproviders.decorators.dataprovider_factory( 'genomic-region-dict', dataproviders.column.DictDataProvider.settings ) + def genomic_region_dict_dataprovider( self, dataset, **settings ): settings[ 'indeces' ] = [ 2, 3, 3 ] settings[ 'column_types' ] = [ 'str', 'int', 'int' ] settings[ 'column_names' ] = [ 'chrom', 'start', 'end' ] - return self.map_dataprovider( dataset, **settings ) + return self.dict_dataprovider( dataset, **settings ) @dataproviders.decorators.dataprovider_factory( 'samtools' ) def samtools_dataprovider( self, dataset, **settings ): diff -r 416e08c46ed6b03598581c5d6c6b44587aa9f170 -r 3422736c168d6d864ec3c478d3e725b1184e3778 lib/galaxy/datatypes/dataproviders/column.py --- a/lib/galaxy/datatypes/dataproviders/column.py +++ b/lib/galaxy/datatypes/dataproviders/column.py @@ -220,9 +220,9 @@ super( FilteredByColumnDataProvider, self ).__init__( source, **kwargs ) -class MapDataProvider( ColumnarDataProvider ): +class DictDataProvider( ColumnarDataProvider ): """ - Data provider that column_names and columns from the source's contents + Data provider that zips column_names and columns from the source's contents into a dictionary. A combination use of both `column_names` and `indeces` allows 'picking' @@ -244,11 +244,11 @@ :type column_names: """ #TODO: allow passing in a map instead of name->index { 'name1': index1, ... } - super( MapDataProvider, self ).__init__( source, **kwargs ) + super( DictDataProvider, self ).__init__( source, **kwargs ) self.column_names = column_names or [] def __iter__( self ): - parent_gen = super( MapDataProvider, self ).__iter__() + parent_gen = super( DictDataProvider, self ).__iter__() for column_values in parent_gen: map = dict( zip( self.column_names, column_values ) ) yield map diff -r 416e08c46ed6b03598581c5d6c6b44587aa9f170 -r 3422736c168d6d864ec3c478d3e725b1184e3778 lib/galaxy/datatypes/dataproviders/dataset.py --- a/lib/galaxy/datatypes/dataproviders/dataset.py +++ b/lib/galaxy/datatypes/dataproviders/dataset.py @@ -203,16 +203,16 @@ super( DatasetColumnarDataProvider, self ).__init__( dataset_source, **kwargs ) -class DatasetMapDataProvider( column.MapDataProvider ): +class DatasetDictDataProvider( column.DictDataProvider ): """ Data provider that uses a DatasetDataProvider as it's source and the - dataset's metadata to buuild settings for the MapDataProvider it's + dataset's metadata to buuild settings for the DictDataProvider it's inherited from. """ def __init__( self, dataset, **kwargs ): """ - All kwargs are inherited from MapDataProvider. - .. seealso:: column.MapDataProvider + All kwargs are inherited from DictDataProvider. + .. seealso:: column.DictDataProvider If no kwargs are given, this class will attempt to get those kwargs from the dataset source's metadata. @@ -255,7 +255,7 @@ if not kwargs.get( 'column_types', None ): kwargs[ 'column_types' ] = dataset_source.get_metadata_column_types( indeces=indeces ) - super( DatasetMapDataProvider, self ).__init__( dataset_source, **kwargs ) + super( DatasetDictDataProvider, self ).__init__( dataset_source, **kwargs ) # ----------------------------------------------------------------------------- provides a bio-relevant datum diff -r 416e08c46ed6b03598581c5d6c6b44587aa9f170 -r 3422736c168d6d864ec3c478d3e725b1184e3778 lib/galaxy/datatypes/interval.py --- a/lib/galaxy/datatypes/interval.py +++ b/lib/galaxy/datatypes/interval.py @@ -339,9 +339,9 @@ def genomic_region_dataprovider( self, dataset, **settings ): return dataproviders.dataset.GenomicRegionDataProvider( dataset, **settings ) - @dataproviders.decorators.dataprovider_factory( 'genomic-region-map', + @dataproviders.decorators.dataprovider_factory( 'genomic-region-dict', dataproviders.dataset.GenomicRegionDataProvider.settings ) - def genomic_region_map_dataprovider( self, dataset, **settings ): + def genomic_region_dict_dataprovider( self, dataset, **settings ): settings[ 'named_columns' ] = True return self.genomic_region_dataprovider( dataset, **settings ) @@ -350,9 +350,9 @@ def interval_dataprovider( self, dataset, **settings ): return dataproviders.dataset.IntervalDataProvider( dataset, **settings ) - @dataproviders.decorators.dataprovider_factory( 'interval-map', + @dataproviders.decorators.dataprovider_factory( 'interval-dict', dataproviders.dataset.IntervalDataProvider.settings ) - def interval_map_dataprovider( self, dataset, **settings ): + def interval_dict_dataprovider( self, dataset, **settings ): settings[ 'named_columns' ] = True return self.interval_dataprovider( dataset, **settings ) @@ -818,9 +818,9 @@ def genomic_region_dataprovider( self, dataset, **settings ): return dataproviders.dataset.GenomicRegionDataProvider( dataset, 0, 3, 4, **settings ) - @dataproviders.decorators.dataprovider_factory( 'genomic-region-map', + @dataproviders.decorators.dataprovider_factory( 'genomic-region-dict', dataproviders.dataset.GenomicRegionDataProvider.settings ) - def genomic_region_map_dataprovider( self, dataset, **settings ): + def genomic_region_dict_dataprovider( self, dataset, **settings ): settings[ 'named_columns' ] = True return self.genomic_region_dataprovider( dataset, **settings ) @@ -829,9 +829,9 @@ def interval_dataprovider( self, dataset, **settings ): return dataproviders.dataset.IntervalDataProvider( dataset, 0, 3, 4, 6, 2, **settings ) - @dataproviders.decorators.dataprovider_factory( 'interval-map', + @dataproviders.decorators.dataprovider_factory( 'interval-dict', dataproviders.dataset.IntervalDataProvider.settings ) - def interval_map_dataprovider( self, dataset, **settings ): + def interval_dict_dataprovider( self, dataset, **settings ): settings[ 'named_columns' ] = True return self.interval_dataprovider( dataset, **settings ) @@ -1206,8 +1206,8 @@ dataset_source = dataproviders.dataset.DatasetDataProvider( dataset ) return dataproviders.dataset.WiggleDataProvider( dataset_source, **settings ) - @dataproviders.decorators.dataprovider_factory( 'wiggle-map', dataproviders.dataset.WiggleDataProvider.settings ) - def wiggle_map_dataprovider( self, dataset, **settings ): + @dataproviders.decorators.dataprovider_factory( 'wiggle-dict', dataproviders.dataset.WiggleDataProvider.settings ) + def wiggle_dict_dataprovider( self, dataset, **settings ): dataset_source = dataproviders.dataset.DatasetDataProvider( dataset ) settings[ 'named_columns' ] = True return dataproviders.dataset.WiggleDataProvider( dataset_source, **settings ) diff -r 416e08c46ed6b03598581c5d6c6b44587aa9f170 -r 3422736c168d6d864ec3c478d3e725b1184e3778 lib/galaxy/datatypes/tabular.py --- a/lib/galaxy/datatypes/tabular.py +++ b/lib/galaxy/datatypes/tabular.py @@ -357,16 +357,16 @@ """Attempts to get column settings from dataset.metadata""" return dataproviders.dataset.DatasetColumnarDataProvider( dataset, **settings ) - @dataproviders.decorators.dataprovider_factory( 'map', dataproviders.column.MapDataProvider.settings ) - def map_dataprovider( self, dataset, **settings ): + @dataproviders.decorators.dataprovider_factory( 'dict', dataproviders.column.DictDataProvider.settings ) + def dict_dataprovider( self, dataset, **settings ): """Uses column settings that are passed in""" dataset_source = dataproviders.dataset.DatasetDataProvider( dataset ) - return dataproviders.column.MapDataProvider( dataset_source, **settings ) + return dataproviders.column.DictDataProvider( dataset_source, **settings ) - @dataproviders.decorators.dataprovider_factory( 'dataset-map', dataproviders.column.MapDataProvider.settings ) - def dataset_map_dataprovider( self, dataset, **settings ): + @dataproviders.decorators.dataprovider_factory( 'dataset-dict', dataproviders.column.DictDataProvider.settings ) + def dataset_dict_dataprovider( self, dataset, **settings ): """Attempts to get column settings from dataset.metadata""" - return dataproviders.dataset.DatasetMapDataProvider( dataset, **settings ) + return dataproviders.dataset.DatasetDictDataProvider( dataset, **settings ) class Taxonomy( Tabular ): @@ -522,15 +522,15 @@ settings[ 'comment_char' ] = '@' return super( Sam, self ).dataset_column_dataprovider( dataset, **settings ) - @dataproviders.decorators.dataprovider_factory( 'map', dataproviders.column.MapDataProvider.settings ) - def map_dataprovider( self, dataset, **settings ): + @dataproviders.decorators.dataprovider_factory( 'dict', dataproviders.column.DictDataProvider.settings ) + def dict_dataprovider( self, dataset, **settings ): settings[ 'comment_char' ] = '@' - return super( Sam, self ).map_dataprovider( dataset, **settings ) + return super( Sam, self ).dict_dataprovider( dataset, **settings ) - @dataproviders.decorators.dataprovider_factory( 'dataset-map', dataproviders.column.MapDataProvider.settings ) - def dataset_map_dataprovider( self, dataset, **settings ): + @dataproviders.decorators.dataprovider_factory( 'dataset-dict', dataproviders.column.DictDataProvider.settings ) + def dataset_dict_dataprovider( self, dataset, **settings ): settings[ 'comment_char' ] = '@' - return super( Sam, self ).dataset_map_dataprovider( dataset, **settings ) + return super( Sam, self ).dataset_dict_dataprovider( dataset, **settings ) @dataproviders.decorators.dataprovider_factory( 'header', dataproviders.line.RegexLineDataProvider.settings ) def header_dataprovider( self, dataset, **settings ): @@ -538,12 +538,12 @@ headers_source = dataproviders.line.RegexLineDataProvider( dataset_source, regex_list=[ '^@' ] ) return dataproviders.line.RegexLineDataProvider( headers_source, **settings ) - @dataproviders.decorators.dataprovider_factory( 'id-seq-qual', map_dataprovider.settings ) + @dataproviders.decorators.dataprovider_factory( 'id-seq-qual', dict_dataprovider.settings ) def id_seq_qual_dataprovider( self, dataset, **settings ): - # provided as an example of a specified column map (w/o metadata) + # provided as an example of a specified column dict (w/o metadata) settings[ 'indeces' ] = [ 0, 9, 10 ] settings[ 'column_names' ] = [ 'id', 'seq', 'qual' ] - return self.map_dataprovider( dataset, **settings ) + return self.dict_dataprovider( dataset, **settings ) @dataproviders.decorators.dataprovider_factory( 'genomic-region', dataproviders.dataset.GenomicRegionDataProvider.settings ) @@ -551,9 +551,9 @@ settings[ 'comment_char' ] = '@' return dataproviders.dataset.GenomicRegionDataProvider( dataset, 2, 3, 3, **settings ) - @dataproviders.decorators.dataprovider_factory( 'genomic-region-map', + @dataproviders.decorators.dataprovider_factory( 'genomic-region-dict', dataproviders.dataset.GenomicRegionDataProvider.settings ) - def genomic_region_map_dataprovider( self, dataset, **settings ): + def genomic_region_dict_dataprovider( self, dataset, **settings ): settings[ 'comment_char' ] = '@' return dataproviders.dataset.GenomicRegionDataProvider( dataset, 2, 3, 3, True, **settings ) @@ -628,9 +628,9 @@ def genomic_region_dataprovider( self, dataset, **settings ): return dataproviders.dataset.GenomicRegionDataProvider( dataset, **settings ) - @dataproviders.decorators.dataprovider_factory( 'genomic-region-map', + @dataproviders.decorators.dataprovider_factory( 'genomic-region-dict', dataproviders.dataset.GenomicRegionDataProvider.settings ) - def genomic_region_map_dataprovider( self, dataset, **settings ): + def genomic_region_dict_dataprovider( self, dataset, **settings ): settings[ 'named_columns' ] = True return self.genomic_region_dataprovider( dataset, **settings ) @@ -677,9 +677,9 @@ def genomic_region_dataprovider( self, dataset, **settings ): return dataproviders.dataset.GenomicRegionDataProvider( dataset, 0, 1, 1, **settings ) - @dataproviders.decorators.dataprovider_factory( 'genomic-region-map', + @dataproviders.decorators.dataprovider_factory( 'genomic-region-dict', dataproviders.dataset.GenomicRegionDataProvider.settings ) - def genomic_region_map_dataprovider( self, dataset, **settings ): + def genomic_region_dict_dataprovider( self, dataset, **settings ): settings[ 'named_columns' ] = True return self.genomic_region_dataprovider( dataset, **settings ) 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