Created
March 22, 2012 16:51
-
-
Save jvhaarst/2159595 to your computer and use it in GitHub Desktop.
What is the minimal and maximal quality score of fastq file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use List::Util qw(max min); | |
# initiate | |
my @characters; | |
my @numbers; | |
my $l; | |
my $minimum=255; | |
my $maximum=0; | |
# go thorugh the file | |
while(<STDIN>){ | |
my $sequence = <STDIN>; | |
my $skipline = <STDIN>; | |
my $quality = <STDIN>; chomp $quality; | |
@characters = split(//,$quality); # divide into characters | |
# convert the elements of the array into their | |
# equivalent ASCII codes | |
@numbers = map(ord, @characters); | |
if ($minimum > min(@numbers)){ | |
$minimum = min(@numbers) ; | |
print $quality."\n"; | |
print "minimum changed to $minimum(".chr($minimum).")\n"; | |
} | |
if ($maximum < max(@numbers)){ | |
$maximum = max(@numbers); | |
print $quality."\n"; | |
print "maximum changed to $maximum(".chr($maximum).")\n"; | |
} | |
} | |
print "minimum is: $minimum(".chr($minimum).")\n"; | |
print "maximum is: $maximum(".chr($maximum).")\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment