From 0253e2b8737fba111f4ec7406704dacaa4877d8d Mon Sep 17 00:00:00 2001 From: martinahansen Date: Mon, 25 Nov 2013 20:49:29 +0000 Subject: [PATCH] fixed encoding bug in read_454 git-svn-id: http://biopieces.googlecode.com/svn/trunk@2257 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/read_454 | 2 +- bp_test/test_all | 2 ++ code_perl/Maasha/Fastq.pm | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/bp_bin/read_454 b/bp_bin/read_454 index 5017cd8..96c6a4f 100755 --- a/bp_bin/read_454 +++ b/bp_bin/read_454 @@ -130,7 +130,7 @@ sub get_qual $qual =~ tr/ \n\r/;;;/; $qual =~ s/;;/;/g; - $scores = Maasha::Fastq::dec_str2solexa_str( $qual ); + $scores = Maasha::Fastq::dec_str2phred_str( $qual ); $entry = [ $name, $scores ]; diff --git a/bp_test/test_all b/bp_test/test_all index e94395f..fd358e7 100755 --- a/bp_test/test_all +++ b/bp_test/test_all @@ -21,7 +21,9 @@ test_aux_program "blastall" test_aux_program "blat" test_aux_program "bwa" test_aux_program "bowtie" +test_aux_program "bowtie2" test_aux_program "formatdb" +test_aux_program "hmmsearch" test_aux_program "gnuplot" test_aux_program "idba" test_aux_program "muscle" diff --git a/code_perl/Maasha/Fastq.pm b/code_perl/Maasha/Fastq.pm index b48279c..d70bf3e 100644 --- a/code_perl/Maasha/Fastq.pm +++ b/code_perl/Maasha/Fastq.pm @@ -443,6 +443,23 @@ sub dec_str2solexa_str return $scores; } +sub dec_str2phred_str +{ + # Martin A. Hansen, November 2013. + + # Converts a ; separated string of decimal scores to a + # string of Phred scores. + + my ( $scores, # Decimal score string + ) = @_; + + # Returns a string. + + $scores =~ s/(-\d{1,2})/0/g; + $scores =~ s/(\d{1,2});?/dec2phred( $1 )/eg; + + return $scores; +} sub get_entry { -- 2.39.2