-#!/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;
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;