Filename | /Users/ap13/pathogens/Roary/lib/Bio/Roary/Output/NumberOfGroups.pm |
Statements | Executed 7242570 statements in 2.43s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
10 | 1 | 1 | 3.38s | 3.58s | _single_iteration_gene_expansion | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 409µs | 3.58s | create_output_files | Bio::Roary::Output::NumberOfGroups::
4 | 4 | 1 | 408µs | 993µs | _create_raw_output_file | Bio::Roary::Output::NumberOfGroups::
4 | 1 | 1 | 284µs | 284µs | CORE:close (opcode) | Bio::Roary::Output::NumberOfGroups::
4 | 1 | 1 | 274µs | 274µs | CORE:open (opcode) | Bio::Roary::Output::NumberOfGroups::
10 | 1 | 1 | 233µs | 351µs | _shuffle_input_files | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 62µs | 5.15ms | BEGIN@17 | Bio::Roary::Output::NumberOfGroups::
80 | 2 | 1 | 27µs | 27µs | CORE:print (opcode) | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 16µs | 58µs | BEGIN@18 | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 11µs | 112µs | BEGIN@116 | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 10µs | 10µs | __ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:31] | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 9µs | 9µs | BEGIN@19 | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 6µs | 6µs | __ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:34] | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 6µs | 6µs | BEGIN@20 | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 2µs | 2µs | __ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:33] | Bio::Roary::Output::NumberOfGroups::
1 | 1 | 1 | 2µs | 2µs | __ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:32] | Bio::Roary::Output::NumberOfGroups::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Bio::Roary::Output::NumberOfGroups; | ||||
2 | |||||
3 | # ABSTRACT: Create raw output files of group counts for turning into plots | ||||
4 | |||||
5 | =head1 SYNOPSIS | ||||
6 | |||||
7 | # ABSTRACT: Create raw output files of group counts for turning into plots | ||||
8 | use Bio::Roary::Output::NumberOfGroups; | ||||
9 | |||||
10 | my $obj = Bio::Roary::Output::NumberOfGroups->new( | ||||
11 | group_statistics_obj => $group_stats | ||||
12 | ); | ||||
13 | $obj->create_files(); | ||||
14 | |||||
15 | =cut | ||||
16 | |||||
17 | 2 | 59µs | 2 | 10.2ms | # spent 5.15ms (62µs+5.09) within Bio::Roary::Output::NumberOfGroups::BEGIN@17 which was called:
# once (62µs+5.09ms) by Bio::Roary::PostAnalysis::BEGIN@19 at line 17 # spent 5.15ms making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@17
# spent 5.09ms making 1 call to Moose::import |
18 | 2 | 28µs | 2 | 70µs | # spent 58µs (16+42) within Bio::Roary::Output::NumberOfGroups::BEGIN@18 which was called:
# once (16µs+42µs) by Bio::Roary::PostAnalysis::BEGIN@19 at line 18 # spent 58µs making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@18
# spent 12µs making 1 call to List::Util::import |
19 | 2 | 24µs | 1 | 9µs | # spent 9µs within Bio::Roary::Output::NumberOfGroups::BEGIN@19 which was called:
# once (9µs+0s) by Bio::Roary::PostAnalysis::BEGIN@19 at line 19 # spent 9µs making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@19 |
20 | 2 | 578µs | 1 | 6µs | # spent 6µs within Bio::Roary::Output::NumberOfGroups::BEGIN@20 which was called:
# once (6µs+0s) by Bio::Roary::PostAnalysis::BEGIN@19 at line 20 # spent 6µs making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@20 |
21 | |||||
22 | 1 | 2µs | 1 | 1.95ms | has 'group_statistics_obj' => ( is => 'ro', isa => 'Bio::Roary::GroupStatistics', required => 1 ); # spent 1.95ms making 1 call to Moose::has |
23 | 1 | 2µs | 1 | 1.53ms | has 'number_of_iterations' => ( is => 'ro', isa => 'Int', default => 10); # spent 1.53ms making 1 call to Moose::has |
24 | 1 | 2µs | 1 | 2.05ms | has 'groups_to_contigs' => ( is => 'ro', isa => 'Maybe[HashRef]' ); # spent 2.05ms making 1 call to Moose::has |
25 | 1 | 2µs | 1 | 1.75ms | has 'annotate_groups_obj' => ( is => 'ro', isa => 'Bio::Roary::AnnotateGroups', required => 1 ); # spent 1.75ms making 1 call to Moose::has |
26 | |||||
27 | 1 | 2µs | 1 | 1.55ms | has 'output_raw_filename_conserved_genes' => ( is => 'ro', isa => 'Str', default => 'number_of_conserved_genes.Rtab' ); # spent 1.55ms making 1 call to Moose::has |
28 | 1 | 2µs | 1 | 1.47ms | has 'output_raw_filename_unique_genes' => ( is => 'ro', isa => 'Str', default => 'number_of_unique_genes.Rtab' ); # spent 1.47ms making 1 call to Moose::has |
29 | 1 | 2µs | 1 | 1.45ms | has 'output_raw_filename_total_genes' => ( is => 'ro', isa => 'Str', default => 'number_of_genes_in_pan_genome.Rtab' ); # spent 1.45ms making 1 call to Moose::has |
30 | 1 | 2µs | 1 | 1.43ms | has 'output_raw_filename_new_genes' => ( is => 'ro', isa => 'Str', default => 'number_of_new_genes.Rtab' ); # spent 1.43ms making 1 call to Moose::has |
31 | 2 | 9µs | 1 | 1.45ms | # spent 10µs within Bio::Roary::Output::NumberOfGroups::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:31] which was called:
# once (10µs+0s) by Bio::Roary::Output::NumberOfGroups::new at line 45 of (eval 25)[Eval/Closure.pm:125] # spent 1.45ms making 1 call to Moose::has |
32 | 2 | 7µs | 1 | 1.43ms | # spent 2µs within Bio::Roary::Output::NumberOfGroups::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:32] which was called:
# once (2µs+0s) by Bio::Roary::Output::NumberOfGroups::new at line 87 of (eval 25)[Eval/Closure.pm:125] # spent 1.43ms making 1 call to Moose::has |
33 | 2 | 10µs | 1 | 1.48ms | # spent 2µs within Bio::Roary::Output::NumberOfGroups::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:33] which was called:
# once (2µs+0s) by Bio::Roary::Output::NumberOfGroups::new at line 73 of (eval 25)[Eval/Closure.pm:125] # spent 1.48ms making 1 call to Moose::has |
34 | 2 | 19µs | 1 | 2.13ms | # spent 6µs within Bio::Roary::Output::NumberOfGroups::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:34] which was called:
# once (6µs+0s) by Bio::Roary::Output::NumberOfGroups::new at line 59 of (eval 25)[Eval/Closure.pm:125] # spent 2.13ms making 1 call to Moose::has |
35 | |||||
36 | # spent 3.58s (409µs+3.58) within Bio::Roary::Output::NumberOfGroups::create_output_files which was called:
# once (409µs+3.58s) by Bio::Roary::PostAnalysis::run at line 77 of lib/Bio/Roary/PostAnalysis.pm | ||||
37 | 1 | 800ns | my ($self) = @_; | ||
38 | |||||
39 | 1 | 167µs | 21 | 3.58s | for ( my $i = 0 ; $i < $self->number_of_iterations ; $i++ ) { # spent 3.58s making 10 calls to Bio::Roary::Output::NumberOfGroups::_single_iteration_gene_expansion, avg 358ms/call
# spent 136µs making 11 calls to Bio::Roary::Output::NumberOfGroups::number_of_iterations, avg 12µs/call |
40 | $self->_single_iteration_gene_expansion; | ||||
41 | } | ||||
42 | |||||
43 | 1 | 13µs | 3 | 558µs | $self->_create_raw_output_file( $self->output_raw_filename_conserved_genes, $self->_conserved_genes ); # spent 543µs making 1 call to Bio::Roary::Output::NumberOfGroups::_create_raw_output_file
# spent 10µs making 1 call to Bio::Roary::Output::NumberOfGroups::output_raw_filename_conserved_genes
# spent 5µs making 1 call to Bio::Roary::Output::NumberOfGroups::_conserved_genes |
44 | 1 | 19µs | 3 | 194µs | $self->_create_raw_output_file( $self->output_raw_filename_unique_genes, $self->_unique_genes ); # spent 173µs making 1 call to Bio::Roary::Output::NumberOfGroups::_create_raw_output_file
# spent 18µs making 1 call to Bio::Roary::Output::NumberOfGroups::output_raw_filename_unique_genes
# spent 4µs making 1 call to Bio::Roary::Output::NumberOfGroups::_unique_genes |
45 | 1 | 11µs | 3 | 146µs | $self->_create_raw_output_file( $self->output_raw_filename_total_genes, $self->_total_genes ); # spent 133µs making 1 call to Bio::Roary::Output::NumberOfGroups::_create_raw_output_file
# spent 9µs making 1 call to Bio::Roary::Output::NumberOfGroups::output_raw_filename_total_genes
# spent 4µs making 1 call to Bio::Roary::Output::NumberOfGroups::_total_genes |
46 | 1 | 7µs | 3 | 151µs | $self->_create_raw_output_file( $self->output_raw_filename_new_genes, $self->_new_genes ); # spent 144µs making 1 call to Bio::Roary::Output::NumberOfGroups::_create_raw_output_file
# spent 4µs making 1 call to Bio::Roary::Output::NumberOfGroups::output_raw_filename_new_genes
# spent 4µs making 1 call to Bio::Roary::Output::NumberOfGroups::_new_genes |
47 | 1 | 6µs | return 1; | ||
48 | } | ||||
49 | |||||
50 | # spent 993µs (408+585) within Bio::Roary::Output::NumberOfGroups::_create_raw_output_file which was called 4 times, avg 248µs/call:
# once (206µs+337µs) by Bio::Roary::Output::NumberOfGroups::create_output_files at line 43
# once (71µs+102µs) by Bio::Roary::Output::NumberOfGroups::create_output_files at line 44
# once (64µs+79µs) by Bio::Roary::Output::NumberOfGroups::create_output_files at line 46
# once (68µs+66µs) by Bio::Roary::Output::NumberOfGroups::create_output_files at line 45 | ||||
51 | 4 | 7µs | my ( $self, $filename, $output_data ) = @_; | ||
52 | 4 | 355µs | 4 | 274µs | open( my $fh, '>', $filename ); # spent 274µs making 4 calls to Bio::Roary::Output::NumberOfGroups::CORE:open, avg 69µs/call |
53 | 4 | 7µs | for my $iterations ( @{$output_data} ) { | ||
54 | 40 | 211µs | 40 | 21µs | print {$fh} join( "\t", @{$iterations} ); # spent 21µs making 40 calls to Bio::Roary::Output::NumberOfGroups::CORE:print, avg 515ns/call |
55 | 40 | 81µs | 40 | 6µs | print {$fh} "\n"; # spent 6µs making 40 calls to Bio::Roary::Output::NumberOfGroups::CORE:print, avg 150ns/call |
56 | } | ||||
57 | 4 | 330µs | 4 | 284µs | close($fh); # spent 284µs making 4 calls to Bio::Roary::Output::NumberOfGroups::CORE:close, avg 71µs/call |
58 | } | ||||
59 | |||||
60 | # spent 351µs (233+119) within Bio::Roary::Output::NumberOfGroups::_shuffle_input_files which was called 10 times, avg 35µs/call:
# 10 times (233µs+119µs) by Bio::Roary::Output::NumberOfGroups::_single_iteration_gene_expansion at line 74, avg 35µs/call | ||||
61 | 10 | 8µs | my ($self) = @_; | ||
62 | 10 | 191µs | 30 | 119µs | my @shuffled_input_files = shuffle( @{ $self->group_statistics_obj->_sorted_file_names } ); # spent 52µs making 10 calls to Bio::Roary::GroupStatistics::_sorted_file_names, avg 5µs/call
# spent 36µs making 10 calls to Bio::Roary::Output::NumberOfGroups::group_statistics_obj, avg 4µs/call
# spent 31µs making 10 calls to List::Util::shuffle, avg 3µs/call |
63 | 10 | 53µs | return \@shuffled_input_files; | ||
64 | } | ||||
65 | |||||
66 | # spent 3.58s (3.38+202ms) within Bio::Roary::Output::NumberOfGroups::_single_iteration_gene_expansion which was called 10 times, avg 358ms/call:
# 10 times (3.38s+202ms) by Bio::Roary::Output::NumberOfGroups::create_output_files at line 39, avg 358ms/call | ||||
67 | 10 | 16µs | my ($self) = @_; | ||
68 | 10 | 5µs | my %existing_groups; | ||
69 | 10 | 5µs | my @conserved_genes_added_per_file; | ||
70 | 10 | 1µs | my @unique_genes_added_per_file; | ||
71 | 10 | 1µs | my @total_genes_added_per_file; | ||
72 | 10 | 2µs | my @new_genes_added_per_file; | ||
73 | |||||
74 | 10 | 30µs | 10 | 351µs | my $shuffled_input_files = $self->_shuffle_input_files(); # spent 351µs making 10 calls to Bio::Roary::Output::NumberOfGroups::_shuffle_input_files, avg 35µs/call |
75 | |||||
76 | 10 | 5µs | my $files_counter = 1; | ||
77 | 10 | 32µs | for my $input_file ( @{$shuffled_input_files} ) { | ||
78 | 80 | 74µs | my $unique_groups_counter = 0; | ||
79 | 80 | 24µs | my $total_groups_counter = 0; | ||
80 | 80 | 25µs | my $new_group_counter = 0; | ||
81 | 80 | 22µs | my $conserved_groups_counter = 0; | ||
82 | 80 | 1.27ms | 160 | 201ms | my $new_groups = $self->group_statistics_obj->_files_to_groups->{$input_file}; # spent 200ms making 80 calls to Bio::Roary::GroupStatistics::_files_to_groups, avg 2.50ms/call
# spent 932µs making 80 calls to Bio::Roary::Output::NumberOfGroups::group_statistics_obj, avg 12µs/call |
83 | |||||
84 | 80 | 336µs | for my $group ( @{$new_groups} ) { | ||
85 | 1442920 | 541ms | if ( !defined( $existing_groups{$group} ) ) { | ||
86 | $new_group_counter++; | ||||
87 | } | ||||
88 | 1442920 | 394ms | $existing_groups{$group}++; | ||
89 | } | ||||
90 | |||||
91 | 80 | 493ms | for my $group ( keys %existing_groups ) { | ||
92 | 1451823 | 617ms | if ( $existing_groups{$group} >= $files_counter ) { | ||
93 | $conserved_groups_counter++; | ||||
94 | } | ||||
95 | |||||
96 | 1451823 | 169ms | if ( $existing_groups{$group} == 1 ) { | ||
97 | $unique_groups_counter++; | ||||
98 | } | ||||
99 | 1451823 | 179ms | $total_groups_counter++; | ||
100 | } | ||||
101 | |||||
102 | 80 | 403µs | push( @conserved_genes_added_per_file, $conserved_groups_counter ); | ||
103 | 80 | 75µs | push( @unique_genes_added_per_file, $unique_groups_counter ); | ||
104 | 80 | 54µs | push( @total_genes_added_per_file, $total_groups_counter ); | ||
105 | 80 | 52µs | push( @new_genes_added_per_file, $new_group_counter ); | ||
106 | 80 | 386µs | $files_counter++; | ||
107 | } | ||||
108 | 10 | 150µs | 10 | 140µs | push( @{ $self->_conserved_genes }, \@conserved_genes_added_per_file ); # spent 140µs making 10 calls to Bio::Roary::Output::NumberOfGroups::_conserved_genes, avg 14µs/call |
109 | 10 | 46µs | 10 | 58µs | push( @{ $self->_unique_genes }, \@unique_genes_added_per_file ); # spent 58µs making 10 calls to Bio::Roary::Output::NumberOfGroups::_unique_genes, avg 6µs/call |
110 | 10 | 39µs | 10 | 46µs | push( @{ $self->_total_genes }, \@total_genes_added_per_file ); # spent 46µs making 10 calls to Bio::Roary::Output::NumberOfGroups::_total_genes, avg 5µs/call |
111 | 10 | 44µs | 10 | 43µs | push( @{ $self->_new_genes }, \@new_genes_added_per_file ); # spent 43µs making 10 calls to Bio::Roary::Output::NumberOfGroups::_new_genes, avg 4µs/call |
112 | |||||
113 | 10 | 35.0ms | return; | ||
114 | } | ||||
115 | |||||
116 | 2 | 60µs | 2 | 212µs | # spent 112µs (11+100) within Bio::Roary::Output::NumberOfGroups::BEGIN@116 which was called:
# once (11µs+100µs) by Bio::Roary::PostAnalysis::BEGIN@19 at line 116 # spent 112µs making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@116
# spent 100µs making 1 call to Moose::unimport |
117 | 1 | 7µs | 2 | 10.5ms | __PACKAGE__->meta->make_immutable; # spent 10.4ms making 1 call to Class::MOP::Class::make_immutable
# spent 17µs making 1 call to Bio::Roary::Output::NumberOfGroups::meta |
118 | |||||
119 | 1 | 62µs | 1; | ||
120 | |||||
# spent 284µs within Bio::Roary::Output::NumberOfGroups::CORE:close which was called 4 times, avg 71µs/call:
# 4 times (284µs+0s) by Bio::Roary::Output::NumberOfGroups::_create_raw_output_file at line 57, avg 71µs/call | |||||
# spent 274µs within Bio::Roary::Output::NumberOfGroups::CORE:open which was called 4 times, avg 69µs/call:
# 4 times (274µs+0s) by Bio::Roary::Output::NumberOfGroups::_create_raw_output_file at line 52, avg 69µs/call | |||||
# spent 27µs within Bio::Roary::Output::NumberOfGroups::CORE:print which was called 80 times, avg 332ns/call:
# 40 times (21µs+0s) by Bio::Roary::Output::NumberOfGroups::_create_raw_output_file at line 54, avg 515ns/call
# 40 times (6µs+0s) by Bio::Roary::Output::NumberOfGroups::_create_raw_output_file at line 55, avg 150ns/call |