]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/median_vals
removed debug message
[biopieces.git] / bp_bin / median_vals
index 36bfff5907bab1855a39a968a5508ce2f9fa8ab2..e32415ca05094bb872cf4d193c70fbae1e378a52 100755 (executable)
@@ -35,7 +35,7 @@ use Maasha::Calc;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my ( $options, $in, $out, $record, $key, %median_hash, $median, $fh );
+my ( $options, $in, $out, $record, $new_record, $key, %median_hash, $median, $fh );
 
 $options = Maasha::Biopieces::parse_options(
     [
@@ -65,6 +65,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" } } )
@@ -75,13 +78,17 @@ foreach $key ( @{ $options->{ "keys" } } )
         $median = "N/A";
     }
 
-    Maasha::Biopieces::put_record( { $key . "_MEDIAN" => $median } , $fh );
+    $new_record->{ $key . "_MEDIAN" } = $median;
 }
 
-close $fh;
+if ( $options->{ "keys" } and $new_record )
+{
+    $new_record->{ 'REC_TYPE' } = "MEDIAN";
 
-Maasha::Biopieces::close_stream( $in );
-Maasha::Biopieces::close_stream( $out );
+    Maasha::Biopieces::put_record( $new_record, $fh );
+}
+
+close $fh;
 
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<