X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=code_perl%2FMaasha%2FSolexa.pm;h=fa2764e567acfebc02018ab0cd4b9943fdbc7746;hb=9ff3f4f82dedb5ccaa924fe311486bad3ed1248d;hp=058a00a6a73322216abe41b25567391e6b1c446c;hpb=4fa91ffb3634172235cf727ea8f426c56fb426c1;p=biopieces.git diff --git a/code_perl/Maasha/Solexa.pm b/code_perl/Maasha/Solexa.pm index 058a00a..fa2764e 100644 --- a/code_perl/Maasha/Solexa.pm +++ b/code_perl/Maasha/Solexa.pm @@ -65,7 +65,7 @@ sub solexa_get_entry_octal # Returns a list. - my ( $seq_header, $seq, $score_head, $score, @scores ); + my ( $seq_header, $seq, $score_head, $score ); $seq_header = <$fh>; $seq = <$fh>; @@ -79,13 +79,8 @@ sub solexa_get_entry_octal chomp $score_header; chomp $score; - @scores = split //, $score; - - map { $_ = int( score_oct2dec( $_ ) ) } @scores; - $seq_header =~ s/^@//; - - $score = join( ";", @scores ); + $score =~ s/(.)/int( score_oct2dec( $1 ) ) . ";"/ge; return wantarray ? ( $seq_header, $seq, $score ) : [ $seq_header, $seq, $score ]; } @@ -104,7 +99,7 @@ sub score_oct2dec # Returns a float - return 10 * log(1 + 10 ** ((ord( $char ) - 64) / 10.0)) / log(10); + return 10 * log( 1 + 10 ** ( ( ord( $char ) - 64 ) / 10.0 ) ) / log( 10 ); } @@ -126,7 +121,7 @@ sub solexa_get_entry_decimal # Returns a list. - my ( $seq_header, $seq, $score_head, $score, @scores ); + my ( $seq_header, $seq, $score_head, $score ); $seq_header = <$fh>; $seq = <$fh>; @@ -140,11 +135,8 @@ sub solexa_get_entry_decimal chomp $score_header; chomp $score; - @scores = split / /, $score; - $seq_header =~ s/^@//; - - $score = join( ";", @scores ); + $score =~ s/ /;/g; return wantarray ? ( $seq_header, $seq, $score ) : [ $seq_header, $seq, $score ]; }