]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/analyze_vals
added usearch_seq biopiece
[biopieces.git] / bp_bin / analyze_vals
index d246ac76fa96945c0b02f04b2eabca0c232b1a21..d1d9ede3af31a59045be0d51fe0f21fe57a46efe 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
 
 # Copyright (C) 2007-2009 Martin A. Hansen.
 
@@ -26,6 +26,7 @@
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
+use warnings;
 use strict;
 use Maasha::Biopieces;
 use Maasha::Calc;
@@ -35,19 +36,21 @@ use Data::Dumper;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my ( $options, $in, $out, $record, $analysis, $key, $len,
+my ( $options, $in, $out, $record, $analysis, $key, $len, %skip_hash,
      %key_hash, $skip, $keys, $types, $counts, $mins, $maxs, $sums, $means );
 
 $options = Maasha::Biopieces::parse_options(
     [
         { long => 'no_stream', short => 'x', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
         { long => 'keys',      short => 'k', type => 'list', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
+        { long => 'no_keys',   short => 'K', type => 'list', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
     ]   
 );
 
 $in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
 $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
 
+map { $skip_hash{ $_ } = 1 } @{ $options->{ "no_keys" } };
 map { $key_hash{ $_ } = 1; $skip = 1 } @{ $options->{ "keys" } };
 
 while ( $record = Maasha::Biopieces::get_record( $in ) ) 
@@ -55,6 +58,7 @@ while ( $record = Maasha::Biopieces::get_record( $in ) )
     foreach $key ( keys %{ $record } )
     {
         next if $skip and not exists $key_hash{ $key };
+        next if $skip_hash{ $key };
 
         if ( Maasha::Calc::is_a_number( $record->{ $key } ) )
         {
@@ -107,7 +111,7 @@ $maxs   = "MAX  ";
 $sums   = "SUM  ";
 $means  = "MEAN ";
 
-foreach $key ( keys %{ $analysis } )
+foreach $key ( sort keys %{ $analysis } )
 {
     $keys   .= sprintf "% 15s", $key;
     $types  .= sprintf "% 15s", $analysis->{ $key }->{ "TYPE" };