]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/align_seq
adding bzip2 support in ruby
[biopieces.git] / bp_bin / align_seq
index 33930cb5a6f3fa2c468cb9587ab4b039b5ecc3bb..632d732f21fe47bcdc054061bcc210f9fbdae8fe 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::Align;
@@ -39,14 +40,16 @@ use constant {
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, @entries, $entry );
+my ( $options, $in, $out, $record, @entries, $entry );
+
+$options = Maasha::Biopieces::parse_options();
 
 $in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
 $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
 
 while ( $record = Maasha::Biopieces::get_record( $in ) ) 
 {
-    if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } ) {
+    if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } ) {  # TODO use biopieces2fasta() instead
         push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
     } elsif ( $record->{ "Q_ID" } and $record->{ "SEQ" } ) {
         push @entries, [ $record->{ "Q_ID" }, $record->{ "SEQ" } ];
@@ -64,32 +67,29 @@ foreach $entry ( @entries )
         $record = {
             SEQ_NAME => $entry->[ SEQ_NAME ],
             SEQ      => $entry->[ SEQ ],
+            SEQ_LEN  => length $entry->[ SEQ ],
         };
 
         Maasha::Biopieces::put_record( $record, $out );
     }
 }
 
+Maasha::Biopieces::close_stream( $in );
+Maasha::Biopieces::close_stream( $out );
+
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
 BEGIN
 {
-    $run_time_beg = Maasha::Biopieces::run_time();
-
-    Maasha::Biopieces::log_biopiece();
+    Maasha::Biopieces::status_set();
 }
 
 
 END
 {
-    Maasha::Biopieces::close_stream( $in );
-    Maasha::Biopieces::close_stream( $out );
-
-    $run_time_end = Maasha::Biopieces::run_time();
-
-    Maasha::Biopieces::run_time_print( $run_time_beg, $run_time_end, $options );
+    Maasha::Biopieces::status_log();
 }
 
 
@@ -97,4 +97,3 @@ END
 
 
 __END__
-