Bio-MUST-Apps-OmpaPa
view release on metacpan or search on metacpan
bin/ompa-pa.pl view on Meta::CPAN
#!/usr/bin/env perl
# PODNAME: ompa-pa.pl
# ABSTRACT: Extract seqs from BLAST/HMMER interactively or in batch mode
# CONTRIBUTOR: Amandine BERTRAND <amandine.bertrand@doct.uliege.be>
use Modern::Perl '2011';
use autodie;
use Getopt::Euclid qw(:vars);
use Smart::Comments;
use IO::Prompter [
-verbatim,
-style => 'blue strong',
-must => { 'be a string' => qr{\S+}xms }
];
use Bio::MUST::Core;
use aliased 'Bio::MUST::Core::Ali::Stash';
use aliased 'Bio::MUST::Core::Taxonomy';
use aliased 'Bio::MUST::Core::Taxonomy::ColorScheme';
use aliased 'Bio::MUST::Apps::OmpaPa::Blast';
use aliased 'Bio::MUST::Apps::OmpaPa::Hmmer';
# TODO: re-implement BLAST parsing and nr extraction; done?
die <<'EOT' if !$ARGV_database && $ARGV_extract_seqs;
Missing required arguments:
--database=<file>
EOT
die <<'EOT' if !$ARGV_taxdir && $ARGV_extract_tax;
Missing required arguments:
--taxdir=<dir>
EOT
# setup OmpaPa sub-class based on report type
my $class = $ARGV_report_type eq 'blastxml' ? Blast : Hmmer;
my $scheme;
if ($ARGV_taxdir) {
my $tax = Taxonomy->new_from_cache( tax_dir => $ARGV_taxdir );
$scheme = $ARGV_colorize ? $tax->load_color_scheme($ARGV_colorize)
: ColorScheme->new(
tax => $tax,
names => [ qw(Archaea Bacteria Eukaryota Viruses) ],
colors => [ qw( blue green red orange) ],
)
;
}
# build args hash for Bio::MUST::Apps::OmpaPa::XXX constructor
# TODO: update attribute names
my %args;
$args{database} = $ARGV_database if $ARGV_database;
$args{extract_seqs} = 1 if $ARGV_extract_seqs;
$args{extract_taxs} = 1 if $ARGV_extract_tax;
$args{restore_last_param} = 1 if $ARGV_restore_last_params;
$args{nb_org} = $ARGV_max_copy;
$args{align} = $ARGV_min_cov;
$args{gnuplot_term} = $ARGV_gnuplot_term;
# process infiles
for my $infile (@ARGV_infiles) {
### Processing: $infile
( run in 0.242 second using v1.01-cache-2.11-cpan-1dc43b0fbd2 )