]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/read_psl
refactoring of assemble_pairs
[biopieces.git] / bp_bin / read_psl
index e2aa4375b919b692381bbeb4c410fe12a31e9c17..0d7fe35e10270a0909c41fe6c06116eeef4e030d 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::Filesys;
@@ -35,7 +36,7 @@ use Maasha::UCSC::PSL;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, $data_in, $num, $entry );
+my ( $options, $in, $out, $record, $data_in, $num, $entry );
 
 $options = Maasha::Biopieces::parse_options(
     [
@@ -57,37 +58,37 @@ if ( $options->{ 'data_in' } )
 
     $num = 1;
 
-    while ( $record = Maasha::UCSC::PSL::psl_get_entry( $data_in ) ) 
+    while ( $entry = Maasha::UCSC::PSL::psl_entry_get( $data_in ) ) 
     {
-        Maasha::Biopieces::put_record( $record, $out );
+        if ( $record = Maasha::UCSC::PSL::psl2biopiece( $entry ) )
+        {
+            Maasha::Biopieces::put_record( $record, $out );
 
-        last if $options->{ "num" } and $num == $options->{ "num" };
+            last if $options->{ "num" } and $num == $options->{ "num" };
 
-        $num++;
+            $num++;
+        }
     }
 
     close $data_in;
 }
 
+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();
 }