diff rgFastQC.py @ 7:ec73b7c83b2c draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit 8918618a5ef7bdca55a31cd919efa593044a376e
author devteam
date Wed, 02 Nov 2016 16:12:38 -0400
parents e8c90ad3cbf9
children 5b995cef2fbb
line wrap: on
line diff
--- a/rgFastQC.py	Mon Oct 31 10:40:00 2016 -0400
+++ b/rgFastQC.py	Wed Nov 02 16:12:38 2016 -0400
@@ -28,6 +28,7 @@
 import gzip
 import bz2
 import zipfile
+import mimetypes
 
 class FastQCRunner(object):
 
@@ -52,7 +53,8 @@
         trimext = False
         # decompression at upload currently does NOT remove this now bogus ending - fastqc will barf
         # patched may 29 2013 until this is fixed properly
-        if ( linf.endswith('.gz') or linf.endswith('.gzip') ):
+        type = mimetypes.guess_type(self.opts.input)
+        if linf.endswith('.gz') or linf.endswith('.gzip') or type[-1] == "gzip":
             f = gzip.open(self.opts.input)
             try:
                 f.readline()
@@ -95,8 +97,11 @@
 	    command_line.append('--limits %s' % opts.limits)
         command_line.append('--quiet')
         command_line.append('--extract') # to access the output text file
+	if type[-1] != "gzip":
+            command_line.append('-f %s' % opts.informat)
+	else:
+	    self.fastqinfilename += ".gz"
         command_line.append(self.fastqinfilename)
-        command_line.append('-f %s' % opts.informat)
         self.command_line = ' '.join(command_line)
 
     def copy_output_file_to_dataset(self):