Skip to content

Commit

Permalink
Allow safe mode to override incompatible option checks
Browse files Browse the repository at this point in the history
  • Loading branch information
William McLaren committed Dec 16, 2016
1 parent ce97abd commit 4e8d26e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions modules/Bio/EnsEMBL/VEP/Config.pm
Expand Up @@ -449,9 +449,11 @@ sub check_config {
}

# check incompatible flags
foreach my $flag(grep {$config->{$_}} keys %INCOMPATIBLE) {
foreach my $invalid(grep {$config->{$_}} @{$INCOMPATIBLE{$flag}}) {
throw sprintf("ERROR: Can't use --%s and --%s together\n", $flag, $invalid);
unless($config->{safe}) {
foreach my $flag(grep {$config->{$_}} keys %INCOMPATIBLE) {
foreach my $invalid(grep {$config->{$_}} @{$INCOMPATIBLE{$flag}}) {
throw sprintf("ERROR: Can't use --%s and --%s together\n", $flag, $invalid);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/Bio/EnsEMBL/VEP/Constants.pm
Expand Up @@ -20,7 +20,7 @@ use warnings;
use base qw(Exporter);

our $VEP_VERSION = 87;
our $VEP_SUB_VERSION = 9;
our $VEP_SUB_VERSION = 10;

our @EXPORT_OK = qw(
@FLAG_FIELDS
Expand Down
3 changes: 3 additions & 0 deletions t/Config.t
Expand Up @@ -111,6 +111,9 @@ throws_ok { Bio::EnsEMBL::VEP::Config->new({format => 'gobbledegook'}) } qr/not
# incompatible flags
throws_ok { Bio::EnsEMBL::VEP::Config->new({database => 1, cache => 1}) } qr/Can\'t use.+together/, 'incompatible params';

# incompatible ok with safe on
ok(Bio::EnsEMBL::VEP::Config->new({safe => 1, most_severe => 1, symbol => 1}), 'incompatible pass with safe');

# missing database/cache/offline
throws_ok { Bio::EnsEMBL::VEP::Config->new({database => 0}) } qr/The VEP can read gene data from/, 'no database/cache/offline';

Expand Down

0 comments on commit 4e8d26e

Please sign in to comment.