Next changeset 1:7800ba9a4c1e (2015-08-25) |
Commit message:
Uploaded |
added:
README datatypes_conf.xml no_unzip_datatypes.py |
b |
diff -r 000000000000 -r 12afb0ecb55f README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Tue Jun 30 05:36:05 2015 -0400 |
b |
@@ -0,0 +1,1 @@ +2014-09-08 INFO: no_unzip_datatypes is a perfect clone of the prims masscomb datatype FileSet |
b |
diff -r 000000000000 -r 12afb0ecb55f datatypes_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datatypes_conf.xml Tue Jun 30 05:36:05 2015 -0400 |
b |
@@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<datatypes> + <registration> + <datatype extension="no_unzip.zip" type="galaxy.datatypes.no_unzip_datatypes:NoUnzip" display_in_upload="true" /> + </registration> +</datatypes> |
b |
diff -r 000000000000 -r 12afb0ecb55f no_unzip_datatypes.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/no_unzip_datatypes.py Tue Jun 30 05:36:05 2015 -0400 |
b |
@@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +""" +no_unzip_datatypes + +A perfect clone of the prims masscomb datatype FileSet +""" + +import logging +import zipfile +import os,os.path,re +from galaxy.datatypes.data import * +from galaxy.datatypes.xml import * +from galaxy.datatypes.sniff import * +from galaxy.datatypes.binary import * +from galaxy.datatypes.interval import * + +log = logging.getLogger(__name__) + + +class NoUnzip( Binary ): + """FileSet containing N files""" + file_ext = "no_unzip.zip" + blurb = "(zipped) FileSet containing multiple files" + + def sniff( self, filename ): + # If the zip file contains multiple files then return true, false otherwise: + zf = zipfile.ZipFile(filename) + if (len(zf.infolist())>1): + return True + else : + return False + + +# the if is just for backwards compatibility...could remove this at some point +if hasattr(Binary, 'register_sniffable_binary_format'): + Binary.register_sniffable_binary_format('NoUnzip', 'no_unzip.zip', NoUnzip) + + + + + + + + + |