]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/min_vals
refactoring of assemble_pairs
[biopieces.git] / bp_bin / min_vals
index 1f73ed0fd46bbbfa80501c583dfbb7f609b7bab1..11410e3f68d7f726351544c04981e2996f8d7157 100755 (executable)
@@ -35,7 +35,7 @@ use Maasha::Calc;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my ( $options, $in, $out, $record, $key, $fh, %min_hash, $min_record );
+my ( $options, $in, $out, $record, $new_record, $key, $fh, %min_hash );
 
 $options = Maasha::Biopieces::parse_options(
     [
@@ -73,20 +73,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" } } )
-{
-    $min_record->{ $key . "_MIN" } = $min_hash{ $key };
+foreach $key ( @{ $options->{ "keys" } } ) {
+    $new_record->{ $key . "_MIN" } = $min_hash{ $key };
 }
 
-Maasha::Biopieces::put_record( $min_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 );
-
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<