changeset 0:12afb0ecb55f draft

Uploaded
author lecorguille
date Tue, 30 Jun 2015 05:36:05 -0400
parents
children 7800ba9a4c1e
files README datatypes_conf.xml no_unzip_datatypes.py
diffstat 3 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README	Tue Jun 30 05:36:05 2015 -0400
@@ -0,0 +1,1 @@
+2014-09-08 INFO: no_unzip_datatypes is a perfect clone of the prims masscomb datatype FileSet
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datatypes_conf.xml	Tue Jun 30 05:36:05 2015 -0400
@@ -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>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/no_unzip_datatypes.py	Tue Jun 30 05:36:05 2015 -0400
@@ -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) 
+    
+    
+    
+    
+    
+    
+
+
+