]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed bug in compute and analyze_seq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 28 Oct 2008 04:58:28 +0000 (04:58 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 28 Oct 2008 04:58:28 +0000 (04:58 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@279 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/Biopieces.pm
code_perl/Maasha/Seq.pm

index 98ea2422311c4f56bbc696fc059cfe145dfc3419..0a0501a5e1e99054b85fb059460761556a70dbe0 100644 (file)
@@ -5238,7 +5238,7 @@ sub script_compute
 
     # Returns nothing.
 
-    my ( $record, $eval_key, $eval_val, $check, @keys );
+    my ( $record, $eval_key, $eval_val );
 
     while ( $record = get_record( $in ) ) 
     {
@@ -5250,15 +5250,7 @@ sub script_compute
                 $eval_val = $2;
             }
 
-            if ( not $check )
-            {
-                @keys = split /\W+/, $eval_val;
-                @keys = grep { ! /^\d+$/ } @keys;
-
-                $check = 1;
-            }
-
-            map { $eval_val =~ s/$_/$record->{ $_ }/g } @keys;
+            map { $eval_val =~ s/\Q$_\E/$record->{ $_ }/g } keys %{ $record };
 
             $record->{ $eval_key } = eval "$eval_val" or Maasha::Common::error( "eval failed -> $@" );
         } 
index 4b948efe4b512c8b7bf7c2ddd31e14c0cf820b58..4f7cdb2f8a1c701986b189deef7b006e8f224b63 100644 (file)
@@ -881,14 +881,14 @@ sub seq_analyze
 
         $char_hash{ $char } += $char_hash{ lc $char };
 
-        $analysis{ "RES:$char" } = $char_hash{ $char };
+        $analysis{ "RES[$char]" } = $char_hash{ $char };
 
         $max = $char_hash{ $char } if $char_hash{ $char } > $max;
 
         $analysis{ "RES_SUM" } += $char_hash{ $char };
     }
 
-    map { $analysis{ "RES:$_" } = $indel_hash{ $_ } } @indels;
+    map { $analysis{ "RES[$_]" } = $indel_hash{ $_ } } @indels;
 
     $analysis{ "MIX_INDEX" } = sprintf( "%.2f", $max / $analysis{ "SEQ_LEN" } );
     $analysis{ "MELT_TEMP" } = sprintf( "%.2f", 4 * $gc + 2 * $at );