lib/Bio/Roary/Output/BlastIdentityFrequency.pm

filter: Statementstmt 57.5% 19 / 33 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 1 totaltotal 48.9% 23 / 47 CC 4 SCAR 13.9
CC
4
Cov
49%
_build__output_fh
6.0
_build__input_fh
6.0
create_file
6.0
CRAP 4.0
« lib/Bio/Roary/AnnotateGroups.pm ↑ Summary lib/Bio/Roary/UniqueGenesPerSample.pm »
1 package Bio::Roary::Output::BlastIdentityFrequency;
2 1 $Bio::Roary::Output::BlastIdentityFrequency::VERSION = '3.13.0';
3 # ABSTRACT: Take in blast results and find the percentage identity graph
4  
5  
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Bio::SeqIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Bio::Roary::Exceptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 has 'input_filename' => ( is => 'ro', isa => 'Str', default => '_blast_results' );
11 1 has 'output_filename' => ( is => 'ro', isa => 'Str', default => 'blast_identity_frequency.Rtab' );
12  
13 1 has '_output_fh' => ( is => 'ro', lazy => 1, builder => '_build__output_fh' );
14 1 has '_input_fh' => ( is => 'ro', lazy => 1, builder => '_build__input_fh' );
15  
16 sub _build__output_fh
17 0 ▶{
Subroutine _build__output_fh: not called CC=2 SCAR=17.9
18 0 my ($self) = @_;
19 0 ▶ open( my $fh, '>', $self->output_filename )
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $self->output_filename or "Bio::Roary::Exceptions::CouldntWriteToFile"->throw("error", 'Couldnt write output file:' . $self->output_filename) 0 0 0
20 or Bio::Roary::Exceptions::CouldntWriteToFile->throw(
21 error => "Couldnt write output file:" . $self->output_filename );
22 0 return $fh;
23 }
24  
25 sub _build__input_fh
26 0 ▶{
Subroutine _build__input_fh: not called CC=2 SCAR=17.9
27 0 my ($self) = @_;
28 0 my $input_string = 'awk \'{print $3}\' '.$self->input_filename.' | awk \'BEGIN {FS="."}; {print $1}\'| sort | uniq -c | awk \'{print $2"\t"$1}\'';
29
30 0 ▶ open( my $fh, '-|', $input_string ) or die "Couldnt open results file";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "-|", $input_string or die "Couldnt open results file" 0 0 0
31 0 return $fh;
32 }
33  
34 sub create_file
35 0 ▶{
Subroutine create_file: not called CC=2 SCAR=17.9
Pod undocumented
36 0 my ($self) = @_;
37
38 0 my $input_fh = $self->_input_fh;
39 0 ▶ while(<$input_fh>)
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $input_fh)) 0 0 0
40 {
41 0 print {$self->_output_fh} $_;
42 }
43 0 close($self->_input_fh);
44 0 close($self->_output_fh);
45 }
46  
47 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 1 __PACKAGE__->meta->make_immutable;
49  
50 1 1;
51  
52 __END__
« lib/Bio/Roary/AnnotateGroups.pm ↑ Summary lib/Bio/Roary/UniqueGenesPerSample.pm »