X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fread_tab;h=a8dede9d9ce979fb12c20718de8c993b1027cf2b;hb=48bea5c28b89dc5586d0bddb338ccd6ba23aa1f9;hp=b6c82ab0de6ede21482689650a08339f2ad6c049;hpb=9854397f83abe8d5a8c614b799ef3107d3f85f80;p=biopieces.git diff --git a/bp_bin/read_tab b/bp_bin/read_tab index b6c82ab..a8dede9 100755 --- a/bp_bin/read_tab +++ b/bp_bin/read_tab @@ -1,4 +1,4 @@ -#!/usr/bin/env perl -w +#!/usr/bin/env perl # Copyright (C) 2007-2009 Martin A. Hansen. @@ -26,16 +26,17 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +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( [ @@ -57,22 +58,31 @@ while ( $record = Maasha::Biopieces::get_record( $in ) ) { 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; @@ -104,25 +114,22 @@ if ( $options->{ 'data_in' } ) 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(); } @@ -130,7 +137,3 @@ END __END__ - - - -