Mercurial > repos > devteam > fastqc
comparison rgFastQC.py @ 9:3a458e268066 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:51 -0400 |
parents | 06819360a9e2 |
children | a00a6402d09a |
comparison
equal
deleted
inserted
replaced
8:06819360a9e2 | 9:3a458e268066 |
---|---|
26 import tempfile | 26 import tempfile |
27 import glob | 27 import glob |
28 import gzip | 28 import gzip |
29 import bz2 | 29 import bz2 |
30 import zipfile | 30 import zipfile |
31 import mimetypes | |
31 | 32 |
32 class FastQCRunner(object): | 33 class FastQCRunner(object): |
33 | 34 |
34 def __init__(self,opts=None): | 35 def __init__(self,opts=None): |
35 ''' | 36 ''' |
50 infname = self.opts.inputfilename | 51 infname = self.opts.inputfilename |
51 linf = infname.lower() | 52 linf = infname.lower() |
52 trimext = False | 53 trimext = False |
53 # decompression at upload currently does NOT remove this now bogus ending - fastqc will barf | 54 # decompression at upload currently does NOT remove this now bogus ending - fastqc will barf |
54 # patched may 29 2013 until this is fixed properly | 55 # patched may 29 2013 until this is fixed properly |
55 if ( linf.endswith('.gz') or linf.endswith('.gzip') ): | 56 type = mimetypes.guess_type(self.opts.input) |
57 if linf.endswith('.gz') or linf.endswith('.gzip') or type[-1] == "gzip": | |
56 f = gzip.open(self.opts.input) | 58 f = gzip.open(self.opts.input) |
57 try: | 59 try: |
58 f.readline() | 60 f.readline() |
59 except: | 61 except: |
60 trimext = True | 62 trimext = True |
93 command_line.append('--contaminants %s' % opts.contaminants) | 95 command_line.append('--contaminants %s' % opts.contaminants) |
94 if opts.limits != None: | 96 if opts.limits != None: |
95 command_line.append('--limits %s' % opts.limits) | 97 command_line.append('--limits %s' % opts.limits) |
96 command_line.append('--quiet') | 98 command_line.append('--quiet') |
97 command_line.append('--extract') # to access the output text file | 99 command_line.append('--extract') # to access the output text file |
100 if type[-1] != "gzip": | |
101 command_line.append('-f %s' % opts.informat) | |
102 else: | |
103 self.fastqinfilename += ".gz" | |
98 command_line.append(self.fastqinfilename) | 104 command_line.append(self.fastqinfilename) |
99 command_line.append('-f %s' % opts.informat) | |
100 self.command_line = ' '.join(command_line) | 105 self.command_line = ' '.join(command_line) |
101 | 106 |
102 def copy_output_file_to_dataset(self): | 107 def copy_output_file_to_dataset(self): |
103 ''' | 108 ''' |
104 Retrieves the output html and text files from the output directory and copies them to the Galaxy output files | 109 Retrieves the output html and text files from the output directory and copies them to the Galaxy output files |