Bio-RetrieveAssemblies
view release on metacpan or search on metacpan
lib/Bio/RetrieveAssemblies.pm view on Meta::CPAN
undef $VERSION;
package Bio::RetrieveAssemblies;
$Bio::RetrieveAssemblies::VERSION = '1.1.5';
use Moose;
use Bio::Perl; # force BioPerl to be picked up
use Getopt::Long qw(GetOptionsFromArray);
use Bio::RetrieveAssemblies::WGS;
use Bio::RetrieveAssemblies::AccessionFile;
with('Bio::RetrieveAssemblies::LoggingRole');
# ABSTRACT: Download assemblies from GenBank
has 'search_term' => ( is => 'rw', isa => 'Str' );
has 'output_directory' => ( is => 'rw', isa => 'Str', default => 'downloaded_files' );
has 'file_type' => ( is => 'rw', isa => 'Str', default => 'genbank' );
has 'organism_type' => ( is => 'rw', isa => 'Str', default => 'BCT' );
has 'query' => ( is => 'rw', isa => 'Str', default => '*' );
has 'annotation' => ( is => 'rw', isa => 'Bool', default => 0 );
has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
sub BUILD {
my ($self) = @_;
my ( $help, $file_type, $output_directory, $organism_type,$query,$annotation,$verbose,$cmd_version );
GetOptionsFromArray(
$self->args,
'p|organism_type=s' => \$organism_type,
'f|file_type=s' => \$file_type,
'o|output_directory=s' => \$output_directory,
'q|query=s' => \$query,
'a|annotation' => \$annotation,
'v|verbose' => \$verbose,
'version' => \$cmd_version,
'h|help' => \$help,
);
if( $cmd_version)
{
print $self->_version();
exit();
}
if ( $help || @{ $self->args } == 0 ) {
print $self->usage_text();
die;
}
$self->output_directory($output_directory) if ($output_directory);
$self->file_type($file_type) if ($file_type);
$self->organism_type($organism_type) if ($organism_type);
$self->query($query) if ($query);
$self->annotation($annotation) if ($annotation);
if ( defined($verbose) ) {
$self->verbose($verbose);
$self->logger->level(10000);
}
$self->search_term( $self->args->[0] );
}
sub _version
{
my ($self) = @_;
if(defined(Bio::RetrieveAssemblies->VERSION))
{
return Bio::RetrieveAssemblies->VERSION ."\n";
}
else
{
return "x.y.z\n";
}
}
sub usage_text {
my ($self) = @_;
return <<USAGE;
( run in 1.855 second using v1.01-cache-2.11-cpan-f56aa216473 )