From: martinahansen Date: Wed, 13 Oct 2010 08:28:36 +0000 (+0000) Subject: polished plot_scores X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0b384c3a2ced3353cdf7c7c36acf6e6a538877fc;p=biopieces.git polished plot_scores git-svn-id: http://biopieces.googlecode.com/svn/trunk@1122 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/plot_scores b/bp_bin/plot_scores index bfe87cc..5ef16b4 100755 --- a/bp_bin/plot_scores +++ b/bp_bin/plot_scores @@ -37,17 +37,15 @@ use Maasha::Calc; # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -my ( $options, $in, $out, $default, $terminals, $formats, $record, %count_hash, %sum_hash, $i, @scores, @data_list, $result, $fh, $tmp_dir ); +my ( $options, $in, $out, $default, $terminals, $record, %count_hash, %sum_hash, $i, @scores, @data_list, $result, $fh, $tmp_dir ); $default = "Quality Scores"; $terminals = "dumb,x11,aqua,post,svg"; -$formats = "solexa,phred,decimal"; $options = Maasha::Biopieces::parse_options( [ { long => 'no_stream', short => 'x', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, { long => 'data_out', short => 'o', type => 'file', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, - { long => 'format' , short => 'f', type => 'string', mandatory => 'no', default => "solexa", allowed => $formats, disallowed => undef }, { long => 'terminal', short => 't', type => 'string', mandatory => 'no', default => 'dumb', allowed => $terminals, disallowed => undef }, { long => 'title', short => 'T', type => 'string', mandatory => 'no', default => $default, allowed => undef, disallowed => undef }, { long => 'xlabel', short => 'X', type => 'string', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, @@ -62,31 +60,10 @@ while ( $record = Maasha::Biopieces::get_record( $in ) ) { if ( $record->{ 'SCORES' } ) { - if ( $options->{ 'format' } eq "solexa" ) + for ( $i = 0; $i < length $record->{ 'SCORES' }; $i++ ) { - for ( $i = 0; $i < length $record->{ 'SCORES' }; $i++ ) - { - $count_hash{ $i }++; - $sum_hash{ $i } += Maasha::Fastq::solexa2dec( substr $record->{ "SCORES" }, $i, 1 ); - } - } - elsif ( $options->{ 'format' } eq "phred" ) - { - for ( $i = 0; $i < length $record->{ 'SCORES' }; $i++ ) - { - $count_hash{ $i }++; - $sum_hash{ $i } += Maasha::Fastq::phred2dec( substr $record->{ "SCORES" }, $i, 1 ); - } - } - else - { - @scores = split ";", $record->{ 'SCORES' }; - - for ( $i = 0; $i < @scores; $i++ ) - { - $count_hash{ $i }++; - $sum_hash{ $i } += $scores[ $i ]; - } + $count_hash{ $i }++; + $sum_hash{ $i } += Maasha::Fastq::solexa2dec( substr $record->{ "SCORES" }, $i, 1 ); } }