annotate yac.py @ 0:ad6b978daa2e draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
author artbio
date Wed, 26 Jul 2017 13:35:39 -0400
parents
children 7c913274e22a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
1 #!/usr/bin/python
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
2 # yac = yet another clipper
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
3 # v 1.2.1 - 23-08-2014 - Support FastQ output
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
4 # v 1.1.0 - 23-08-2014 - argparse implementation
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
5 # Usage yac.py $input $output $adapter_to_clip $min $max $Nmode
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
6 # Christophe Antoniewski <drosofff@gmail.com>
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
7
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
8 import sys
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
9 import string
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
10 import argparse
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
11 from itertools import islice
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
12
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
13
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
14 def Parser():
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
15 the_parser = argparse.ArgumentParser()
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
16 the_parser.add_argument(
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
17 '--input', action="store", nargs='+', help="input fastq files")
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
18 the_parser.add_argument(
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
19 '--output', action="store", type=str, help="output, clipped fasta file")
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
20 the_parser.add_argument(
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
21 '--output_format', action="store", type=str, help="output format, fasta or fastq")
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
22 the_parser.add_argument(
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
23 '--adapter_to_clip', action="store", type=str, help="adapter sequence to clip")
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
24 the_parser.add_argument(
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
25 '--min', action="store", type=int, help="minimal size of clipped sequence to keep")
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
26 the_parser.add_argument(
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
27 '--max', action="store", type=int, help="maximal size of clipped sequence to keep")
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
28 the_parser.add_argument('--Nmode', action="store", type=str, choices=[
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
29 "accept", "reject"], help="accept or reject sequences with N for clipping")
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
30 args = the_parser.parse_args()
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
31 args.adapter_to_clip = args.adapter_to_clip.upper()
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
32 return args
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
33
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
34
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
35 class Clip:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
36
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
37 def __init__(self, inputfile, outputfile, output_format, adapter, minsize, maxsize, Nmode):
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
38 self.inputfile = inputfile
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
39 self.outputfile = outputfile
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
40 self.output_format = output_format
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
41 self.adapter = adapter
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
42 self.minsize = int(minsize)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
43 self.maxsize = int(maxsize)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
44 self.Nmode = Nmode
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
45
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
46 def motives(sequence):
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
47 '''return a list of motives for perfect (6nt) or imperfect (7nt with one mismatch) search on import string module'''
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
48 sequencevariants = [
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
49 sequence[0:6]] # initializes the list with the 6mer perfect match
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
50 dicsubst = {"A": "TGCN", "T": "AGCN", "G": "TACN", "C": "GATN"}
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
51 for pos in enumerate(sequence[:6]):
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
52 for subst in dicsubst[pos[1]]:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
53 sequencevariants.append(
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
54 sequence[:pos[0]] + subst + sequence[pos[0] + 1:7])
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
55 return sequencevariants
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
56 self.adaptmotifs = motives(self.adapter)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
57
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
58 def scanadapt(self, adaptmotives=[], sequence="", qscore=""):
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
59 '''scans sequence for adapter motives'''
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
60 match_position = sequence.rfind(adaptmotives[0])
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
61 if match_position != -1:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
62 return sequence[:match_position], qscore[:match_position]
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
63 for motif in adaptmotives[1:]:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
64 match_position = sequence.rfind(motif)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
65 if match_position != -1:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
66 return sequence[:match_position], qscore[:match_position]
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
67 return sequence, qscore
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
68
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
69 def write_output(self, id, read, qscore, output):
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
70 if self.output_format == "fasta":
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
71 block = ">{0}\n{1}\n".format(id, read)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
72 else:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
73 block = "@HWI-{0}\n{1}\n+\n{2}\n".format(id, read, qscore)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
74 output.write(block)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
75
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
76 def handle_io(self):
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
77 '''Open input file, pass read sequence and read qscore to clipping function.
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
78 Pass clipped read and qscore to output function.'''
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
79 id = 0
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
80 output = open(self.outputfile, "a")
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
81 with open(self.inputfile, "r") as input:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
82 block_gen = islice(input, 1, None, 2)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
83 for i, line in enumerate(block_gen):
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
84 if i % 2:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
85 qscore = line.rstrip()
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
86 else:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
87 read = line.rstrip()
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
88 continue
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
89 trimmed_read, trimmed_qscore = self.scanadapt(
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
90 self.adaptmotifs, read, qscore)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
91 if self.minsize <= len(trimmed_read) <= self.maxsize:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
92 if (self.Nmode == "reject") and ("N" in trimmed_read):
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
93 continue
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
94 id += 1
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
95 self.write_output(id, trimmed_read, trimmed_qscore, output)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
96 output.close()
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
97
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
98
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
99 def main(*argv):
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
100 instanceClip = Clip(*argv)
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
101 instanceClip.handle_io()
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
102
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
103 if __name__ == "__main__":
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
104 args = Parser()
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
105 id = 0
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
106 for inputfile in args.input:
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
107 main(inputfile, args.output, args.output_format,
ad6b978daa2e planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit e9cf2978954c546bb90eb11931f9cfd6562156f3
artbio
parents:
diff changeset
108 args.adapter_to_clip, args.min, args.max, args.Nmode)