lib/Bio/AssemblyImprovement/Util/UnzipFileIfNeededRole.pm

filter: Statementstmt 100% 29 / 29 Branchbran 66.6% 4 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 89.3% 42 / 47 CC 5 SCAR 10.5
CC
5
Cov
92%
_gunzip_file_if_needed
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.9
« 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
BranchTrueFalseTotal
unless defined $input_filename 0 27 27
15
16 27 ▶ $output_directory ||= getcwd(); # If an output directory is not given, default to current working directory
Condition66%2/3
$output_directory ||= getcwd()
l!l&&r!l&&!r
15120
MC/DC0%0/2
$output_directory ||= getcwd()
$output_directory getcwd()
Truth table66%2/3
A ||= B
A= $output_directoryB= getcwd()
ABresult
1X1
011
000
17
18 27 $input_filename = abs_path($input_filename);
19
20 27 ▶ if ( $input_filename =~ /\.gz$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($input_filename =~ /\.gz$/) { } 11 16 27
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
BranchTrueFalseTotal
gunzip($input_filename, $output_filename) or die "gunzip failed: $Bio::AssemblyImprovement::Util::UnzipFileIfNeededRole::GunzipError\n" 11 0 11
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__
« lib/Bio/AssemblyImprovement/Abacas/DelimiterRole.pm ↑ Summary lib/Bio/AssemblyImprovement/Scaffold/Descaffold.pm »