diff rgFastQC.py @ 11:db2dc6bc8f05 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
author iuc
date Thu, 20 Apr 2017 11:06:17 -0400
parents a00a6402d09a
children f2e8552cf1d0
line wrap: on
line diff
--- a/rgFastQC.py	Wed Feb 08 12:43:43 2017 -0500
+++ b/rgFastQC.py	Thu Apr 20 11:06:17 2017 -0400
@@ -48,20 +48,23 @@
         # This prevents uncompression of already uncompressed files
         infname = self.opts.inputfilename
         linf = infname.lower()
+        informat = self.opts.informat
         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
-        type = mimetypes.guess_type(self.opts.input)
-        if linf.endswith('.gz') or linf.endswith('.gzip') or type[-1] == "gzip":
+        ftype = mimetypes.guess_type(self.opts.input)
+        if linf.endswith('.gz') or linf.endswith('.gzip') or ftype[-1] == "gzip" or informat.endswith('.gz'):
             f = gzip.open(self.opts.input)
             try:
                 f.readline()
+                ftype = ['gzip']
             except:
                 trimext = True
             f.close()
-        elif linf.endswith('bz2'):
+        elif linf.endswith('bz2') or informat.endswith('.bz2'):
             f = bz2.BZ2File(self.opts.input, 'r')
             try:
+                ftype = ['bzip2']
                 f.readline()
             except:
                 trimext = True
@@ -95,10 +98,12 @@
             command_line.append('--limits %s' % self.opts.limits)
         command_line.append('--quiet')
         command_line.append('--extract')  # to access the output text file
-        if type[-1] != "gzip":
+        if ftype[-1] == 'gzip':
+            self.fastqinfilename += '.gz'
+        elif ftype[-1] == 'bzip2':
+            self.fastqinfilename += '.bz2'
+        else:
             command_line.append('-f %s' % self.opts.informat)
-        else:
-            self.fastqinfilename += ".gz"
         command_line.append(self.fastqinfilename)
         self.command_line = ' '.join(command_line)