# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-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(
[
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" } } )
$mean = "N/A";
}
- Maasha::Biopieces::put_record( { $key . "_MEAN" => $mean } , $fh );
+ $new_record->{ $key . "_MEAN" } = $mean
}
-close $fh;
+if ( $options->{ "keys" } and $new_record )
+{
+ $new_record->{ 'REC_TYPE' } = "MEAN";
-Maasha::Biopieces::close_stream( $in );
-Maasha::Biopieces::close_stream( $out );
+ Maasha::Biopieces::put_record( $new_record, $fh );
+}
+
+close $fh;
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<