Skip to content
Snippets Groups Projects
Commit 1374f3ed authored by Andy Yates's avatar Andy Yates
Browse files

Adding in program assertion as sometimes this is quite a large reason for things going wrong

parent 042e73f4
No related branches found
No related tags found
No related merge requests found
......@@ -213,4 +213,22 @@ sub unlink_all_files {
return;
}
sub assert_executable {
my ($self, $exe) = @_;
if(! -x $exe) {
my $output = `which $exe 2>&1`;
chomp $output;
my $rc = $? >> 8;
if($rc != 0) {
my $possible_location = `locate -l 1 $exe 2>&1`;
my $loc_rc = $? >> 8;
if($loc_rc != 0) {
my $msg = 'Cannot find the executable "%s" after trying "which" and "locate -l 1". Please ensure it is on your PATH or use an absolute location and try again';
$self->throw(sprintf($msg, $exe));
}
}
}
return 1;
}
1;
......@@ -80,6 +80,14 @@ sub param_defaults {
};
}
sub fetch_input {
my ($self) = @_;
$self->assert_executable($self->param('program'));
$self->assert_executable('zcat');
$self->assert_executable('gunzip');
return;
}
sub run {
my ($self) = @_;
if($self->run_indexing()) {
......
......@@ -7,6 +7,9 @@ use Bio::EnsEMBL::Hive::Utils qw/destringify/;
sub fetch_input {
my ($self) = @_;
$self->assert_executable('sendmail');
my $dump_dna = $self->jobs('DumpDNA');
my $copy_dna = $self->jobs('CopyDNA');
my $dump_genes = $self->jobs('DumpGenes');
......
......@@ -77,6 +77,8 @@ sub fetch_input {
if($type ne 'genomic' && $type ne 'genes') {
throw "param 'type' must be set to 'genomic' or 'genes'";
}
$self->assert_executable($self->param('program'));
$self->assert_executable('gunzip');
}
sub write_output {
......
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