commit/galaxy-central: 2 new changesets

2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/7111e4f6a3d1/ Changeset: 7111e4f6a3d1 User: Hunter Moseley Date: 2014-10-12 15:34:05+00:00 Summary: Added an Xlsx(Binary) datatype that properly sniffs the file and allows Upload File to properly detect the file and upload it. Affected #: 2 files diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 7111e4f6a3d1d95dac9f5f0e194c020e22ca4dbc config/datatypes_conf.xml.sample --- a/config/datatypes_conf.xml.sample +++ b/config/datatypes_conf.xml.sample @@ -253,6 +253,8 @@ <datatype extension="xgmml" type="galaxy.datatypes.graph:Xgmml" display_in_upload="true"/><datatype extension="sif" type="galaxy.datatypes.graph:Sif" display_in_upload="true"/><datatype extension="rdf" type="galaxy.datatypes.graph:Rdf" display_in_upload="true"/> + <!-- Excel datatypes --> + <datatype extension="xlsx" type="galaxy.datatypes.binary:Xlsx" display_in_upload="true" /></registration><sniffers><!-- diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 7111e4f6a3d1d95dac9f5f0e194c020e22ca4dbc lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -12,6 +12,7 @@ import subprocess import tempfile import re +import zipfile from galaxy import eggs eggs.require( "bx-python" ) @@ -279,6 +280,24 @@ except: return "Binary bam alignments file (%s)" % ( data.nice_size( dataset.get_size() ) ) + +class Xlsx(Binary): + """Class for Excel 2007 (xlsx) files""" + file_ext="xlsx" + def sniff( self, filename ): + # Xlsx is compressed in zip format and must not be uncompressed in Galaxy. + try: + if zipfile.is_zipfile( filename ): + tempzip = zipfile.ZipFile( filename ) + if "[Content_Types].xml" in tempzip.namelist() and tempzip.read("[Content_Types].xml").find(b'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml') != -1: + return True + return False + except: + return False + +Binary.register_sniffable_binary_format("xlsx", "xlsx", Xlsx) + + # ------------- Dataproviders # pipe through samtools view #ALSO: (as Sam) https://bitbucket.org/galaxy/galaxy-central/commits/16425b81c25e/ Changeset: 16425b81c25e User: dannon Date: 2014-10-13 15:23:01+00:00 Summary: Merged in hunter_moseley/galaxy-central (pull request #526) Added an Xlsx(Binary) datatype that allows Upload File to properly detect the file and upload it. Affected #: 2 files diff -r 738cdb119ce34e570224eb87ee7a270caa53f39b -r 16425b81c25e3d806a9e5594773612599e68b785 config/datatypes_conf.xml.sample --- a/config/datatypes_conf.xml.sample +++ b/config/datatypes_conf.xml.sample @@ -253,6 +253,8 @@ <datatype extension="xgmml" type="galaxy.datatypes.graph:Xgmml" display_in_upload="true"/><datatype extension="sif" type="galaxy.datatypes.graph:Sif" display_in_upload="true"/><datatype extension="rdf" type="galaxy.datatypes.graph:Rdf" display_in_upload="true"/> + <!-- Excel datatypes --> + <datatype extension="xlsx" type="galaxy.datatypes.binary:Xlsx" display_in_upload="true" /></registration><sniffers><!-- diff -r 738cdb119ce34e570224eb87ee7a270caa53f39b -r 16425b81c25e3d806a9e5594773612599e68b785 lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -12,6 +12,7 @@ import subprocess import tempfile import re +import zipfile from galaxy import eggs eggs.require( "bx-python" ) @@ -279,6 +280,24 @@ except: return "Binary bam alignments file (%s)" % ( data.nice_size( dataset.get_size() ) ) + +class Xlsx(Binary): + """Class for Excel 2007 (xlsx) files""" + file_ext="xlsx" + def sniff( self, filename ): + # Xlsx is compressed in zip format and must not be uncompressed in Galaxy. + try: + if zipfile.is_zipfile( filename ): + tempzip = zipfile.ZipFile( filename ) + if "[Content_Types].xml" in tempzip.namelist() and tempzip.read("[Content_Types].xml").find(b'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml') != -1: + return True + return False + except: + return False + +Binary.register_sniffable_binary_format("xlsx", "xlsx", Xlsx) + + # ------------- Dataproviders # pipe through samtools view #ALSO: (as Sam) 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