]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/max_vals
adding bzip2 support in ruby
[biopieces.git] / bp_bin / max_vals
index d25bee4d4c9ec6fe9ed3587fc8cf5a73885fbd2f..52ede7c4fd16f18c5e817d37f0c9e17602dc398e 100755 (executable)
@@ -35,7 +35,7 @@ use Maasha::Calc;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my ( $options, $in, $out, $record, $key, $fh, %max_hash, $max_record );
+my ( $options, $in, $out, $record, $key, $fh, %max_hash, $new_record );
 
 $options = Maasha::Biopieces::parse_options(
     [
@@ -74,20 +74,24 @@ 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" } } )
-{
-    $max_record->{ $key . "_MAX" } = $max_hash{ $key };
+foreach $key ( @{ $options->{ "keys" } } ) {
+    $new_record->{ $key . "_MAX" } = $max_hash{ $key };
 }
 
-Maasha::Biopieces::put_record( $max_record, $fh );
+if ( $options->{ "keys" } and $new_record )
+{
+    $new_record->{ 'REC_TYPE' } = "MIN";
+
+    Maasha::Biopieces::put_record( $new_record, $fh );
+}
 
 close $fh;
 
-Maasha::Biopieces::close_stream( $in );
-Maasha::Biopieces::close_stream( $out );
-
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<