From: martinahansen Date: Mon, 7 Sep 2009 11:07:47 +0000 (+0000) Subject: fixed solexa/phred code X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d3e2e8686941aa5a790e981fb1e631c37fcc3517;p=biopieces.git fixed solexa/phred code git-svn-id: http://biopieces.googlecode.com/svn/trunk@654 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/read_fastq b/bp_bin/read_fastq index 5173aba..eb92661 100755 --- a/bp_bin/read_fastq +++ b/bp_bin/read_fastq @@ -66,6 +66,7 @@ if ( $options->{ 'data_in' } ) if ( $record = Maasha::Fastq::fastq2biopiece( $entry ) ) { Maasha::Fastq::softmask_phred_str( $record->{ 'SEQ' }, $record->{ 'SCORES' }, $options->{ 'cutoff' } ) if $options->{ 'soft_mask' }; + $record->{ 'SCORES' } = Maasha::Fastq::phred_str2dec_str( $record->{ 'SCORES' } ) if $options->{ 'convert2dec' }; Maasha::Biopieces::put_record( $record, $out ); } diff --git a/bp_bin/read_solexa b/bp_bin/read_solexa index b7a5639..f594d80 100755 --- a/bp_bin/read_solexa +++ b/bp_bin/read_solexa @@ -68,6 +68,7 @@ if ( $options->{ 'data_in' } ) if ( $record = Maasha::Fastq::fastq2biopiece( $entry ) ) { Maasha::Fastq::softmask_solexa_str( $record->{ 'SEQ' }, $record->{ 'SCORES' }, $options->{ 'cutoff' } ) if $options->{ 'soft_mask' }; + $record->{ 'SCORES' } = Maasha::Fastq::solexa_str2dec_str( $record->{ 'SCORES' } ) if $options->{ 'convert2dec' }; Maasha::Biopieces::put_record( $record, $out ); } diff --git a/code_perl/Maasha/Fastq.pm b/code_perl/Maasha/Fastq.pm index 3a8ed43..4027209 100644 --- a/code_perl/Maasha/Fastq.pm +++ b/code_perl/Maasha/Fastq.pm @@ -257,6 +257,42 @@ END_C # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +sub solexa_str2dec_str +{ + # Martin A. Hansen, September 2009 + + # Converts a string of Solexa octal scores to a ; separated + # string of decimal scores. + + my ( $scores, # Solexa scores + ) = @_; + + # Returns a string. + + $scores =~ s/(.)/ solexa2dec( $1 ) . ";"/eg; + + return $scores; +} + + +sub phred_str2dec_str +{ + # Martin A. Hansen, September 2009 + + # Converts a string of Phred octal scores to a ; separated + # string of decimal scores. + + my ( $scores, # Phred scores + ) = @_; + + # Returns a string. + + $scores =~ s/(.)/ phred2dec( $1 ) . ";"/eg; + + return $scores; +} + + sub get_entry { # Martin A. Hansen, July 2009.