]> git.donarmstrong.com Git - biopieces.git/commitdiff
trouble shooting buffering problem
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 15 Oct 2010 08:15:47 +0000 (08:15 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 15 Oct 2010 08:15:47 +0000 (08:15 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1133 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/analyze_seq
bp_bin/mean_vals
bp_bin/reverse_seq

index d668c99cf4a93bf13675307ba7b9fffe0751ee22..81ad0e16aa20393fad2662eb930c950e97d81822 100755 (executable)
@@ -44,12 +44,12 @@ bp.each_record do |record|
     comp = seq.composition
 
     comp.each_pair do |key,val|
-      record["RES[#{key}]".to_sym] = val
+      record["RES_#{key}"] = val
     end
 
-    record["HARD_MASK%".to_sym] = seq.hard_mask
-    record["SOFT_MASK%".to_sym] = seq.soft_mask
-    record["GC%".to_sym]        = ((comp["G"] + comp["C"]).to_f / (seq.len - seq.indels).to_f * 100.0).round(2)
+    record["HARD_MASK"] = seq.hard_mask
+    record["SOFT_MASK"] = seq.soft_mask
+    record["GC"]        = ((comp["G"] + comp["C"]).to_f / (seq.len - seq.indels).to_f * 100.0).round(2)
   end
 
   bp.puts record
index 583ec4effa8bccff8972a8bd52e46e87c7fdd23d..007b287ab0bb7c56385627bc55d02b860fb0377e 100755 (executable)
@@ -35,7 +35,7 @@ use Maasha::Calc;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-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(
     [
@@ -70,6 +70,9 @@ while ( $record = Maasha::Biopieces::get_record( $in ) )
     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" } } )
@@ -80,13 +83,17 @@ 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" } )
+{
+    $new_record->{ 'REC_TYPE' } = "MEAN";
 
-Maasha::Biopieces::close_stream( $in );
-Maasha::Biopieces::close_stream( $out );
+    Maasha::Biopieces::put_record( $new_record, $fh );
+}
+
+close $fh;
 
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
index 019245e1e5c1a57d713b35bd8a335b1d71289ffa..9b08e222893760aa5f583fcd7a1ebd36b7b2b3bc 100755 (executable)
@@ -43,7 +43,8 @@ $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
 
 while ( $record = Maasha::Biopieces::get_record( $in ) )
 {
-    $record->{ "SEQ" } = reverse $record->{ "SEQ" } if $record->{ "SEQ" };
+    $record->{ "SEQ" }    = reverse $record->{ "SEQ" }    if $record->{ "SEQ" };
+    $record->{ "SCORES" } = reverse $record->{ "SCORES" } if $record->{ "SCORES" };
 
     Maasha::Biopieces::put_record( $record, $out );
 }