annotate BSseeker2/FilterReads.py @ 1:8b26adf64adc draft default tip

V2.0.5
author weilong-guo
date Tue, 05 Nov 2013 01:55:39 -0500
parents e6df770c0e58
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
weilong-guo
parents: 0
diff changeset
1 #!/usr/bin/env python
0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
2
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
3 import sys
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
4 import os
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
5 import os.path
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
6 import re
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
7
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
8 # Define the Dictionary & the Reverse Dictionary for barcode
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
9
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
10 # ===========================================
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
11 #
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
12 def FilterFastq (infile, outfile) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
13 try:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
14 INFILE = open(infile, 'r')
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
15 except IOError:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
16 print "\n[Error]:\n\t File cannot be open: ", infile;
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
17 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
18 try:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
19 OUTFILE = open(outfile, 'w')
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
20 except IOError:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
21 print "\n[Error]:\n\t File cannot be open: ", outfile;
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
22 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
23 Dict = {}
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
24 count = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
25 total = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
26 while 1 :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
27 line1 = INFILE.readline()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
28 if not line1 :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
29 break
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
30 line1 = line1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
31 line2 = INFILE.readline()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
32 line3 = INFILE.readline()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
33 line4 = INFILE.readline()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
34 total += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
35 # print line2
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
36 if ( line2 in Dict ) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
37 Dict[line2] += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
38 else :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
39 Dict[line2] = 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
40 OUTFILE.write(line1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
41 OUTFILE.write(line2)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
42 OUTFILE.write(line3)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
43 OUTFILE.write(line4)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
44 count += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
45 INFILE.close()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
46 OUTFILE.close()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
47 print "Count of total raw reads: ", total
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
48 print "Count of reads left: ", count
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
49 print "Percentage of kept reads: %.2f" % (count * 100.0 /total), "%"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
50
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
51
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
52 # ===============================
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
53 #
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
54
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
55 def FilterSequence (infile, outfile) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
56 try:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
57 INFILE = open(infile, 'r')
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
58 except IOError:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
59 print "\n[Error]:\n\t File cannot be open: ", infile;
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
60 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
61 try:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
62 OUTFILE = open(outfile, 'w')
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
63 except IOError:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
64 print "\n[Error]:\n\t File cannot be open: ", outfile;
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
65 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
66 Dict = {}
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
67 count = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
68 total = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
69 for line in INFILE:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
70 line = line.strip()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
71 total += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
72 if ( line in Dict ) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
73 Dict[line] += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
74 else :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
75 Dict[line] = 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
76 count += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
77 OUTFILE.write(line + "\n")
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
78 INFILE.close()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
79 OUTFILE.close()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
80 print "Count of total raw reads: ", total
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
81 print "Count of reads left: ", count
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
82 print "Percentage of kept reads: %.2f" % (count * 100.0 /total), "%"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
83
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
84 # ===============================
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
85 # SN603 WA047 6 1101 41.40 99.10 0 1 .GGGA.......TTAG.............. @SZ__@@@@@@@RR__@@@@@@@@@@@@@@ 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
86 #
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
87 def FilterQseq (infile, outfile, keepquality) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
88 if keepquality :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
89 print "User specified '-k' and read quality will not be considered"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
90 else :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
91 print "Reads with PF=0 will be filtered"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
92
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
93 try:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
94 INFILE = open(infile, 'r')
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
95 except IOError:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
96 print "\n[Error]:\n\t File cannot be open: ", infile;
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
97 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
98 try:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
99 OUTFILE = open(outfile, 'w')
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
100 except IOError:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
101 print "\n[Error]:\n\t File cannot be open: ", outfile;
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
102 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
103 Dict = {}
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
104 count = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
105 total = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
106 for line in INFILE:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
107 tokens = line.strip().split()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
108 total += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
109 if ( (not keepquality and tokens[10] == "1") or keepquality ) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
110 if ( tokens[8] in Dict ) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
111 Dict[tokens[8]] += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
112 else :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
113 Dict[tokens[8]] = 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
114 count += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
115 OUTFILE.write(line)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
116
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
117 INFILE.close()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
118 OUTFILE.close()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
119 print "Count of total raw reads: ", total
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
120 print "Count of reads left: ", count
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
121 print "Percentage of kept reads: %.2f" % (count * 100.0 /total), "%"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
122
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
123
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
124 # ===============================
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
125 #
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
126
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
127 def FilterFasta (infile, outfile) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
128 try:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
129 INFILE = open(infile, 'r')
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
130 except IOError:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
131 print "\n[Error]:\n\t File cannot be open: ", infile;
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
132 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
133 try:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
134 OUTFILE = open(outfile, 'w')
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
135 except IOError:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
136 print "\n[Error]:\n\t File cannot be open: ", outfile;
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
137 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
138 Dict = {}
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
139 count = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
140 total = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
141 name = ""
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
142 read = ""
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
143 for line in INFILE:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
144 line = line.strip()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
145 if (line[0] == '>') :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
146 total += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
147 if ( name != "" ) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
148 if ( read in Dict ) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
149 Dict[read] += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
150 else :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
151 Dict[read] = 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
152 count += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
153 OUTFILE.write(">" + name + "\n")
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
154 OUTFILE.write(read + "\n")
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
155 name = line[1:]
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
156 read = ""
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
157 else :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
158 read = read + line
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
159 if (name != "") :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
160 if ( read in Dict ) :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
161 Dict[read] += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
162 else :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
163 Dict[read] = 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
164 count += 1
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
165 OUTFILE.write(">" + name + "\n")
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
166 OUTFILE.write(read + "\n")
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
167 print "Count of total raw reads: ", total
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
168 print "Count of reads left: ", count
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
169 print "Percentage of kept reads: %.2f" % (count * 100.0 /total), "%"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
170
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
171
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
172
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
173 # ==============================
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
174 # Decide branch functions for different format
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
175
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
176 def FilterReads (infile, outfile, keepquality):
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
177 try:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
178 INFILE = open(infile, 'r')
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
179 except IOError:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
180 print "\n[Error]:\n\t File cannot be open: ", infile;
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
181 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
182 i = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
183 # Count the numbers of barcodes in first 10000 lines
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
184 line = INFILE.readline()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
185 tokens = line.strip().split()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
186 input_format="";
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
187 if line[0]=="@" :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
188 input_format = "FastQ"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
189 n_fastq = 0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
190 elif len(tokens) == 1 and line[0] != ">":
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
191 input_format = "sequence"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
192 elif len(tokens) == 11:
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
193 input_format = "qseq"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
194 elif line[0]==">" :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
195 input_format = "fasta"
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
196 INFILE.close()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
197
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
198 print "Input file format detected: ", input_format
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
199
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
200 if input_format == "FastQ" :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
201 FilterFastq(infile, outfile)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
202 elif input_format == "sequence" :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
203 FilterSequence(infile, outfile)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
204 elif input_format == "qseq" :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
205 FilterQseq(infile, outfile, keepquality)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
206 elif input_format == "fasta" :
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
207 FilterFasta(infile, outfile)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
208
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
209
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
210 from optparse import OptionParser
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
211
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
212 # ===========================================
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
213 def main():
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
214 usage = "Usage: %prog -i <input> -o <output> [-k]\n" \
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
215 "Author : Guo, Weilong; guoweilong@gmail.com; 2012-11-10\n" \
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
216 "Last Update: 2013-04-01" \
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
217 "Description: Unique reads for qseq/fastq/fasta/sequencce,\n" \
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
218 " and filter low quality reads in qseq file."
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
219 parser = OptionParser(usage)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
220 parser.add_option("-i", dest="infile",
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
221 help="Name of the input qseq/fastq/fasta/sequence file", metavar="FILE")
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
222 parser.add_option("-o", dest="outfile",
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
223 help="Name of the output file", metavar="FILE")
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
224 parser.add_option("-k", dest="keepquality", default = False, action = "store_true",
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
225 help="Would not filter low quality reads if specified")
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
226 (options, args) = parser.parse_args()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
227
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
228 if (options.infile is None) or (options.outfile is None) :
1
weilong-guo
parents: 0
diff changeset
229 parser.print_help()
0
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
230 exit(-1)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
231 FilterReads(options.infile, options.outfile, options.keepquality)
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
232
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
233
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
234 # ===========================================
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
235 if __name__ == "__main__":
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
236 main()
e6df770c0e58 Initial upload
weilong-guo
parents:
diff changeset
237