← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:45:50 2015

Filename/Users/ap13/pathogens/Roary/lib/Bio/Roary/Output/NumberOfGroups.pm
StatementsExecuted 7242570 statements in 2.43s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
10113.38s3.58sBio::Roary::Output::NumberOfGroups::::_single_iteration_gene_expansionBio::Roary::Output::NumberOfGroups::_single_iteration_gene_expansion
111409µs3.58sBio::Roary::Output::NumberOfGroups::::create_output_filesBio::Roary::Output::NumberOfGroups::create_output_files
441408µs993µsBio::Roary::Output::NumberOfGroups::::_create_raw_output_fileBio::Roary::Output::NumberOfGroups::_create_raw_output_file
411284µs284µsBio::Roary::Output::NumberOfGroups::::CORE:closeBio::Roary::Output::NumberOfGroups::CORE:close (opcode)
411274µs274µsBio::Roary::Output::NumberOfGroups::::CORE:openBio::Roary::Output::NumberOfGroups::CORE:open (opcode)
1011233µs351µsBio::Roary::Output::NumberOfGroups::::_shuffle_input_filesBio::Roary::Output::NumberOfGroups::_shuffle_input_files
11162µs5.15msBio::Roary::Output::NumberOfGroups::::BEGIN@17Bio::Roary::Output::NumberOfGroups::BEGIN@17
802127µs27µsBio::Roary::Output::NumberOfGroups::::CORE:printBio::Roary::Output::NumberOfGroups::CORE:print (opcode)
11116µs58µsBio::Roary::Output::NumberOfGroups::::BEGIN@18Bio::Roary::Output::NumberOfGroups::BEGIN@18
11111µs112µsBio::Roary::Output::NumberOfGroups::::BEGIN@116Bio::Roary::Output::NumberOfGroups::BEGIN@116
11110µs10µsBio::Roary::Output::NumberOfGroups::::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:31]Bio::Roary::Output::NumberOfGroups::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:31]
1119µs9µsBio::Roary::Output::NumberOfGroups::::BEGIN@19Bio::Roary::Output::NumberOfGroups::BEGIN@19
1116µs6µsBio::Roary::Output::NumberOfGroups::::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:34]Bio::Roary::Output::NumberOfGroups::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:34]
1116µs6µsBio::Roary::Output::NumberOfGroups::::BEGIN@20Bio::Roary::Output::NumberOfGroups::BEGIN@20
1112µs2µsBio::Roary::Output::NumberOfGroups::::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:33]Bio::Roary::Output::NumberOfGroups::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:33]
1112µs2µsBio::Roary::Output::NumberOfGroups::::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:32]Bio::Roary::Output::NumberOfGroups::__ANON__[lib/Bio/Roary/Output/NumberOfGroups.pm:32]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package 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
8use Bio::Roary::Output::NumberOfGroups;
9
10my $obj = Bio::Roary::Output::NumberOfGroups->new(
11 group_statistics_obj => $group_stats
12 );
13$obj->create_files();
14
15=cut
16
17259µs210.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
use Moose;
# spent 5.15ms making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@17 # spent 5.09ms making 1 call to Moose::import
18228µs270µ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
use List::Util qw(shuffle);
# spent 58µs making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@18 # spent 12µs making 1 call to List::Util::import
19224µs19µ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
use Bio::Roary::AnnotateGroups;
# spent 9µs making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@19
202578µs16µ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
use Bio::Roary::GroupStatistics;
# spent 6µs making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@20
21
2212µs11.95mshas 'group_statistics_obj' => ( is => 'ro', isa => 'Bio::Roary::GroupStatistics', required => 1 );
# spent 1.95ms making 1 call to Moose::has
2312µs11.53mshas 'number_of_iterations' => ( is => 'ro', isa => 'Int', default => 10);
# spent 1.53ms making 1 call to Moose::has
2412µs12.05mshas 'groups_to_contigs' => ( is => 'ro', isa => 'Maybe[HashRef]' );
# spent 2.05ms making 1 call to Moose::has
2512µs11.75mshas 'annotate_groups_obj' => ( is => 'ro', isa => 'Bio::Roary::AnnotateGroups', required => 1 );
# spent 1.75ms making 1 call to Moose::has
26
2712µs11.55mshas 'output_raw_filename_conserved_genes' => ( is => 'ro', isa => 'Str', default => 'number_of_conserved_genes.Rtab' );
# spent 1.55ms making 1 call to Moose::has
2812µs11.47mshas 'output_raw_filename_unique_genes' => ( is => 'ro', isa => 'Str', default => 'number_of_unique_genes.Rtab' );
# spent 1.47ms making 1 call to Moose::has
2912µs11.45mshas '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
3012µs11.43mshas 'output_raw_filename_new_genes' => ( is => 'ro', isa => 'Str', default => 'number_of_new_genes.Rtab' );
# spent 1.43ms making 1 call to Moose::has
3129µs11.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]
has '_conserved_genes' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] } );
# spent 1.45ms making 1 call to Moose::has
3227µs11.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]
has '_unique_genes' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] } );
# spent 1.43ms making 1 call to Moose::has
33210µs11.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]
has '_total_genes' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] } );
# spent 1.48ms making 1 call to Moose::has
34219µs12.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]
has '_new_genes' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] } );
# 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
sub create_output_files {
377224µs my ($self) = @_;
38
39213.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
433558µs $self->_create_raw_output_file( $self->output_raw_filename_conserved_genes, $self->_conserved_genes );
443194µs $self->_create_raw_output_file( $self->output_raw_filename_unique_genes, $self->_unique_genes );
453146µs $self->_create_raw_output_file( $self->output_raw_filename_total_genes, $self->_total_genes );
463151µs $self->_create_raw_output_file( $self->output_raw_filename_new_genes, $self->_new_genes );
47 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
sub _create_raw_output_file {
5116699µs my ( $self, $filename, $output_data ) = @_;
524274µs open( my $fh, '>', $filename );
# spent 274µs making 4 calls to Bio::Roary::Output::NumberOfGroups::CORE:open, avg 69µs/call
53 for my $iterations ( @{$output_data} ) {
5480292µs4021µs print {$fh} join( "\t", @{$iterations} );
# spent 21µs making 40 calls to Bio::Roary::Output::NumberOfGroups::CORE:print, avg 515ns/call
55406µs print {$fh} "\n";
# spent 6µs making 40 calls to Bio::Roary::Output::NumberOfGroups::CORE:print, avg 150ns/call
56 }
574284µ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
sub _shuffle_input_files {
6130251µs my ($self) = @_;
6230119µ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 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
sub _single_iteration_gene_expansion {
6714035.4ms my ($self) = @_;
68 my %existing_groups;
69 my @conserved_genes_added_per_file;
70 my @unique_genes_added_per_file;
71 my @total_genes_added_per_file;
72 my @new_genes_added_per_file;
73
7410351µ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 my $files_counter = 1;
77 for my $input_file ( @{$shuffled_input_files} ) {
78960496ms my $unique_groups_counter = 0;
79 my $total_groups_counter = 0;
80 my $new_group_counter = 0;
81 my $conserved_groups_counter = 0;
82160201ms 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 for my $group ( @{$new_groups} ) {
852885840936ms if ( !defined( $existing_groups{$group} ) ) {
86 $new_group_counter++;
87 }
88 $existing_groups{$group}++;
89 }
90
91 for my $group ( keys %existing_groups ) {
924355469965ms if ( $existing_groups{$group} >= $files_counter ) {
93 $conserved_groups_counter++;
94 }
95
96 if ( $existing_groups{$group} == 1 ) {
97 $unique_groups_counter++;
98 }
99 $total_groups_counter++;
100 }
101
102 push( @conserved_genes_added_per_file, $conserved_groups_counter );
103 push( @unique_genes_added_per_file, $unique_groups_counter );
104 push( @total_genes_added_per_file, $total_groups_counter );
105 push( @new_genes_added_per_file, $new_group_counter );
106 $files_counter++;
107 }
10810140µ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
1091058µ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
1101046µ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
1111043µ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 return;
114}
115
116260µs2212µ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
no Moose;
# spent 112µs making 1 call to Bio::Roary::Output::NumberOfGroups::BEGIN@116 # spent 100µs making 1 call to Moose::unimport
11717µs210.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
119162µs1;
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
sub Bio::Roary::Output::NumberOfGroups::CORE:close; # opcode
# 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
sub Bio::Roary::Output::NumberOfGroups::CORE:open; # opcode
# 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
sub Bio::Roary::Output::NumberOfGroups::CORE:print; # opcode