Bio-MUST-Core

 view release on metacpan or  search on metacpan

bin/extract-ali.pl  view on Meta::CPAN

#!/usr/bin/env perl
# PODNAME: extract-ali.pl
# ABSTRACT: Extract sequences from a FASTA database file based on id lists

use Modern::Perl '2011';
use autodie;

use Getopt::Euclid qw(:vars);
use Smart::Comments;

use Bio::MUST::Core;
use Bio::MUST::Core::Utils qw(change_suffix);
use aliased 'Bio::MUST::Core::Ali::Stash';
use aliased 'Bio::MUST::Core::IdList';


my %args;
$args{truncate_ids} = 1 if $ARGV_truncate_ids;

# load database
my $db = Stash->load($ARGV_database, \%args);

for my $infile (@ARGV_infiles) {

    ### Processing: $infile
    my $list = IdList->load($infile);

    # assemble Ali and store it as FASTA file
    my $ali = $ARGV_reorder ? $list->reordered_ali($db)
            :                 $list->filtered_ali($db)
    ;
    $ali->dont_guess;
    my $outfile = change_suffix($infile, '.ali');
    $ali->store($outfile);
}

__END__

=pod

=head1 NAME

extract-ali.pl - Extract sequences from a FASTA database file based on id lists

=head1 VERSION

version 0.240390

=head1 USAGE

    extract-ali.pl <infiles> --database=<file> [optional arguments]

=head1 REQUIRED ARGUMENTS

=over

=item <infiles>

Path to input IDL files [repeatable argument].

=for Euclid: infiles.type: readable
    repeatable

=item --database=<file>

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.422 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )