annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
1 """
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
2 Rewrite of rgFastQC.py for Version 0.11.2 of FastQC.
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
3
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
4 Changes implemented from tmcgowan at
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
5 https://testtoolshed.g2.bx.psu.edu/view/tmcgowan/fastqc
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
6 and iuc at https://toolshed.g2.bx.psu.edu/view/iuc/fastqc
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
7 with minor changes and bug fixes
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
8
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
9 SYNOPSIS
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
10
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
11 rgFastQC.py -i input_file -j input_file.name -o output_html_file [-d output_directory]
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
12 [-f fastq|bam|sam] [-n job_name] [-c contaminant_file] [-e fastqc_executable]
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
13
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
14 EXAMPLE (generated by Galaxy)
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
15
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
16 rgFastQC.py -i path/dataset_1.dat -j 1000gsample.fastq -o path/dataset_3.dat -d path/job_working_directory/subfolder
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
17 -f fastq -n FastQC -c path/dataset_2.dat -e fastqc
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
18 """
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
19 import bz2
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
20 import glob
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
21 import gzip
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
22 import mimetypes
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
23 import optparse
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
24 import os
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
25 import re
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
26 import shutil
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
27 import subprocess
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
28 import tempfile
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
29 import zipfile
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
30
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
31
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
32 class FastQCRunner(object):
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
33 def __init__(self, opts=None):
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
34 '''
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
35 Initializes an object to run FastQC in Galaxy. To start the process, use the function run_fastqc()
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
36 '''
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
37
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
38 # Check whether the options are specified and saves them into the object
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
39 assert opts is not None
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
40 self.opts = opts
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
41
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
42 def prepare_command_line(self):
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
43 '''
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
44 Develops the Commandline to run FastQC in Galaxy
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
45 '''
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
46
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
47 # Check whether a given file compression format is valid
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
48 # This prevents uncompression of already uncompressed files
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
49 infname = self.opts.inputfilename
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
50 linf = infname.lower()
11
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
51 informat = self.opts.informat
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
52 trimext = False
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
53 # decompression at upload currently does NOT remove this now bogus ending - fastqc will barf
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
54 # patched may 29 2013 until this is fixed properly
11
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
55 ftype = mimetypes.guess_type(self.opts.input)
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
56 if linf.endswith('.gz') or linf.endswith('.gzip') or ftype[-1] == "gzip" or informat.endswith('.gz'):
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
57 f = gzip.open(self.opts.input)
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
58 try:
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
59 f.readline()
11
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
60 ftype = ['gzip']
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
61 except:
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
62 trimext = True
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
63 f.close()
11
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
64 elif linf.endswith('bz2') or informat.endswith('.bz2'):
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
65 f = bz2.BZ2File(self.opts.input, 'r')
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
66 try:
11
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
67 ftype = ['bzip2']
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
68 f.readline()
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
69 except:
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
70 trimext = True
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
71 f.close()
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
72 elif linf.endswith('.zip'):
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
73 if not zipfile.is_zipfile(self.opts.input):
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
74 trimext = True
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
75 if trimext:
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
76 f = open(self.opts.input)
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
77 try:
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
78 f.readline()
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
79 except:
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
80 raise Exception("Input file corruption, could not identify the filetype")
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
81 infname = os.path.splitext(infname)[0]
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
82
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
83 # Replace unwanted or problematic charaters in the input file name
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
84 self.fastqinfilename = re.sub(r'[^a-zA-Z0-9_\-\.]', '_', os.path.basename(infname))
4
8c650f7f76e9 Uploaded
devteam
parents: 3
diff changeset
85 # check that the symbolic link gets a proper ending, fastqc seems to ignore the given format otherwise
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
86 if 'fastq' in self.opts.informat:
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
87 # with fastq the .ext is ignored, but when a format is actually passed it must comply with fastqc's
4
8c650f7f76e9 Uploaded
devteam
parents: 3
diff changeset
88 # accepted formats..
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
89 self.opts.informat = 'fastq'
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
90 elif not self.fastqinfilename.endswith(self.opts.informat):
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
91 self.fastqinfilename += '.%s' % self.opts.informat
4
8c650f7f76e9 Uploaded
devteam
parents: 3
diff changeset
92
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
93 # Build the Commandline from the given parameters
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
94 command_line = [opts.executable, '--outdir %s' % self.opts.outputdir]
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
95 if self.opts.contaminants is not None:
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
96 command_line.append('--contaminants %s' % self.opts.contaminants)
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
97 if self.opts.limits is not None:
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
98 command_line.append('--limits %s' % self.opts.limits)
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
99 command_line.append('--quiet')
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
100 command_line.append('--extract') # to access the output text file
11
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
101 if ftype[-1] == 'gzip':
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
102 self.fastqinfilename += '.gz'
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
103 elif ftype[-1] == 'bzip2':
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
104 self.fastqinfilename += '.bz2'
db2dc6bc8f05 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 168f7aeb0f9f38de6dec873f3cbf0c30014fdd72
iuc
parents: 10
diff changeset
105 else:
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
106 command_line.append('-f %s' % self.opts.informat)
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
107 command_line.append(self.fastqinfilename)
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
108 self.command_line = ' '.join(command_line)
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
109
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
110 def copy_output_file_to_dataset(self):
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
111 '''
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
112 Retrieves the output html and text files from the output directory and copies them to the Galaxy output files
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
113 '''
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
114
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
115 # retrieve html file
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
116 result_file = glob.glob(self.opts.outputdir + '/*html')
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
117 with open(result_file[0], 'rb') as fsrc:
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
118 with open(self.opts.htmloutput, 'wb') as fdest:
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
119 shutil.copyfileobj(fsrc, fdest)
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
120
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
121 # retrieve text file
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
122 text_file = glob.glob(self.opts.outputdir + '/*/fastqc_data.txt')
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
123 with open(text_file[0], 'rb') as fsrc:
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
124 with open(self.opts.textoutput, 'wb') as fdest:
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
125 shutil.copyfileobj(fsrc, fdest)
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
126
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
127 def run_fastqc(self):
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
128 '''
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
129 Executes FastQC. Make sure the mandatory import parameters input, inputfilename, outputdir and htmloutput have been specified in the options
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
130 '''
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
131
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
132 # Create a log file
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
133 dummy, tlog = tempfile.mkstemp(prefix='rgFastQC', suffix=".log", dir=self.opts.outputdir)
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
134 sout = open(tlog, 'w')
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
135
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
136 self.prepare_command_line()
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
137 sout.write(self.command_line)
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
138 sout.write('\n')
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
139 sout.write("Creating symlink\n") # between the input (.dat) file and the given input file name
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
140 os.symlink(self.opts.input, self.fastqinfilename)
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
141 sout.write("check_call\n")
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
142 subprocess.check_call(self.command_line, shell=True)
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
143 sout.write("Copying working %s file to %s \n" % (self.fastqinfilename, self.opts.htmloutput))
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
144 self.copy_output_file_to_dataset()
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
145 sout.write("Finished")
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
146 sout.close()
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
147
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
148
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
149 if __name__ == '__main__':
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
150 op = optparse.OptionParser()
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
151 op.add_option('-i', '--input', default=None)
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
152 op.add_option('-j', '--inputfilename', default=None)
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
153 op.add_option('-o', '--htmloutput', default=None)
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
154 op.add_option('-t', '--textoutput', default=None)
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
155 op.add_option('-d', '--outputdir', default="/tmp/shortread")
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
156 op.add_option('-f', '--informat', default='fastq')
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
157 op.add_option('-n', '--namejob', default='rgFastQC')
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
158 op.add_option('-c', '--contaminants', default=None)
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
159 op.add_option('-l', '--limits', default=None)
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
160 op.add_option('-e', '--executable', default='fastqc')
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
161 opts, args = op.parse_args()
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
162
10
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
163 assert opts.input is not None
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
164 assert opts.inputfilename is not None
a00a6402d09a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fastqc commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
iuc
parents: 9
diff changeset
165 assert opts.htmloutput is not None
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
166 if not os.path.exists(opts.outputdir):
0
e28c965eeed4 Imported from capsule None
devteam
parents:
diff changeset
167 os.makedirs(opts.outputdir)
8
06819360a9e2 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fastqc commit df4c0b0c6372e2984966e220fa42ecd8a3d370e8
devteam
parents: 7
diff changeset
168
1
8fae48caaf06 Uploaded form GH
devteam
parents: 0
diff changeset
169 fastqc_runner = FastQCRunner(opts)
3
0b201de108b9 Uploaded
devteam
parents: 1
diff changeset
170 fastqc_runner.run_fastqc()