-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #833 from Ensembl/bugfixes/merge-fixes-110
Bugfixes/merge fixes 110
- Loading branch information
Showing
8 changed files
with
126 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
=head1 LICENSE | ||
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute | ||
Copyright [2016-2023] EMBL-European Bioinformatics Institute | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
=head1 NAME | ||
Bio::EnsEMBL::Production::Pipeline::Common::Gzip; | ||
=head1 DESCRIPTION | ||
A simple script for gzipping files and catching errors | ||
=head1 AUTHOR | ||
ckong@ebi.ac.uk | ||
=cut | ||
package Bio::EnsEMBL::Production::Pipeline::Common::Gzip;; | ||
|
||
use strict; | ||
use warnings; | ||
use base qw/Bio::EnsEMBL::Production::Pipeline::Common::Base/; | ||
use IO::Compress::Gzip qw(gzip $GzipError) ; | ||
|
||
sub fetch_input { | ||
my ($self) = @_; | ||
return; | ||
} | ||
|
||
sub run { | ||
my ($self) = @_; | ||
my @compress = (); | ||
if (ref $self->param_required('compress') eq 'ARRAY') { | ||
@compress = @{$self->param_required('compress')}; | ||
}else{ | ||
push(@compress, $self->param_required('compress')) | ||
} | ||
foreach my $file (@compress) { | ||
my $output_file = $file.'.gz'; | ||
eval { | ||
local $SIG{PIPE} = sub { die "gzip interrupted by SIGPIPE\n" }; | ||
gzip $file => $output_file | ||
or die "gzip failed: $GzipError\n"; | ||
unlink $file; | ||
}; | ||
if ($@) { | ||
print "Error compressing '$file': $@\n"; | ||
} else { | ||
print "Compressed '$file' to '$output_file' and removed the original file\n"; | ||
} | ||
} | ||
return; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.