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.252040

=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>

Path to the FASTA file containing the sequence database.

=for Euclid: file.type: readable

=back

=head1 OPTIONAL ARGUMENTS

=over

=item --truncate-ids

Truncate database ids on first whitespace before extraction [default: no].

=item --reorder

Reorder sequences following list [default: no].

=item --version

=item --usage

=item --help

=item --man

Print the usual program information



( run in 0.612 second using v1.01-cache-2.11-cpan-39bf76dae61 )