comparison rapsodyn/PrepareFastqLight.pl @ 4:9074a5104cdd draft

Uploaded
author mcharles
date Wed, 17 Sep 2014 04:20:08 -0400
parents 442a7c88b886
children b0cbb9d21aa9
comparison
equal deleted inserted replaced
3:9332b9da7491 4:9074a5104cdd
277 my $quality_converted=""; 277 my $quality_converted="";
278 278
279 my $startnoN = 0; 279 my $startnoN = 0;
280 my $stopnoN = length($quality)-1; 280 my $stopnoN = length($quality)-1;
281 281
282 #print "SEQ :\n$seq\n"; 282 #print "HEAD:\t$header";
283 #print "SEQ:\t$seq\n";
283 284
284 my $chercheN = $seq; 285 my $chercheN = $seq;
285 my @bad_position; 286 my @bad_position;
286 my $current_index = index($chercheN,"N"); 287 my $current_index = index($chercheN,"N");
287 my $abs_index = $current_index; 288 my $abs_index = $current_index;
304 $startnoN = $coord{"start"}; 305 $startnoN = $coord{"start"};
305 $stopnoN = $coord{"stop"}; 306 $stopnoN = $coord{"stop"};
306 } 307 }
307 my $lengthnoN = $stopnoN - $startnoN + 1; 308 my $lengthnoN = $stopnoN - $startnoN + 1;
308 my $seqnoN = substr($seq,$startnoN,$lengthnoN); 309 my $seqnoN = substr($seq,$startnoN,$lengthnoN);
309 #print "$seqnoN\n"; 310 # print "SEQnoN\t:$seqnoN\n";
311 # for (my $i=0;$i<=$#bad_position;$i++){
312 # print $bad_position[$i]."\t";
313 # }
314 # print "\n";
310 315
311 if ($lengthnoN >= $MIN_LENGTH){ 316 if ($lengthnoN >= $MIN_LENGTH){
312 my $startTrim = $startnoN; 317 my $startTrim = $startnoN;
313 my $stopTrim = $stopnoN; 318 my $stopTrim = $stopnoN;
314 319
315 my $quality_converted=""; 320 my $quality_converted="";
316 my @bad_position; 321 #my @bad_position;
317 322
318 my @q = split(//,$quality); 323 my @q = split(//,$quality);
319 #print "QUALITY\n"; 324 #print "QUALITY\n";
320 #print "$quality\n"; 325 #print "$quality\n";
321 for (my $i=0;$i<=$stopnoN;$i++){ 326 for (my $i=0;$i<=$stopnoN;$i++){
334 #print "$quality\n"; 339 #print "$quality\n";
335 340
336 341
337 342
338 if ($#bad_position>=0){ 343 if ($#bad_position>=0){
339 # for (my $i=0;$i<=$#bad_position;$i++){ 344 @bad_position = sort {$a <=> $b} @bad_position;
340 # print $bad_position[$i]."\t"; 345 # for (my $i=0;$i<=$#bad_position;$i++){
341 # } 346 # print $bad_position[$i]."\t";
342 # print "\n"; 347 # }
348 # print "\n";
343 my %coord=%{&extract_longer_string_coordinates_from_bad_position($startnoN,$stopnoN,\@bad_position)}; 349 my %coord=%{&extract_longer_string_coordinates_from_bad_position($startnoN,$stopnoN,\@bad_position)};
344 $startTrim = $coord{"start"}; 350 $startTrim = $coord{"start"};
345 $stopTrim = $coord{"stop"}; 351 $stopTrim = $coord{"stop"};
346 #print "$startTrim .. $stopTrim\n"; 352 #print "$startTrim .. $stopTrim\n";
347 353
354 if ($lengthTrim >= $MIN_LENGTH){ 360 if ($lengthTrim >= $MIN_LENGTH){
355 $fastq_lines .= $header; 361 $fastq_lines .= $header;
356 $fastq_lines .= substr($seq,$startTrim,$lengthTrim)."\n"; 362 $fastq_lines .= substr($seq,$startTrim,$lengthTrim)."\n";
357 $fastq_lines .= "+\n"; 363 $fastq_lines .= "+\n";
358 $fastq_lines .= substr($quality,$startTrim,$lengthTrim)."\n"; 364 $fastq_lines .= substr($quality,$startTrim,$lengthTrim)."\n";
365 # print $fastq_lines;
359 return $fastq_lines; 366 return $fastq_lines;
367
360 } 368 }
361 else { 369 else {
362 return ""; 370 return "";
363 } 371 }
364 372