commit/galaxy-central: jgoecks: Add a track_type attribute to data types and use instead of burying track type in get_track_type function.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/cf7a0098c612/ Changeset: cf7a0098c612 User: jgoecks Date: 2013-04-16 21:32:46 Summary: Add a track_type attribute to data types and use instead of burying track type in get_track_type function. Affected #: 5 files diff -r 270ef5007ae876bfbaa3110d6666432751152323 -r cf7a0098c612499d03aafb2f62084ebbcf99e55f lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -94,6 +94,8 @@ class Bam( Binary ): """Class describing a BAM binary file""" file_ext = "bam" + track_type = "ReadTrack" + MetadataElement( name="bam_index", desc="BAM Index File", param=metadata.FileParameter, file_ext="bai", readonly=True, no_value=None, visible=False, optional=True ) def _get_samtools_version( self ): @@ -245,7 +247,7 @@ except: return "Binary bam alignments file (%s)" % ( data.nice_size( dataset.get_size() ) ) def get_track_type( self ): - return "ReadTrack", { "data": "bai", "index": [ "bigwig", "summary_tree" ] } + return self.track_type, { "data": "bai", "index": [ "bigwig", "summary_tree" ] } Binary.register_sniffable_binary_format("bam", "bam", Bam) @@ -324,6 +326,8 @@ The supplemental info in the paper has the binary details: http://bioinformatics.oxfordjournals.org/cgi/content/abstract/btq351v1 """ + track_type = "LineTrack" + def __init__( self, **kwd ): Binary.__init__( self, **kwd ) self._magic = 0x888FFC26 @@ -349,18 +353,19 @@ except: return "Binary UCSC %s file (%s)" % ( self._name, data.nice_size( dataset.get_size() ) ) def get_track_type( self ): - return "LineTrack", {"data_standalone": "bigwig"} + return self.track_type, {"data_standalone": "bigwig"} Binary.register_sniffable_binary_format("bigwig", "bigwig", BigWig) class BigBed(BigWig): """BigBed support from UCSC.""" + def __init__( self, **kwd ): Binary.__init__( self, **kwd ) self._magic = 0x8789F2EB self._name = "BigBed" def get_track_type( self ): - return "LineTrack", {"data_standalone": "bigbed"} + return self.track_type, {"data_standalone": "bigbed"} Binary.register_sniffable_binary_format("bigbed", "bigbed", BigBed) diff -r 270ef5007ae876bfbaa3110d6666432751152323 -r cf7a0098c612499d03aafb2f62084ebbcf99e55f lib/galaxy/datatypes/data.py --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -97,6 +97,9 @@ #A per datatype setting (inherited): max file size (in bytes) for setting optional metadata _max_optional_metadata_filesize = None + # Trackster track type. + track_type = None + def __init__(self, **kwd): """Initialize the datatype""" object.__init__(self, **kwd) @@ -561,7 +564,7 @@ Returns a list of visualizations for datatype. """ - if hasattr( self, 'get_track_type' ): + if self.track_type: return [ 'trackster', 'circster' ] return [] diff -r 270ef5007ae876bfbaa3110d6666432751152323 -r cf7a0098c612499d03aafb2f62084ebbcf99e55f lib/galaxy/datatypes/interval.py --- a/lib/galaxy/datatypes/interval.py +++ b/lib/galaxy/datatypes/interval.py @@ -46,6 +46,7 @@ """Tab delimited data containing interval information""" file_ext = "interval" line_class = "region" + track_type = "FeatureTrack" """Add metadata elements""" MetadataElement( name="chromCol", default=1, desc="Chrom column", param=metadata.ColumnParameter ) @@ -330,15 +331,16 @@ return None def get_track_type( self ): - return "FeatureTrack", {"data": "tabix", "index": "summary_tree"} + 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 "LineTrack", { "data": "bigwig", "index": "bigwig" } + return self.track_type, { "data": "bigwig", "index": "bigwig" } def as_ucsc_display_file( self, dataset, **kwd ): """ @@ -512,7 +514,7 @@ except: return False def get_track_type( self ): - return "FeatureTrack", {"data": "tabix", "index": "summary_tree", "feature_search": "fli"} + 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""" @@ -785,7 +787,7 @@ return False def get_track_type( self ): - return "FeatureTrack", {"data": "interval_index", "index": "summary_tree", "feature_search": "fli"} + return self.track_type, {"data": "interval_index", "index": "summary_tree", "feature_search": "fli"} class Gff3( Gff ): @@ -966,6 +968,7 @@ class Wiggle( Tabular, _RemoteCallMixin ): """Tab delimited data in wiggle format""" file_ext = "wig" + track_type = "LineTrack" MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True, visible=False ) @@ -1148,7 +1151,7 @@ return resolution def get_track_type( self ): - return "LineTrack", { "data": "bigwig", "index": "bigwig" } + return self.track_type, { "data": "bigwig", "index": "bigwig" } class CustomTrack ( Tabular ): """UCSC CustomTrack""" @@ -1304,7 +1307,7 @@ return False def get_track_type( self ): - return "FeatureTrack", {"data": "tabix", "index": "summary_tree"} + return self.track_type, {"data": "tabix", "index": "summary_tree"} class ChromatinInteractions( Interval ): ''' @@ -1312,6 +1315,7 @@ ''' file_ext = "chrint" + track_type = "DiagonalHeatmapTrack" column_names = [ 'Chrom1', 'Start1', 'End1', 'Chrom2', 'Start2', 'End2', 'Value' ] @@ -1330,7 +1334,7 @@ return False def get_track_type( self ): - return "DiagonalHeatmapTrack", {"data": "tabix", "index": "summary_tree"} + return self.track_type, {"data": "tabix", "index": "summary_tree"} diff -r 270ef5007ae876bfbaa3110d6666432751152323 -r cf7a0098c612499d03aafb2f62084ebbcf99e55f lib/galaxy/datatypes/registry.py --- a/lib/galaxy/datatypes/registry.py +++ b/lib/galaxy/datatypes/registry.py @@ -163,7 +163,7 @@ # Use default mime type as per datatype spec mimetype = self.datatypes_by_extension[ extension ].get_mime() self.mimetypes_by_extension[ extension ] = mimetype - if hasattr( datatype_class, "get_track_type" ): + if datatype_class.track_type: self.available_tracks.append( extension ) if display_in_upload: self.upload_file_formats.append( extension ) diff -r 270ef5007ae876bfbaa3110d6666432751152323 -r cf7a0098c612499d03aafb2f62084ebbcf99e55f lib/galaxy/datatypes/tabular.py --- a/lib/galaxy/datatypes/tabular.py +++ b/lib/galaxy/datatypes/tabular.py @@ -358,6 +358,8 @@ class Sam( Tabular ): file_ext = 'sam' + track_type = "ReadTrack" + def __init__(self, **kwd): """Initialize taxonomy datatype""" Tabular.__init__( self, **kwd ) @@ -468,7 +470,7 @@ merge = staticmethod(merge) def get_track_type( self ): - return "ReadTrack", {"data": "bam", "index": "summary_tree"} + return self.track_type, {"data": "bam", "index": "summary_tree"} class Pileup( Tabular ): """Tab delimited data in pileup (6- or 10-column) format""" @@ -525,8 +527,7 @@ return True except: return False - - + class ElandMulti( Tabular ): file_ext = 'elandmulti' @@ -535,6 +536,7 @@ class Vcf( Tabular ): """ Variant Call Format for describing SNPs and other simple genome variations. """ + track_type = "VariantTrack" file_ext = 'vcf' column_names = [ 'Chrom', 'Pos', 'ID', 'Ref', 'Alt', 'Qual', 'Filter', 'Info', 'Format', 'data' ] @@ -552,7 +554,7 @@ return Tabular.make_html_table( self, dataset, column_names=self.column_names ) def get_track_type( self ): - return "VariantTrack", { "data": "tabix", "index": "summary_tree" } + 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""" 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