From: martinahansen Date: Tue, 28 Oct 2008 04:58:28 +0000 (+0000) Subject: fixed bug in compute and analyze_seq X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f28a4e70a4abc83d6a142f70ac84a5d3ec65a2c6;p=biopieces.git fixed bug in compute and analyze_seq git-svn-id: http://biopieces.googlecode.com/svn/trunk@279 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_perl/Maasha/Biopieces.pm b/code_perl/Maasha/Biopieces.pm index 98ea242..0a0501a 100644 --- a/code_perl/Maasha/Biopieces.pm +++ b/code_perl/Maasha/Biopieces.pm @@ -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 -> $@" ); } diff --git a/code_perl/Maasha/Seq.pm b/code_perl/Maasha/Seq.pm index 4b948ef..4f7cdb2 100644 --- a/code_perl/Maasha/Seq.pm +++ b/code_perl/Maasha/Seq.pm @@ -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 );