Commit 62f0a16f authored by Andy Yates's avatar Andy Yates
Browse files

Supporting empty array specification and using the value specified in the param_defaults

parent 59414cf7
......@@ -5,11 +5,28 @@ use warnings;
use base qw/Bio::EnsEMBL::Hive::Process/;
use Bio::EnsEMBL::Utils::Exception qw/throw/;
use Bio::EnsEMBL::Utils::Scalar qw/check_ref/;
use File::Find;
use File::Spec;
use File::Path qw/mkpath/;
use POSIX qw/strftime/;
# Takes in a key, checks if the current $self->param() was an empty array
# and replaces it with the value from $self->param_defaults()
sub reset_empty_array_param {
my ($self, $key) = @_;
my $param_defaults = $self->param_defaults();
my $current = $self->param($key);
my $replacement = $self->param_defaults()->{$key};
if(check_ref($current, 'ARRAY') && check_ref($replacement, 'ARRAY')) {
if(! @{$current}) {
$self->fine('Restting param %s because the given array was empty', $key);
$self->param($key, $replacement);
}
}
return;
}
sub get_Slices {
my ($self, $type) = @_;
my $sa = $self->get_DBAdaptor($type)->get_SliceAdaptor();
......
......@@ -70,7 +70,6 @@ use warnings;
use base qw/Bio::EnsEMBL::Pipeline::FASTA::Base/;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Utils::Scalar qw/wrap_array/;
sub param_defaults {
my ($self) = @_;
......@@ -84,6 +83,9 @@ sub param_defaults {
sub fetch_input {
my ($self) = @_;
$self->reset_empty_array_param('sequence_type_list');
$self->reset_empty_array_param('db_types');
my $core_dbas = $self->get_DBAdaptors();
$self->info('Found %d core DBAdaptor(s) to process', scalar(@{$core_dbas}));
$self->param('dbas', $core_dbas);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment