# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-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(
[
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 );
-
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$median = "N/A";
}
- $new_record->{ $key . "_MEDIAN" } = $mean
+ $new_record->{ $key . "_MEDIAN" } = $median;
}
-if ( $options->{ "keys" } )
+if ( $options->{ "keys" } and $new_record )
{
$new_record->{ 'REC_TYPE' } = "MEDIAN";
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-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(
[
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 );
-
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
--- /dev/null
+V3: 0;1;2;3;4;5
+V0: Human
+V2: 78
+V1: 123
+---
+V3: 6;7;8
+V0: Dog
+V2: 81
+V1: 45
+---
+V3: 9
+V0: Mouse
+V2: 5
+V1: 6
+---
--- /dev/null
+V3: 0;1;2;3;4;5
+V0: Human
+V2: 78
+V1: 123
+---
+V3: 6;7;8
+V0: Dog
+V2: 81
+V1: 45
+---
+V3: 9
+V0: Mouse
+V2: 5
+V1: 6
+---
--- /dev/null
+V3: 0;1;2;3;4;5
+V0: Human
+V2: 78
+V1: 123
+---
+V3: 6;7;8
+V0: Dog
+V2: 81
+V1: 45
+---
+V3: 9
+V0: Mouse
+V2: 5
+V1: 6
+---
--- /dev/null
+V2_MAX: 81
+V1_MAX: 123
+REC_TYPE: MIN
+---
--- /dev/null
+V3_MAX: 5.00
+V3: 0;1;2;3;4;5
+V0: Human
+V2: 78
+V1: 123
+---
+V3_MAX: 8.00
+V3: 6;7;8
+V0: Dog
+V2: 81
+V1: 45
+---
+V3_MAX: 9.00
+V3: 9
+V0: Mouse
+V2: 5
+V1: 6
+---
--- /dev/null
+V1_MEDIAN: 45
+REC_TYPE: MEDIAN
+V2_MEDIAN: 78
+---
--- /dev/null
+V3_MEDIAN: 3.50
+V3: 0;1;2;3;4;5
+V0: Human
+V2: 78
+V1: 123
+---
+V3_MEDIAN: 7.00
+V3: 6;7;8
+V0: Dog
+V2: 81
+V1: 45
+---
+V3_MEDIAN: 9.00
+V3: 9
+V0: Mouse
+V2: 5
+V1: 6
+---
--- /dev/null
+REC_TYPE: MIN
+V1_MIN: 6
+V2_MIN: 5
+---
--- /dev/null
+V3: 0;1;2;3;4;5
+V0: Human
+V2: 78
+V1: 123
+V3_MIN: 0.00
+---
+V3: 6;7;8
+V0: Dog
+V2: 81
+V1: 45
+V3_MIN: 6.00
+---
+V3: 9
+V0: Mouse
+V2: 5
+V1: 6
+V3_MIN: 9.00
+---
--- /dev/null
+#!/bin/bash
+
+source "$BP_DIR/bp_test/lib/test.sh"
+
+run "$bp -I $in -k V1,V2 -o $tmp -x"
+assert_no_diff $tmp $out.1
+clean
+
+run "$bp -I $in -l V3 -O $tmp"
+assert_no_diff $tmp $out.2
+clean
--- /dev/null
+#!/bin/bash
+
+source "$BP_DIR/bp_test/lib/test.sh"
+
+run "$bp -I $in -k V1,V2 -o $tmp -x"
+assert_no_diff $tmp $out.1
+clean
+
+run "$bp -I $in -l V3 -O $tmp"
+assert_no_diff $tmp $out.2
+clean
--- /dev/null
+#!/bin/bash
+
+source "$BP_DIR/bp_test/lib/test.sh"
+
+run "$bp -I $in -k V1,V2 -o $tmp -x"
+assert_no_diff $tmp $out.1
+clean
+
+run "$bp -I $in -l V3 -O $tmp"
+assert_no_diff $tmp $out.2
+clean