Mercurial > repos > devteam > fastqc
comparison 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 |
comparison
equal
deleted
inserted
replaced
10:a00a6402d09a | 11:db2dc6bc8f05 |
---|---|
46 | 46 |
47 # Check whether a given file compression format is valid | 47 # Check whether a given file compression format is valid |
48 # This prevents uncompression of already uncompressed files | 48 # This prevents uncompression of already uncompressed files |
49 infname = self.opts.inputfilename | 49 infname = self.opts.inputfilename |
50 linf = infname.lower() | 50 linf = infname.lower() |
51 informat = self.opts.informat | |
51 trimext = False | 52 trimext = False |
52 # decompression at upload currently does NOT remove this now bogus ending - fastqc will barf | 53 # decompression at upload currently does NOT remove this now bogus ending - fastqc will barf |
53 # patched may 29 2013 until this is fixed properly | 54 # patched may 29 2013 until this is fixed properly |
54 type = mimetypes.guess_type(self.opts.input) | 55 ftype = mimetypes.guess_type(self.opts.input) |
55 if linf.endswith('.gz') or linf.endswith('.gzip') or type[-1] == "gzip": | 56 if linf.endswith('.gz') or linf.endswith('.gzip') or ftype[-1] == "gzip" or informat.endswith('.gz'): |
56 f = gzip.open(self.opts.input) | 57 f = gzip.open(self.opts.input) |
57 try: | 58 try: |
58 f.readline() | 59 f.readline() |
60 ftype = ['gzip'] | |
59 except: | 61 except: |
60 trimext = True | 62 trimext = True |
61 f.close() | 63 f.close() |
62 elif linf.endswith('bz2'): | 64 elif linf.endswith('bz2') or informat.endswith('.bz2'): |
63 f = bz2.BZ2File(self.opts.input, 'r') | 65 f = bz2.BZ2File(self.opts.input, 'r') |
64 try: | 66 try: |
67 ftype = ['bzip2'] | |
65 f.readline() | 68 f.readline() |
66 except: | 69 except: |
67 trimext = True | 70 trimext = True |
68 f.close() | 71 f.close() |
69 elif linf.endswith('.zip'): | 72 elif linf.endswith('.zip'): |
93 command_line.append('--contaminants %s' % self.opts.contaminants) | 96 command_line.append('--contaminants %s' % self.opts.contaminants) |
94 if self.opts.limits is not None: | 97 if self.opts.limits is not None: |
95 command_line.append('--limits %s' % self.opts.limits) | 98 command_line.append('--limits %s' % self.opts.limits) |
96 command_line.append('--quiet') | 99 command_line.append('--quiet') |
97 command_line.append('--extract') # to access the output text file | 100 command_line.append('--extract') # to access the output text file |
98 if type[-1] != "gzip": | 101 if ftype[-1] == 'gzip': |
102 self.fastqinfilename += '.gz' | |
103 elif ftype[-1] == 'bzip2': | |
104 self.fastqinfilename += '.bz2' | |
105 else: | |
99 command_line.append('-f %s' % self.opts.informat) | 106 command_line.append('-f %s' % self.opts.informat) |
100 else: | |
101 self.fastqinfilename += ".gz" | |
102 command_line.append(self.fastqinfilename) | 107 command_line.append(self.fastqinfilename) |
103 self.command_line = ' '.join(command_line) | 108 self.command_line = ' '.join(command_line) |
104 | 109 |
105 def copy_output_file_to_dataset(self): | 110 def copy_output_file_to_dataset(self): |
106 ''' | 111 ''' |