commit/galaxy-central: dan: Add 'type_extension' attribute to datatypes_conf.xml that allows creating a datatype from an earlier declared datatype by referencing extension. Make several datatypes that had been direct instantiations from Data become subclasses of Binary.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/3a49bca428c3/ changeset: 3a49bca428c3 user: dan date: 2011-11-15 20:28:08 summary: Add 'type_extension' attribute to datatypes_conf.xml that allows creating a datatype from an earlier declared datatype by referencing extension. Make several datatypes that had been direct instantiations from Data become subclasses of Binary. affected #: 3 files diff -r 94a58c2fbf39ed76218d4af0ac30cb286b61541c -r 3a49bca428c3f71a431a3d6f5a5c4397941aac55 datatypes_conf.xml.sample --- a/datatypes_conf.xml.sample +++ b/datatypes_conf.xml.sample @@ -88,7 +88,7 @@ <datatype extension="gif" type="galaxy.datatypes.images:Gif" mimetype="image/gif"/><datatype extension="gmaj.zip" type="galaxy.datatypes.images:Gmaj" mimetype="application/zip"/><datatype extension="gtf" type="galaxy.datatypes.interval:Gtf" display_in_upload="true"/> - <datatype extension="h5" type="galaxy.datatypes.data:Data" mimetype="application/octet-stream"/> + <datatype extension="h5" type="galaxy.datatypes.binary:Binary" mimetype="application/octet-stream" subclass="True" /><datatype extension="html" type="galaxy.datatypes.images:Html" mimetype="text/html"/><datatype extension="interval" type="galaxy.datatypes.interval:Interval" display_in_upload="true"><converter file="interval_to_bed_converter.xml" target_datatype="bed"/> @@ -164,10 +164,10 @@ <converter file="wiggle_to_simple_converter.xml" target_datatype="interval"/><!-- <display file="gbrowse/gbrowse_wig.xml" /> --></datatype> - <datatype extension="summary_tree" type="galaxy.datatypes.data:Data" /> - <datatype extension="interval_index" type="galaxy.datatypes.data:Data" /> - <datatype extension="tabix" type="galaxy.datatypes.data:Data" /> - <datatype extension="bgzip" type="galaxy.datatypes.data:Data" /> + <datatype extension="summary_tree" type="galaxy.datatypes.binary:Binary" subclass="True" /> + <datatype extension="interval_index" type="galaxy.datatypes.binary:Binary" subclass="True" /> + <datatype extension="tabix" type="galaxy.datatypes.binary:Binary" subclass="True" /> + <datatype extension="bgzip" type="galaxy.datatypes.binary:Binary" subclass="True" /><!-- Start EMBOSS tools --><datatype extension="acedb" type="galaxy.datatypes.data:Text"/><datatype extension="asn1" type="galaxy.datatypes.data:Text"/> diff -r 94a58c2fbf39ed76218d4af0ac30cb286b61541c -r 3a49bca428c3f71a431a3d6f5a5c4397941aac55 lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -26,7 +26,7 @@ """Set the peek and blurb text""" if not dataset.dataset.purged: dataset.peek = 'binary data' - dataset.blurb = 'data' + dataset.blurb = data.nice_size( dataset.get_size() ) else: dataset.peek = 'file does not exist' dataset.blurb = 'file purged from disk' diff -r 94a58c2fbf39ed76218d4af0ac30cb286b61541c -r 3a49bca428c3f71a431a3d6f5a5c4397941aac55 lib/galaxy/datatypes/registry.py --- a/lib/galaxy/datatypes/registry.py +++ b/lib/galaxy/datatypes/registry.py @@ -46,18 +46,22 @@ try: extension = elem.get( 'extension', None ) dtype = elem.get( 'type', None ) + type_extension = elem.get( 'type_extension', None ) mimetype = elem.get( 'mimetype', None ) display_in_upload = elem.get( 'display_in_upload', False ) make_subclass = galaxy.util.string_as_bool( elem.get( 'subclass', False ) ) - if extension and dtype: - fields = dtype.split( ':' ) - datatype_module = fields[0] - datatype_class_name = fields[1] - fields = datatype_module.split( '.' ) - module = __import__( fields.pop(0) ) - for mod in fields: - module = getattr( module, mod ) - datatype_class = getattr( module, datatype_class_name ) + if extension and ( dtype or type_extension ): + if dtype: + fields = dtype.split( ':' ) + datatype_module = fields[0] + datatype_class_name = fields[1] + fields = datatype_module.split( '.' ) + module = __import__( fields.pop(0) ) + for mod in fields: + module = getattr( module, mod ) + datatype_class = getattr( module, datatype_class_name ) + elif type_extension: + datatype_class = self.datatypes_by_extension[type_extension].__class__ if make_subclass: datatype_class = type( datatype_class_name, (datatype_class,), {} ) self.datatypes_by_extension[extension] = datatype_class() 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)
-
Bitbucket