Mercurial > repos > cstrittmatter > test_eurl_vtec_wgs_pt
comparison scripts/fastq_positional_quality_trimming.py @ 3:0cbed1c0a762 draft default tip
planemo upload commit 15239f1674081ab51ab8dd75a9a40cf1bfaa93e8
author | cstrittmatter |
---|---|
date | Tue, 28 Jan 2020 10:42:31 -0500 |
parents | 965517909457 |
children |
comparison
equal
deleted
inserted
replaced
2:6837f733b4aa | 3:0cbed1c0a762 |
---|---|
88 passing_reads = 0 | 88 passing_reads = 0 |
89 trimmed_forward = open(options.trimmed1, 'w') | 89 trimmed_forward = open(options.trimmed1, 'w') |
90 log = open(options.logfile, 'w') | 90 log = open(options.logfile, 'w') |
91 try: | 91 try: |
92 while True: | 92 while True: |
93 headL = forward.next().rstrip() | 93 headL = next(forward).rstrip() |
94 sequL = forward.next().rstrip() | 94 sequL = next(forward).rstrip() |
95 commL = forward.next().rstrip() | 95 commL = next(forward).rstrip() |
96 sangL = forward.next().rstrip() | 96 sangL = next(forward).rstrip() |
97 qualL = sanger2phred(sangL) | 97 qualL = sanger2phred(sangL) |
98 trimmed_sequL, trimmed_qualL = trimming(sequL, qualL, maxlengthtrim, lefttrim, righttrim, minqualtrim, avgqualtrim) | 98 trimmed_sequL, trimmed_qualL = trimming(sequL, qualL, maxlengthtrim, lefttrim, righttrim, minqualtrim, avgqualtrim) |
99 if paired: | 99 if paired: |
100 try: | 100 try: |
101 headR = reverse.next().rstrip() | 101 headR = next(reverse).rstrip() |
102 sequR = reverse.next().rstrip() | 102 sequR = next(reverse).rstrip() |
103 commR = reverse.next().rstrip() | 103 commR = next(reverse).rstrip() |
104 sangR = reverse.next().rstrip() | 104 sangR = next(reverse).rstrip() |
105 except StopIteration: | 105 except StopIteration: |
106 sys.exit('Reverse FASTQ file contain less reads than forward FASTQ file.') | 106 sys.exit('Reverse FASTQ file contain less reads than forward FASTQ file.') |
107 qualR = sanger2phred(sangR) | 107 qualR = sanger2phred(sangR) |
108 trimmed_sequR, trimmed_qualR = trimming(sequR, qualR, maxlengthtrim, lefttrim, righttrim, minqualtrim, avgqualtrim) | 108 trimmed_sequR, trimmed_qualR = trimming(sequR, qualR, maxlengthtrim, lefttrim, righttrim, minqualtrim, avgqualtrim) |
109 # Filter by residual length | 109 # Filter by residual length |
128 discarded_reads += 1 | 128 discarded_reads += 1 |
129 total_reads += 1 | 129 total_reads += 1 |
130 except StopIteration: | 130 except StopIteration: |
131 if paired: | 131 if paired: |
132 try: | 132 try: |
133 reverse.next() | 133 next(reverse) |
134 except StopIteration: | 134 except StopIteration: |
135 log.write("Total paired reads : %d\n" % total_reads) | 135 log.write("Total paired reads : %d\n" % total_reads) |
136 log.write("Passing paired reads : %d\n" % passing_paired_reads) | 136 log.write("Passing paired reads : %d\n" % passing_paired_reads) |
137 log.write("Passing unpaired reads : %d\n" % passing_unpaired_reads) | 137 log.write("Passing unpaired reads : %d\n" % passing_unpaired_reads) |
138 log.write("Discarded paired reads : %d\n" % discarded_reads) | 138 log.write("Discarded paired reads : %d\n" % discarded_reads) |