-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
# Copyright (C) 2007-2009 Martin A. Hansen.
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+use warnings;
use strict;
-use Maasha::Common;
-use Maasha::Fasta;
+use Data::Dumper;
+use Maasha::Filesys;
use Maasha::Biopieces;
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, $data_in, $num, $skip, $line, @fields, @fields2, $i );
+my ( $options, $in, $out, $record, $data_in, $num, $skip, $line, @fields, @fields2, $i );
$options = Maasha::Biopieces::parse_options(
[
if ( $options->{ 'data_in' } )
{
- $data_in = Maasha::Common::read_open_multi( $options->{ 'data_in' } );
+ $data_in = Maasha::Filesys::files_read_open( $options->{ 'data_in' } );
$num = 1;
$skip = $options->{ 'skip' };
while ( $line = <$data_in> )
{
+ chomp $line;
+
if ( $skip )
{
$skip--;
next;
}
- next if $line =~ /^#|^$/;
+ next if $line =~ /^$/; # skip empty lines.
- chomp $line;
+ if ( $line =~ /^#.+/ and not defined $options->{ 'keys' } )
+ {
+ $line = substr $line, 1;
+
+ $options->{ 'keys' } = [ split /$options->{'delimit'}/, $line ];
+
+ next;
+ }
undef $record;
undef @fields2;
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();
}
__END__
-
-
-
-