« lib/Bio/AssemblyImprovement/Abacas/DelimiterRole.pm
↑ Summary
lib/Bio/AssemblyImprovement/Scaffold/Descaffold.pm »
| 1 | package Bio::AssemblyImprovement::Util::UnzipFileIfNeededRole; | ||||||||||||||||||||
| 2 | # ABSTRACT: Role for unzipping files if needed | ||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 9 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 9 | ▶ | use IO::Uncompress::Gunzip qw(gunzip $GunzipError); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 9 | ▶ | use Cwd; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 9 | ▶ | use Cwd 'abs_path'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 9 | ▶ | use File::Basename; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 27 | ▶ | sub _gunzip_file_if_needed { | ||||||||||||||||||
|
Subroutine
_gunzip_file_if_needed: called CC=5 SCAR=16.3
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 27 | my ( $self, $input_filename, $output_directory ) = @_; | |||||||||||||||||||
| 14 | 27 | ▶ | return undef unless(defined($input_filename)); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 27 | ▶ | $output_directory ||= getcwd(); # If an output directory is not given, default to current working directory | ||||||||||||||||||
|
Condition66%2/3
$output_directory ||= getcwd()
MC/DC0%0/2
$output_directory ||= getcwd()
$output_directory
getcwd()
Truth table66%2/3
A ||= B
A= $output_directoryB= getcwd()
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 27 | $input_filename = abs_path($input_filename); | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 27 | ▶ | if ( $input_filename =~ /\.gz$/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 21 | 11 | my $base_filename = fileparse( $input_filename, qr/\.[^.]*/ ); | |||||||||||||||||||
| 22 | 11 | my $output_filename = join( '/', ( $output_directory, $base_filename ) ); | |||||||||||||||||||
| 23 | 11 | ▶ | gunzip $input_filename => $output_filename or die "gunzip failed: $GunzipError\n"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 24 | 11 | return $output_filename; | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | else { | ||||||||||||||||||||
| 27 | 16 | return $input_filename; | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 9 | ▶ | no Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | 9 | 1; | |||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | __END__ | ||||||||||||||||||||