annotate rapsodyn/PrepareFastqLight.pl @ 7:3f7b0788a1c4 draft

Uploaded
author mcharles
date Tue, 07 Oct 2014 10:34:34 -0400
parents b0cbb9d21aa9
children d857538d9fea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
1 #!/usr/bin/perl
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
2 #V1.0.1 added log, option parameters
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
3 use strict;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
4 use warnings;
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
5 use Getopt::Long;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
6
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
7 my $read1_file;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
8 my $read2_file;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
9 my $log_file;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
10 my $output1_file;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
11 my $output2_file;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
12
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
13 my $TYPE="sanger";
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
14 my $MIN_LENGTH=30;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
15 my $MIN_QUALITY=30;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
16
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
17 my $VERBOSE = "OFF";
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
18
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
19 GetOptions (
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
20 "read1_file=s" => \$read1_file,
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
21 "read2_file=s" => \$read2_file,
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
22 "log_file=s" => \$log_file,
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
23 "output1_file=s" => \$output1_file,
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
24 "output2_file=s" => \$output2_file,
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
25 "type=s" => \$TYPE,
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
26 "min_length=i" => \$MIN_LENGTH,
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
27 "min_quality=i" => \$MIN_QUALITY,
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
28 "verbose=s" => \$VERBOSE
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
29 ) or die("Error in command line arguments\n");
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
30
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
31
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
32 my $nb_read1=0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
33 my $nb_base_read1=0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
34 my $nb_read2=0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
35 my $nb_base_read2=0;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
36
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
37 my $nb_read1_t=0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
38 my $nb_base_read1_t=0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
39 my $nb_read2_t=0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
40 my $nb_base_read2_t=0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
41
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
42 my $nb_base_current_t=0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
43
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
44
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
45 open(READ1, $read1_file) or die ("Can't open $read1_file\n");
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
46 open(READ2, $read2_file) or die ("Can't open $read2_file\n");
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
47 open(OUT1, ">$output1_file") or die ("Can't open $output1_file\n");
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
48 open(OUT2, ">$output2_file") or die ("Can't open $output2_file\n");
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
49
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
50 my $error1=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
51 my $error2=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
52 my $error3=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
53 my $error4=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
54 my $error5=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
55 my $error6=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
56 my $error7=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
57 my $error8=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
58 my $error9=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
59 my $error10=0;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
60
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
61 while (my $ligne1_r1 =<READ1>){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
62 my $ligne2_r1 =<READ1>;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
63 my $ligne3_r1 =<READ1>;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
64 my $ligne4_r1 =<READ1>;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
65 my $ligne1_r2 =<READ2>;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
66 my $ligne2_r2 =<READ2>;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
67 my $ligne3_r2 =<READ2>;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
68 my $ligne4_r2 =<READ2>;
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
69
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
70 $nb_read1++;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
71 $nb_read2++;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
72
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
73 #@ 1 sec
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
74 if ((!$ligne1_r1)||(!$ligne2_r1)||(!$ligne3_r1)||(!$ligne4_r1)||(!$ligne1_r2)||(!$ligne2_r2)||(!$ligne3_r2)||(!$ligne4_r2)){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
75 if ($VERBOSE eq "ON"){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
76 print "Error in file format";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
77 if ($ligne1_r1){print $ligne1_r1;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
78 if ($ligne2_r1){print $ligne2_r1;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
79 if ($ligne3_r1){print $ligne3_r1;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
80 if ($ligne4_r1){print $ligne4_r1;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
81 if ($ligne1_r2){print $ligne1_r2;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
82 if ($ligne2_r2){print $ligne2_r2;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
83 if ($ligne3_r2){print $ligne3_r2;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
84 if ($ligne4_r2){print $ligne4_r2;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
85 print "\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
86 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
87 $error1++;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
88 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
89 elsif(($ligne1_r1 !~/^\@/)||($ligne1_r2 !~/^\@/)||($ligne3_r1 !~/^\+/)||($ligne3_r2 !~/^\+/)){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
90 if ($VERBOSE eq "ON"){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
91 print "Error in header : format\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
92 print $ligne1_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
93 print $ligne2_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
94 print $ligne3_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
95 print $ligne4_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
96 print $ligne1_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
97 print $ligne2_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
98 print $ligne3_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
99 print $ligne4_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
100 print "\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
101 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
102 $error2++;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
103 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
104 #@ 1 - 2 sec
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
105 else {
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
106
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
107 my $length_seq1 = length($ligne2_r1);
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
108 my $length_qual1 =length($ligne4_r1);
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
109 my $seq1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
110 my $qual1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
111
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
112 my $length_seq2 = length($ligne2_r2);
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
113 my $length_qual2 =length($ligne4_r2);
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
114 my $seq2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
115 my $qual2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
116 my $header1="";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
117 my $header2="";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
118 my $repheader1="";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
119 my $repheader2="";
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
120
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
121
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
122 if ($ligne1_r1 =~/^\@(.*?)\#/){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
123 $header1 = $1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
124 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
125
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
126 if ($ligne3_r1 =~/^\+(.*?)\#/){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
127 $repheader1 = $1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
128 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
129
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
130 if ($ligne1_r2 =~/^\@(.*?)\#/){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
131 $header2 = $1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
132 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
133
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
134 if ($ligne3_r2 =~/^\+(.*?)\#/){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
135 $repheader2 = $1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
136 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
137 #@ 2 sec
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
138
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
139 ### Verification de la coherence sequence /qualité @ 1 sec
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
140 if (($TYPE eq "illumina")&&((!$header1)||(!$header2)||(!$repheader1)||(!$repheader2))){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
141 if ($VERBOSE eq "ON"){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
142 print "Error in header : empty\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
143 print $ligne1_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
144 print $ligne2_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
145 print $ligne3_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
146 print $ligne4_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
147 print $ligne1_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
148 print $ligne2_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
149 print $ligne3_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
150 print $ligne4_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
151 print "\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
152 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
153 $error3++;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
154 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
155 elsif (($TYPE eq "sanger")&&((!$header1)||(!$header2))){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
156 if ($VERBOSE eq "ON"){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
157 print "Error in header refgsd : empty\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
158 print $ligne1_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
159 print $ligne2_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
160 print $ligne3_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
161 print $ligne4_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
162 print $ligne1_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
163 print $ligne2_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
164 print $ligne3_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
165 print $ligne4_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
166 print "\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
167 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
168 $error3++;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
169 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
170 elsif (($TYPE eq "illumina")&&(($header1 ne $repheader1)||($header2 ne $repheader2)||($header1 ne $header2))){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
171 if ($VERBOSE eq "ON"){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
172 print "Error in header : different\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
173 print $ligne1_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
174 print $ligne2_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
175 print $ligne3_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
176 print $ligne4_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
177 print $ligne1_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
178 print $ligne2_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
179 print $ligne3_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
180 print $ligne4_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
181 print "\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
182 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
183 $error4++;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
184 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
185 elsif (($TYPE eq "sanger")&&($header1 ne $header2)){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
186 if ($VERBOSE eq "ON"){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
187 print "Error in header : different\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
188 print $ligne1_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
189 print $ligne2_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
190 print $ligne3_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
191 print $ligne4_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
192 print $ligne1_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
193 print $ligne2_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
194 print $ligne3_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
195 print $ligne4_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
196 print "\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
197 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
198 $error4++;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
199 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
200 elsif (($length_seq1 != $length_qual1)||($length_seq2 != $length_qual2)){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
201 if ($VERBOSE eq "ON"){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
202 print "Error in seq/qual length\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
203 print $ligne1_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
204 print $ligne2_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
205 print $ligne3_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
206 print $ligne4_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
207 print $ligne1_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
208 print $ligne2_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
209 print $ligne3_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
210 print $ligne4_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
211 print "\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
212 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
213 $error5++;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
214 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
215 #@ 1 - 2 sec
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
216 else {
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
217 ### Parsing sequence & qualité
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
218 if ($ligne2_r1 =~ /^([ATGCNX]+)\s*$/i){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
219 $seq1 = $1;
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
220 $nb_base_read1 += length($seq1);
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
221 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
222 if ($ligne2_r2 =~ /^([ATGCNX]+)\s*$/i){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
223 $seq2 = $1;
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
224 $nb_base_read2 += length($seq2);
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
225 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
226 if ($ligne4_r1 =~ /^(.*)\s*$/i){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
227 $qual1 = $1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
228 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
229 if ($ligne4_r2 =~ /^(.*)\s*$/i){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
230 $qual2 = $1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
231 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
232 #@ 2 sec
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
233 ### Verification du parsing et de la coherence sequence /qualité (n°2)
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
234 if ((!$seq1)||(!$seq2)||(!$qual1)||(!$qual2)){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
235 if ($VERBOSE eq "ON"){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
236 print "Error parsing seq / quality \n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
237 print $ligne1_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
238 print $ligne2_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
239 print $ligne3_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
240 print $ligne4_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
241 print $ligne1_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
242 print $ligne2_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
243 print $ligne3_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
244 print $ligne4_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
245 print "\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
246 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
247 $error6++;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
248 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
249 elsif ((length($seq1) != length($qual1))||(length($seq2) != length($qual2))){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
250 if ($VERBOSE eq "ON"){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
251 print "Error in seq/qual length after parsing\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
252 print $ligne1_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
253 print $ligne2_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
254 print $ligne3_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
255 print $ligne4_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
256 print $ligne1_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
257 print $ligne2_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
258 print $ligne3_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
259 print $ligne4_r2;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
260 print "\n";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
261 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
262 $error7++;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
263 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
264 #@ <1 sec
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
265 else {
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
266 my $fastq_lines_r1="";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
267 my $fastq_lines_r2="";
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
268 my $nb_base_current_read1_t = 0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
269 my $nb_base_current_read2_t = 0;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
270
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
271 $fastq_lines_r1 = &grooming_and_trimming($ligne1_r1,$seq1,$qual1);
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
272 $nb_base_current_read1_t = $nb_base_current_t;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
273 if ($fastq_lines_r1){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
274 $fastq_lines_r2 = &grooming_and_trimming($ligne1_r2,$seq2,$qual2);
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
275 $nb_base_current_read2_t = $nb_base_current_t;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
276 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
277 if ($fastq_lines_r2){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
278 print OUT1 $fastq_lines_r1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
279 print OUT2 $fastq_lines_r2;
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
280
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
281 $nb_read1_t++;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
282 $nb_read2_t++;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
283 $nb_base_read1_t += $nb_base_current_read1_t;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
284 $nb_base_read2_t += $nb_base_current_read2_t;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
285
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
286
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
287 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
288 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
289 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
290
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
291
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
292 #@ 7 sec
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
293 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
294 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
295
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
296 close (READ1);
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
297 close (READ2);
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
298 close (OUT1);
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
299 close (OUT2);
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
300
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
301 open (LF,">$log_file") or die("Can't open $log_file\n");
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
302 print LF "\n####\t Fastq preparation \n";
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
303 print LF "## Before preparation\n";
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
304 print LF "#Read1 :\t$nb_read1\t#Base :\t$nb_base_read1\n";
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
305 print LF "#Read2 :\t$nb_read2\t#Base :\t$nb_base_read2\n";
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
306 print LF "## After preparation\n";
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
307 print LF "#Read1 :\t$nb_read1_t\t#Base :\t$nb_base_read1_t\n";
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
308 print LF "#Read2 :\t$nb_read2_t\t#Base :\t$nb_base_read2_t\n";
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
309 close (LF);
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
310
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
311
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
312 sub grooming_and_trimming{
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
313 my $header = shift;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
314 my $seq = shift;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
315 my $quality = shift;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
316 my $quality_converted="";
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
317 my $quality_ori=$quality;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
318
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
319 my $lengthseq = length($seq);
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
320 my $startTrim = 0;
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
321 my $stopTrim = length($quality)-1;
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
322 my $startnoN = $startTrim;
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
323 my $stopnoN = $stopTrim;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
324
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
325
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
326 my $chercheN = $seq;
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
327 my @bad_position_N;
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
328 my @bad_position_Q;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
329 my $current_index = index($chercheN,"N");
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
330 my $abs_index = $current_index;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
331 while ($current_index >=0){
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
332 push (@bad_position_N,$abs_index);
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
333
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
334 if ($current_index<length($seq)){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
335 $chercheN = substr($chercheN,$current_index+1);
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
336 $current_index = index($chercheN,"N");
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
337 $abs_index = $current_index + $bad_position_N[$#bad_position_N]+1;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
338 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
339 else {
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
340 last;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
341 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
342 }
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
343
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
344 my @q = split(//,$quality);
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
345 for (my $i=0;$i<=$#q;$i++){
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
346 my $chr = $q[$i];
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
347 my $num = ord($q[$i]);
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
348 if ($TYPE eq "illumina"){
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
349 $num = $num - 31; # 31 comme la difference entre la plage sanger (33-> 93 / 0->60) et illumina (64->104 / 0->40)
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
350 $quality_converted .= chr($num);
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
351 }
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
352
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
353 if ($num < $MIN_QUALITY + 33){ #33 comme le départ de la plage sanger
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
354 push(@bad_position_Q,$i);
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
355 }
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
356 }
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
357 if ($quality_converted){$quality = $quality_converted;}
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
358
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
359 my @bad_position = (@bad_position_N, @bad_position_Q);
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
360
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
361 if ($#bad_position>=0){
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
362 @bad_position = sort {$a <=> $b} @bad_position;
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
363 my %coord=%{&extract_longer_string_coordinates_from_bad_position(0,$stopTrim,\@bad_position)};
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
364 $startTrim = $coord{"start"};
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
365 $stopTrim = $coord{"stop"};
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
366 #print "$startTrim .. $stopTrim\n";
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
367
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
368 }
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
369 my $lengthTrim = $stopTrim - $startTrim +1;
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
370
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
371 #if ($stats_length{$lengthTrim}){
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
372 # $stats_length{$lengthTrim} = 1;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
373 #}
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
374 #else {
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
375 # $stats_length{$lengthTrim}++;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
376 #}
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
377 my $fastq_lines="";
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
378
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
379 # if ($header =~ /GA8\-EAS671_0005\:3\:1\:1043\:4432/){
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
380 # print "HEAD:\t$header";
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
381 # print "SEQ:\n$seq\n";
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
382 # print "$quality_ori\n";
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
383 # print "$quality\n";
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
384 # for (my $i=0;$i<=$#bad_position;$i++){
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
385 # print $bad_position[$i]."(".$q[$bad_position[$i]]." : ".ord($q[$bad_position[$i]]).")"."\t";
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
386 # }
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
387 # print "\n";
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
388 # print "$startTrim .. $stopTrim / $lengthTrim \n";
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
389 # print $fastq_lines;
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
390 # print "\n";
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
391 # }
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
392
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
393 #for (my $i=$startTrim;$i<=$stopTrim;$i++){
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
394 # if ($stats_quality{ord($q{$i])}){
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
395 # $stats_quality{ord($q{$i])}=1;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
396 # }
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
397 # else {
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
398 # $stats_quality{ord($q{$i])}++;
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
399 # }
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
400 #}
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
401
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
402 if ($lengthTrim >= $MIN_LENGTH){
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
403 $fastq_lines .= $header;
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
404 my $new_seq = substr($seq,$startTrim,$lengthTrim);
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
405 $nb_base_current_t = length($new_seq);
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
406 $fastq_lines .= $new_seq."\n";
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
407 $fastq_lines .= "+\n";
7
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
408 my $new_q = substr($quality,$startTrim,$lengthTrim);
3f7b0788a1c4 Uploaded
mcharles
parents: 5
diff changeset
409 $fastq_lines .= $new_q."\n";
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
410 return $fastq_lines;
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
411
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
412 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
413 else {
5
b0cbb9d21aa9 Uploaded
mcharles
parents: 4
diff changeset
414 #print "Insufficient length after trimming\n";
0
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
415 return "";
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
416 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
417 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
418
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
419 sub extract_longer_string_coordinates_from_bad_position{
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
420 my $start=shift;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
421 my $stop =shift;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
422 my $refbad = shift;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
423 my @bad_position = @$refbad;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
424 my %coord;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
425
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
426 my $current_start = $start;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
427 my $current_stop = $bad_position[0]-1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
428 if ($current_stop < $start){$current_stop = $start;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
429
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
430
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
431 #debut -> premier N
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
432 my $current_length = $current_stop - $current_start +1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
433 my $test_length;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
434
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
435 #entre les N
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
436 for (my $i=1;$i<=$#bad_position;$i++){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
437 $test_length = $bad_position[$i]+1-$bad_position[$i-1]-1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
438 if ( $test_length > $current_length){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
439 $current_start = $bad_position[$i-1]+1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
440 $current_stop = $bad_position[$i]-1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
441 $current_length = $current_stop - $current_start +1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
442 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
443 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
444
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
445 #dernier N -> fin
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
446 $test_length = $stop-$bad_position[$#bad_position]+1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
447 if ( $test_length > $current_length){
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
448 $current_start = $bad_position[$#bad_position]+1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
449 if ($current_start > $stop){$current_start=$stop;}
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
450 $current_stop = $stop;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
451 }
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
452 $coord{"start"}=$current_start;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
453 $coord{"stop"}= $current_stop;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
454 $coord{"lenght"}=$current_stop-$current_start+1;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
455
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
456 return \%coord;
442a7c88b886 Uploaded
mcharles
parents:
diff changeset
457 }