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 Config::Any;
use Getopt::Euclid qw(:vars);
use Path::Class qw(file dir);
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::IdList';
use aliased 'Bio::MUST::Core::Taxonomy';
use aliased 'Bio::MUST::Core::Taxonomy::ColorScheme';
use aliased 'Bio::MUST::Apps::OmpaPa::Parameters';
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_skip_config || $ARGV_colorize || $ARGV_extract_tax);
Missing required arguments:
--taxdir=<dir>
EOT
die <<'EOT' if !$ARGV_skip_config && $ARGV_batch_classify;
Missing required arguments:
--skip-config=<file>
EOT
# setup OmpaPa sub-class based on report type
my $class = $ARGV_report_type eq 'blastxml' ? Blast : Hmmer;
# setup Taxonomy-related objects
my $scheme;
my $classifier;
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) ],
)
;
if ($ARGV_skip_config) {
# read configuration file
my $skip_config = Config::Any->load_files( {
files => [ $ARGV_skip_config ],
flatten_to_hash => 1,
( run in 1.398 second using v1.01-cache-2.11-cpan-ad19def0cd9 )