| 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
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||