From d23d0565b9e6425d092a12c3d6e3cba47c3db4bd Mon Sep 17 00:00:00 2001 From: martinahansen Date: Fri, 15 Oct 2010 08:15:47 +0000 Subject: [PATCH] trouble shooting buffering problem git-svn-id: http://biopieces.googlecode.com/svn/trunk@1133 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/analyze_seq | 8 ++++---- bp_bin/mean_vals | 17 ++++++++++++----- bp_bin/reverse_seq | 3 ++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/bp_bin/analyze_seq b/bp_bin/analyze_seq index d668c99..81ad0e1 100755 --- a/bp_bin/analyze_seq +++ b/bp_bin/analyze_seq @@ -44,12 +44,12 @@ bp.each_record do |record| comp = seq.composition comp.each_pair do |key,val| - record["RES[#{key}]".to_sym] = val + record["RES_#{key}"] = val end - record["HARD_MASK%".to_sym] = seq.hard_mask - record["SOFT_MASK%".to_sym] = seq.soft_mask - record["GC%".to_sym] = ((comp["G"] + comp["C"]).to_f / (seq.len - seq.indels).to_f * 100.0).round(2) + record["HARD_MASK"] = seq.hard_mask + record["SOFT_MASK"] = seq.soft_mask + record["GC"] = ((comp["G"] + comp["C"]).to_f / (seq.len - seq.indels).to_f * 100.0).round(2) end bp.puts record diff --git a/bp_bin/mean_vals b/bp_bin/mean_vals index 583ec4e..007b287 100755 --- a/bp_bin/mean_vals +++ b/bp_bin/mean_vals @@ -35,7 +35,7 @@ use Maasha::Calc; # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -my ( $options, $in, $out, $record, $key, %sum_hash, %count_hash, $mean, $fh ); +my ( $options, $in, $out, $record, $new_record, $key, %sum_hash, %count_hash, $mean, $fh ); $options = Maasha::Biopieces::parse_options( [ @@ -70,6 +70,9 @@ while ( $record = Maasha::Biopieces::get_record( $in ) ) Maasha::Biopieces::put_record( $record, $out ) if not $options->{ "no_stream" }; } +Maasha::Biopieces::close_stream( $in ); +Maasha::Biopieces::close_stream( $out ); + $fh = Maasha::Biopieces::write_stream( $options->{ "data_out" } ); foreach $key ( @{ $options->{ "keys" } } ) @@ -80,13 +83,17 @@ foreach $key ( @{ $options->{ "keys" } } ) $mean = "N/A"; } - Maasha::Biopieces::put_record( { $key . "_MEAN" => $mean } , $fh ); + $new_record->{ $key . "_MEAN" } = $mean } -close $fh; +if ( $options->{ "keys" } ) +{ + $new_record->{ 'REC_TYPE' } = "MEAN"; -Maasha::Biopieces::close_stream( $in ); -Maasha::Biopieces::close_stream( $out ); + Maasha::Biopieces::put_record( $new_record, $fh ); +} + +close $fh; # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< diff --git a/bp_bin/reverse_seq b/bp_bin/reverse_seq index 019245e..9b08e22 100755 --- a/bp_bin/reverse_seq +++ b/bp_bin/reverse_seq @@ -43,7 +43,8 @@ $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } ); while ( $record = Maasha::Biopieces::get_record( $in ) ) { - $record->{ "SEQ" } = reverse $record->{ "SEQ" } if $record->{ "SEQ" }; + $record->{ "SEQ" } = reverse $record->{ "SEQ" } if $record->{ "SEQ" }; + $record->{ "SCORES" } = reverse $record->{ "SCORES" } if $record->{ "SCORES" }; Maasha::Biopieces::put_record( $record, $out ); } -- 2.39.5