]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/write_fixedstep
fixed seq qual length check
[biopieces.git] / bp_bin / write_fixedstep
index 3c3007438773f1d500ab4b094c8db61527af1c39..17957c1bd978eb34b5b247202f7387b388084374 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
 
 # Copyright (C) 2007-2009 Martin A. Hansen.
 
@@ -26,7 +26,9 @@
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
+use warnings;
 use strict;
+use Data::Dumper;
 use Maasha::Biopieces;
 use Maasha::UCSC::Wiggle;
 
@@ -34,13 +36,15 @@ use Maasha::UCSC::Wiggle;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my ( $run_time_beg, $run_time_end, $options, $in, $out, $fh, $record, $entry );
+my ( $options, $in, $out, $fh, $record, $entry );
 
 $options = Maasha::Biopieces::parse_options(
     [
-        { long => 'no_stream', short => 'x', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
-        { long => 'data_out',  short => 'o', type => 'file', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
-        { long => 'compress',  short => 'Z', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
+        { long => 'key',       short => 'k', type => 'string', mandatory => 'no',  default => undef, allowed => undef, disallowed => undef },
+        { long => 'step',      short => 's', type => 'uint',   mandatory => 'no',  default => 1,     allowed => undef, disallowed => undef },
+        { long => 'no_stream', short => 'x', type => 'flag',   mandatory => 'no',  default => undef, allowed => undef, disallowed => undef },
+        { long => 'data_out',  short => 'o', type => 'file',   mandatory => 'no',  default => undef, allowed => undef, disallowed => undef },
+        { long => 'compress',  short => 'Z', type => 'flag',   mandatory => 'no',  default => undef, allowed => undef, disallowed => undef },
     ]   
 );
 
@@ -51,7 +55,7 @@ $fh = Maasha::Biopieces::write_stream( $options->{ "data_out" }, $options->{ "co
 
 while ( $record = Maasha::Biopieces::get_record( $in ) ) 
 {
-    if ( $entry = Maasha::UCSC::Wiggle::biopiece2fixedstep( $record ) ) {
+    if ( $entry = Maasha::UCSC::Wiggle::biopiece2fixedstep( $record, $options->{ "key" }, $options->{ "step" } ) ) {
         Maasha::UCSC::Wiggle::fixedstep_entry_put( $entry, $fh );
     }
 
@@ -60,25 +64,22 @@ while ( $record = Maasha::Biopieces::get_record( $in ) )
 
 close $fh;
 
+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();
 }