← 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:43 2015

Filename/Users/ap13/pathogens/Roary/lib/Bio/Roary/AnnotateGroups.pm
StatementsExecuted 1329540 statements in 3.41s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
32985111.95s3.05sBio::Roary::AnnotateGroups::::_ids_grouped_by_gene_name_for_groupBio::Roary::AnnotateGroups::_ids_grouped_by_gene_name_for_group
1821511973ms1.38sBio::Roary::AnnotateGroups::::consensus_product_for_id_namesBio::Roary::AnnotateGroups::consensus_product_for_id_names
5120351348ms572msBio::Roary::AnnotateGroups::::CORE:sortBio::Roary::AnnotateGroups::CORE:sort (opcode)
3298522319ms3.39sBio::Roary::AnnotateGroups::::_consensus_gene_name_for_groupBio::Roary::AnnotateGroups::_consensus_gene_name_for_group
111216ms250msBio::Roary::AnnotateGroups::::_generate__ids_to_groupsBio::Roary::AnnotateGroups::_generate__ids_to_groups
111208ms263msBio::Roary::AnnotateGroups::::_builder__groups_to_id_namesBio::Roary::AnnotateGroups::_builder__groups_to_id_names
111195ms3.34sBio::Roary::AnnotateGroups::::reannotateBio::Roary::AnnotateGroups::reannotate
111192ms2.78sBio::Roary::AnnotateGroups::::_generate_groups_to_consensus_gene_namesBio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names
111163ms1.83sBio::Roary::AnnotateGroups::::_build__ids_to_gene_namesBio::Roary::AnnotateGroups::_build__ids_to_gene_names
85277.7ms77.8msBio::Roary::AnnotateGroups::::_groupsBio::Roary::AnnotateGroups::_groups
546534157.9ms57.9msBio::Roary::AnnotateGroups::::CORE:matchBio::Roary::AnnotateGroups::CORE:match (opcode)
182162112.2ms12.2msBio::Roary::AnnotateGroups::::CORE:readlineBio::Roary::AnnotateGroups::CORE:readline (opcode)
18215119.43ms9.43msBio::Roary::AnnotateGroups::::CORE:printBio::Roary::AnnotateGroups::CORE:print (opcode)
36430216.29ms6.29msBio::Roary::AnnotateGroups::::CORE:regcompBio::Roary::AnnotateGroups::CORE:regcomp (opcode)
1113.99ms4.74msBio::Roary::AnnotateGroups::::BEGIN@22Bio::Roary::AnnotateGroups::BEGIN@22
111962µs1.25msBio::Roary::AnnotateGroups::::BEGIN@25Bio::Roary::AnnotateGroups::BEGIN@25
111516µs122msBio::Roary::AnnotateGroups::::BEGIN@21Bio::Roary::AnnotateGroups::BEGIN@21
221404µs404µsBio::Roary::AnnotateGroups::::CORE:openBio::Roary::AnnotateGroups::CORE:open (opcode)
111374µs466µsBio::Roary::AnnotateGroups::::BEGIN@23Bio::Roary::AnnotateGroups::BEGIN@23
111373µs373µsBio::Roary::AnnotateGroups::::CORE:closeBio::Roary::AnnotateGroups::CORE:close (opcode)
11184µs3.03sBio::Roary::AnnotateGroups::::_split_groupsBio::Roary::AnnotateGroups::_split_groups
11150µs5.78msBio::Roary::AnnotateGroups::::BEGIN@19Bio::Roary::AnnotateGroups::BEGIN@19
11137µs55µsBio::Roary::AnnotateGroups::::_build__filtered_gff_filesBio::Roary::AnnotateGroups::_build__filtered_gff_files
11127µs1.83sBio::Roary::AnnotateGroups::::BUILDBio::Roary::AnnotateGroups::BUILD
11119µs386µsBio::Roary::AnnotateGroups::::_build__output_fhBio::Roary::AnnotateGroups::_build__output_fh
11116µs175µsBio::Roary::AnnotateGroups::::BEGIN@325Bio::Roary::AnnotateGroups::BEGIN@325
11112µs12µsBio::Roary::AnnotateGroups::::__ANON__[lib/Bio/Roary/AnnotateGroups.pm:31]Bio::Roary::AnnotateGroups::__ANON__[lib/Bio/Roary/AnnotateGroups.pm:31]
1119µs9µsBio::Roary::AnnotateGroups::::BEGIN@20Bio::Roary::AnnotateGroups::BEGIN@20
0000s0sBio::Roary::AnnotateGroups::::__ANON__[lib/Bio/Roary/AnnotateGroups.pm:116]Bio::Roary::AnnotateGroups::__ANON__[lib/Bio/Roary/AnnotateGroups.pm:116]
0000s0sBio::Roary::AnnotateGroups::::_build__groups_to_consensus_gene_namesBio::Roary::AnnotateGroups::_build__groups_to_consensus_gene_names
0000s0sBio::Roary::AnnotateGroups::::_build__ids_to_verbose_statsBio::Roary::AnnotateGroups::_build__ids_to_verbose_stats
0000s0sBio::Roary::AnnotateGroups::::_build__number_of_filesBio::Roary::AnnotateGroups::_build__number_of_files
0000s0sBio::Roary::AnnotateGroups::::_builder__group_counterBio::Roary::AnnotateGroups::_builder__group_counter
0000s0sBio::Roary::AnnotateGroups::::_builder__ids_to_groupsBio::Roary::AnnotateGroups::_builder__ids_to_groups
0000s0sBio::Roary::AnnotateGroups::::_remove_ids_from_groupBio::Roary::AnnotateGroups::_remove_ids_from_group
0000s0sBio::Roary::AnnotateGroups::::full_annotationBio::Roary::AnnotateGroups::full_annotation
0000s0sBio::Roary::AnnotateGroups::::inferenceBio::Roary::AnnotateGroups::inference
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::AnnotateGroups;
2
3# ABSTRACT: Take in a group file and assosiated GFF files for the isolates and update the group name to the gene name
4
5=head1 SYNOPSIS
6
7Take in a group file and assosiated GFF files for the isolates and update the group name to the gene name
8 use Bio::Roary::AnnotateGroups;
9
10 my $obj = Bio::Roary::AnnotateGroups->new(
11 gff_files => ['abc.gff','efg.gff'],
12 output_filename => 'example_output.fa',
13 groups_filename => 'groupsfile',
14 );
15 $obj->reannotate;
16
17=cut
18
19267µs211.5ms
# spent 5.78ms (50µs+5.73) within Bio::Roary::AnnotateGroups::BEGIN@19 which was called: # once (50µs+5.73ms) by Bio::Roary::PostAnalysis::BEGIN@16 at line 19
use Moose;
# spent 5.78ms making 1 call to Bio::Roary::AnnotateGroups::BEGIN@19 # spent 5.73ms making 1 call to Moose::import
20230µs19µs
# spent 9µs within Bio::Roary::AnnotateGroups::BEGIN@20 which was called: # once (9µs+0s) by Bio::Roary::PostAnalysis::BEGIN@16 at line 20
use Bio::Roary::Exceptions;
# spent 9µs making 1 call to Bio::Roary::AnnotateGroups::BEGIN@20
212170µs1122ms
# spent 122ms (516µs+122) within Bio::Roary::AnnotateGroups::BEGIN@21 which was called: # once (516µs+122ms) by Bio::Roary::PostAnalysis::BEGIN@16 at line 21
use Bio::Roary::GeneNamesFromGFF;
# spent 122ms making 1 call to Bio::Roary::AnnotateGroups::BEGIN@21
222157µs24.78ms
# spent 4.74ms (3.99+745µs) within Bio::Roary::AnnotateGroups::BEGIN@22 which was called: # once (3.99ms+745µs) by Bio::Roary::PostAnalysis::BEGIN@16 at line 22
use Data::Dumper;
# spent 4.74ms making 1 call to Bio::Roary::AnnotateGroups::BEGIN@22 # spent 36µs making 1 call to Exporter::import
232143µs2515µs
# spent 466µs (374+92) within Bio::Roary::AnnotateGroups::BEGIN@23 which was called: # once (374µs+92µs) by Bio::Roary::PostAnalysis::BEGIN@16 at line 23
use Array::Utils qw(array_minus);
# spent 466µs making 1 call to Bio::Roary::AnnotateGroups::BEGIN@23 # spent 49µs making 1 call to Exporter::import
24
2521.81ms21.28ms
# spent 1.25ms (962µs+287µs) within Bio::Roary::AnnotateGroups::BEGIN@25 which was called: # once (962µs+287µs) by Bio::Roary::PostAnalysis::BEGIN@16 at line 25
use File::Grep qw(fgrep);
# spent 1.25ms making 1 call to Bio::Roary::AnnotateGroups::BEGIN@25 # spent 34µs making 1 call to Exporter::import
26
2714µs12.51mshas 'gff_files' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
# spent 2.51ms making 1 call to Moose::has
2812µs11.97mshas 'output_filename' => ( is => 'ro', isa => 'Str', default => 'reannotated_groups_file' );
# spent 1.97ms making 1 call to Moose::has
2913µs11.60mshas 'groups_filename' => ( is => 'ro', isa => 'Str', required => 1 );
# spent 1.60ms making 1 call to Moose::has
3012µs11.77mshas '_ids_to_gene_names' => ( is => 'ro', isa => 'HashRef', lazy => 1, builder => '_build__ids_to_gene_names' );
# spent 1.77ms making 1 call to Moose::has
31217µs11.72ms
# spent 12µs within Bio::Roary::AnnotateGroups::__ANON__[lib/Bio/Roary/AnnotateGroups.pm:31] which was called: # once (12µs+0s) by Bio::Roary::AnnotateGroups::new at line 101 of (eval 25)[Eval/Closure.pm:125]
has '_ids_to_product' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
# spent 1.72ms making 1 call to Moose::has
3212µs11.78mshas '_groups_to_id_names' => ( is => 'ro', isa => 'HashRef', lazy => 1, builder => '_builder__groups_to_id_names' );
# spent 1.78ms making 1 call to Moose::has
3312µs12.05mshas '_output_fh' => ( is => 'ro', lazy => 1, builder => '_build__output_fh' );
# spent 2.05ms making 1 call to Moose::has
34111µs12.47mshas '_groups_to_consensus_gene_names' =>
# spent 2.47ms making 1 call to Moose::has
35 ( is => 'rw', isa => 'HashRef', lazy => 1, builder => '_build__groups_to_consensus_gene_names' );
3613µs12.38mshas '_filtered_gff_files' => ( is => 'ro', isa => 'ArrayRef', lazy => 1, builder => '_build__filtered_gff_files' );
# spent 2.38ms making 1 call to Moose::has
3713µs12.23mshas '_number_of_files' => ( is => 'ro', isa => 'Int', lazy => 1, builder => '_build__number_of_files' );
# spent 2.23ms making 1 call to Moose::has
3812µs12.75mshas '_ids_to_groups' => ( is => 'rw', isa => 'HashRef', lazy => 1, builder => '_builder__ids_to_groups' );
# spent 2.75ms making 1 call to Moose::has
39
4013µs13.27mshas '_group_counter' => ( is => 'rw', isa => 'Int', lazy => 1, builder => '_builder__group_counter' );
# spent 3.27ms making 1 call to Moose::has
4112µs12.05mshas '_group_default_prefix' => ( is => 'rw', isa => 'Str', default => 'group_' );
# spent 2.05ms making 1 call to Moose::has
42
4312µs14.28mshas '_ids_to_verbose_stats' => ( is => 'rw', isa => 'HashRef', lazy_build => 1 );
# spent 4.28ms making 1 call to Moose::has
44
45
# spent 1.83s (27µs+1.83) within Bio::Roary::AnnotateGroups::BUILD which was called: # once (27µs+1.83s) by Bio::Roary::AnnotateGroups::new at line 159 of (eval 25)[Eval/Closure.pm:125]
sub BUILD {
46237µs my ($self) = @_;
4711.83s $self->_ids_to_gene_names;
# spent 1.83s making 1 call to Bio::Roary::AnnotateGroups::_ids_to_gene_names
48}
49
50sub _builder__group_counter {
51 my ($self) = @_;
52 my $prefix = $self->_group_default_prefix;
53 my $highest_group = 0;
54 for my $group ( @{ $self->_groups } ) {
55 if ( $group =~ /$prefix([\d]+)$/ ) {
56 my $group_id = $1;
57 if ( $group_id > $highest_group ) {
58 $highest_group = $group_id;
59 }
60 }
61 }
62 return $highest_group + 1;
63}
64
65
# spent 250ms (216+33.6) within Bio::Roary::AnnotateGroups::_generate__ids_to_groups which was called: # once (216ms+33.6ms) by Bio::Roary::AnnotateGroups::_split_groups at line 259
sub _generate__ids_to_groups {
6646.75ms my ($self) = @_;
67 my %ids_to_groups;
68
6916µs for my $group ( keys %{ $self->_groups_to_id_names } ) {
701821544.9ms1821533.6ms for my $id_name ( @{ $self->_groups_to_id_names->{$group} } ) {
# spent 33.6ms making 18215 calls to Bio::Roary::AnnotateGroups::_groups_to_id_names, avg 2µs/call
71144292110ms $ids_to_groups{$id_name} = $group;
72 }
73 }
74 return \%ids_to_groups;
75}
76
77sub _builder__ids_to_groups {
78 my ($self) = @_;
79 return $self->_generate__ids_to_groups;
80}
81
82
# spent 386µs (19+367) within Bio::Roary::AnnotateGroups::_build__output_fh which was called: # once (19µs+367µs) by Bio::Roary::AnnotateGroups::_output_fh at line 11 of (eval 25)[Eval/Closure.pm:125]
sub _build__output_fh {
833379µs my ($self) = @_;
842367µs open( my $fh, '>', $self->output_filename )
# spent 358µs making 1 call to Bio::Roary::AnnotateGroups::CORE:open # spent 9µs making 1 call to Bio::Roary::AnnotateGroups::output_filename
85 or Bio::Roary::Exceptions::CouldntWriteToFile->throw(
86 error => "Couldnt write output file:" . $self->output_filename );
87 return $fh;
88}
89
90
# spent 55µs (37+18) within Bio::Roary::AnnotateGroups::_build__filtered_gff_files which was called: # once (37µs+18µs) by Bio::Roary::AnnotateGroups::_filtered_gff_files at line 12 of (eval 25)[Eval/Closure.pm:125]
sub _build__filtered_gff_files {
91343µs my ($self) = @_;
92918µs my @gff_files = grep( /\.gff$/, @{ $self->gff_files } );
# spent 10µs making 8 calls to Bio::Roary::AnnotateGroups::CORE:match, avg 1µs/call # spent 8µs making 1 call to Bio::Roary::AnnotateGroups::gff_files
93 return \@gff_files;
94}
95
96
# spent 1.83s (163ms+1.67) within Bio::Roary::AnnotateGroups::_build__ids_to_gene_names which was called: # once (163ms+1.67s) by Bio::Roary::AnnotateGroups::_ids_to_gene_names at line 12 of (eval 25)[Eval/Closure.pm:125]
sub _build__ids_to_gene_names {
97646µs my ($self) = @_;
98 my %ids_to_gene_names;
99 my %ids_to_product;
100194µs for my $filename ( @{ $self->_filtered_gff_files } ) {
# spent 94µs making 1 call to Bio::Roary::AnnotateGroups::_filtered_gff_files
10140139ms8740µs my $gene_names_from_gff = Bio::Roary::GeneNamesFromGFF->new( gff_file => $filename );
# spent 740µs making 8 calls to Bio::Roary::GeneNamesFromGFF::new, avg 93µs/call
10281.66s my %id_to_gene_lookup = %{ $gene_names_from_gff->ids_to_gene_name };
# spent 1.66s making 8 calls to Bio::Roary::GeneNamesFromGFF::ids_to_gene_name, avg 208ms/call
103 @ids_to_gene_names{ keys %id_to_gene_lookup } = values %id_to_gene_lookup;
104
105893µs my %id_to_product_lookup = %{ $gene_names_from_gff->ids_to_product };
# spent 93µs making 8 calls to Bio::Roary::GeneNamesFromGFF::ids_to_product, avg 12µs/call
106124.6ms8298µs @ids_to_product{ keys %id_to_product_lookup } = values %id_to_product_lookup;
# spent 298µs making 8 calls to Bio::Roary::GeneNamesFromGFF::DESTROY, avg 37µs/call
107 }
108119µs $self->_ids_to_product( \%ids_to_product );
# spent 19µs making 1 call to Bio::Roary::AnnotateGroups::_ids_to_product
109
110 return \%ids_to_gene_names;
111}
112
113sub _build__ids_to_verbose_stats {
114 my $self = shift;
115
116 my @matches_hash = fgrep { /ID=/i } @{ $self->_filtered_gff_files };
117 my @matches;
118 foreach my $m ( @matches_hash ){
119 push( @matches, values $m->{matches} );
120 }
121 # chomp @matches;
122
123 my %verbose;
124 foreach my $line ( @matches ){
125 my ( $id, $inf, $prod );
126 if( $line =~ m/ID=["']?([^;"']+)["']?;?/i ){
127 $id = $1;
128 }
129 else {
130 next;
131 }
132
133 $inf = $1 if ( $line =~ m/inference=([^;]+);/ );
134 $prod = $1 if ( $line =~ m/product=([^;]+)[;\n]/ );
135
136
137 my %info = ( 'inference' => $inf, 'product' => $prod );
138 $verbose{$id} = \%info;
139 }
140
141 return \%verbose;
142}
143
144
145
# spent 1.38s (973ms+411ms) within Bio::Roary::AnnotateGroups::consensus_product_for_id_names which was called 18215 times, avg 76µs/call: # 18215 times (973ms+411ms) by Bio::Roary::GroupStatistics::_row at line 135 of lib/Bio/Roary/GroupStatistics.pm, avg 76µs/call
sub consensus_product_for_id_names {
14691075150ms my ( $self, $id_names ) = @_;
147 my %product_freq;
148 for my $id_name ( @{$id_names} ) {
149288584511ms144292206ms next unless ( defined( $self->_ids_to_product->{$id_name} ) );
# spent 206ms making 144292 calls to Bio::Roary::AnnotateGroups::_ids_to_product, avg 1µs/call
150144292195ms $product_freq{ $self->_ids_to_product->{$id_name} }++;
# spent 195ms making 144292 calls to Bio::Roary::AnnotateGroups::_ids_to_product, avg 1µs/call
151 }
152
153182159.83ms my @sorted_product_keys = sort { $product_freq{$b} <=> $product_freq{$a} } keys(%product_freq);
# spent 9.83ms making 18215 calls to Bio::Roary::AnnotateGroups::CORE:sort, avg 540ns/call
154
155 if ( @sorted_product_keys > 0 ) {
156 return $sorted_product_keys[0];
157 }
158 else {
159 return '';
160 }
161}
162
163
# spent 263ms (208+55.1) within Bio::Roary::AnnotateGroups::_builder__groups_to_id_names which was called: # once (208ms+55.1ms) by Bio::Roary::AnnotateGroups::_groups_to_id_names at line 12 of (eval 25)[Eval/Closure.pm:125]
sub _builder__groups_to_id_names {
1645124µs my ($self) = @_;
165 my %groups_to_id_names;
166
167253µs open( my $fh, $self->groups_filename )
# spent 46µs making 1 call to Bio::Roary::AnnotateGroups::CORE:open # spent 7µs making 1 call to Bio::Roary::AnnotateGroups::groups_filename
168 or Bio::Roary::Exceptions::FileNotFound->throw( error => "Group file not found:" . $self->groups_filename );
169117µs while (<$fh>) {
# spent 17µs making 1 call to Bio::Roary::AnnotateGroups::CORE:readline
17054645124ms chomp;
171 my $line = $_;
17272860122ms3643055.0ms if ( $line =~ /^(.+): (.+)$/ ) {
# spent 42.8ms making 18215 calls to Bio::Roary::AnnotateGroups::CORE:match, avg 2µs/call # spent 12.2ms making 18215 calls to Bio::Roary::AnnotateGroups::CORE:readline, avg 669ns/call
173 my $group_name = $1;
174 my $genes = $2;
175 my @elements = split( /[\s\t]+/, $genes );
176 $groups_to_id_names{$group_name} = \@elements;
177 }
178 }
179
180 return \%groups_to_id_names;
181}
182
183
# spent 77.8ms (77.7+45µs) within Bio::Roary::AnnotateGroups::_groups which was called 8 times, avg 9.72ms/call: # 2 times (26.4ms+9µs) by Bio::Roary::Output::EmblGroups::_build__groups_to_files at line 71 of lib/Bio/Roary/Output/EmblGroups.pm, avg 13.2ms/call # 2 times (20.3ms+12µs) by Bio::Roary::Output::EmblGroups::create_files at line 227 of lib/Bio/Roary/Output/EmblGroups.pm, avg 10.2ms/call # 2 times (14.8ms+9µs) by Bio::Roary::Output::EmblGroups::_fragment_blocks at line 183 of lib/Bio/Roary/Output/EmblGroups.pm, avg 7.40ms/call # once (8.41ms+2µs) by Bio::Roary::GroupStatistics::_build__groups_to_files at line 97 of lib/Bio/Roary/GroupStatistics.pm # once (7.81ms+14µs) by Bio::Roary::GroupStatistics::create_spreadsheet at line 190 of lib/Bio/Roary/GroupStatistics.pm
sub _groups {
1842477.8ms my ($self) = @_;
185845µs my @groups = keys %{ $self->_groups_to_id_names };
# spent 45µs making 8 calls to Bio::Roary::AnnotateGroups::_groups_to_id_names, avg 6µs/call
186 return \@groups;
187}
188
189
# spent 3.05s (1.95+1.11) within Bio::Roary::AnnotateGroups::_ids_grouped_by_gene_name_for_group which was called 32985 times, avg 93µs/call: # 32985 times (1.95s+1.11s) by Bio::Roary::AnnotateGroups::_consensus_gene_name_for_group at line 202, avg 93µs/call
sub _ids_grouped_by_gene_name_for_group {
190131940165ms my ( $self, $group_name ) = @_;
191 my %gene_name_freq;
1923298559.7ms for my $id_name ( @{ $self->_groups_to_id_names->{$group_name} } ) {
# spent 59.7ms making 32985 calls to Bio::Roary::AnnotateGroups::_groups_to_id_names, avg 2µs/call
1932612591.08s6405171.05s if ( defined( $self->_ids_to_gene_names->{$id_name} ) && $self->_ids_to_gene_names->{$id_name} ne "" ) {
# spent 1.05s making 640517 calls to Bio::Roary::AnnotateGroups::_ids_to_gene_names, avg 2µs/call
194 push( @{ $gene_name_freq{ $self->_ids_to_gene_names->{$id_name} } }, $id_name );
195 }
196 }
197 return \%gene_name_freq;
198}
199
200
# spent 3.39s (319ms+3.08) within Bio::Roary::AnnotateGroups::_consensus_gene_name_for_group which was called 32985 times, avg 103µs/call: # 18215 times (156ms+1.63s) by Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names at line 231, avg 98µs/call # 14770 times (164ms+1.45s) by Bio::Roary::GroupStatistics::_non_unique_name_for_group at line 85 of lib/Bio/Roary/GroupStatistics.pm, avg 109µs/call
sub _consensus_gene_name_for_group {
201131940294ms my ( $self, $group_name ) = @_;
202329853.05s my $gene_name_freq = $self->_ids_grouped_by_gene_name_for_group($group_name);
# spent 3.05s making 32985 calls to Bio::Roary::AnnotateGroups::_ids_grouped_by_gene_name_for_group, avg 93µs/call
203
2043298521.9ms my @sorted_gene_names = sort { @{ $gene_name_freq->{$b} } <=> @{ $gene_name_freq->{$a} } } keys %{$gene_name_freq};
# spent 21.9ms making 32985 calls to Bio::Roary::AnnotateGroups::CORE:sort, avg 663ns/call
205920829.5ms if ( @sorted_gene_names > 0 ) {
206 return shift(@sorted_gene_names);
207 }
208 else {
209 return $group_name;
210 }
211}
212
213
# spent 2.78s (192ms+2.59) within Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names which was called: # once (192ms+2.59s) by Bio::Roary::AnnotateGroups::_split_groups at line 258
sub _generate_groups_to_consensus_gene_names {
2147191ms my ($self) = @_;
215 my %groups_to_gene_names;
216 my %gene_name_freq;
217114µs my $group_prefix = $self->_group_default_prefix;
218
219 #Ā These are already annotated
22073444638ms for my $group_name ( sort { @{ $self->_groups_to_id_names->{$b} } <=> @{ $self->_groups_to_id_names->{$a} } }
# spent 376ms making 73443 calls to Bio::Roary::AnnotateGroups::_groups_to_id_names, avg 5µs/call # spent 262ms making 1 call to Bio::Roary::AnnotateGroups::CORE:sort
221 keys %{ $self->_groups_to_id_names } )
222 {
2231821548.5ms364307.21ms next if ( $group_name =~ /$group_prefix/ );
# spent 5.22ms making 18215 calls to Bio::Roary::AnnotateGroups::CORE:match, avg 286ns/call # spent 2.00ms making 18215 calls to Bio::Roary::AnnotateGroups::CORE:regcomp, avg 110ns/call
224 $groups_to_gene_names{$group_name} = $group_name;
225 }
226
22773444374ms for my $group_name ( sort { @{ $self->_groups_to_id_names->{$b} } <=> @{ $self->_groups_to_id_names->{$a} } }
# spent 263ms making 1 call to Bio::Roary::AnnotateGroups::CORE:sort # spent 112ms making 73443 calls to Bio::Roary::AnnotateGroups::_groups_to_id_names, avg 2µs/call
228 keys %{ $self->_groups_to_id_names } )
229 {
23054645110ms3643014.1ms next unless ( $group_name =~ /$group_prefix/ );
# spent 9.84ms making 18215 calls to Bio::Roary::AnnotateGroups::CORE:match, avg 540ns/call # spent 4.29ms making 18215 calls to Bio::Roary::AnnotateGroups::CORE:regcomp, avg 236ns/call
231182151.78s my $consensus_gene_name = $self->_consensus_gene_name_for_group($group_name);
# spent 1.78s making 18215 calls to Bio::Roary::AnnotateGroups::_consensus_gene_name_for_group, avg 98µs/call
232
233160987.77ms if ( defined( $gene_name_freq{$consensus_gene_name} ) ) {
234 $groups_to_gene_names{$group_name} = $group_name;
235 }
236 else {
237 $groups_to_gene_names{$group_name} = $consensus_gene_name;
238 $gene_name_freq{$consensus_gene_name}++;
239 }
240 }
241 return \%groups_to_gene_names;
242}
243
244sub _build__groups_to_consensus_gene_names {
245 my ($self) = @_;
246 return $self->_generate_groups_to_consensus_gene_names;
247}
248
249sub _build__number_of_files {
250 my ($self) = @_;
251 return @{ $self->gff_files };
252}
253
254
255
# spent 3.03s (84µs+3.03) within Bio::Roary::AnnotateGroups::_split_groups which was called: # once (84µs+3.03s) by Bio::Roary::AnnotateGroups::reannotate at line 275
sub _split_groups {
256362µs my ($self) = @_;
257
25822.78s $self->_groups_to_consensus_gene_names( $self->_generate_groups_to_consensus_gene_names );
2592250ms $self->_ids_to_groups( $self->_generate__ids_to_groups );
# spent 250ms making 1 call to Bio::Roary::AnnotateGroups::_generate__ids_to_groups # spent 32µs making 1 call to Bio::Roary::AnnotateGroups::_ids_to_groups
260}
261
262sub _remove_ids_from_group {
263 my ( $self, $ids_to_remove, $group ) = @_;
264
265 my @remaining_ids = array_minus( @{ $self->_groups_to_id_names->{$group} }, @{ $ids_to_remove } );
266 $self->_groups_to_id_names->{$group} = \@remaining_ids;
267 if ( @{ $self->_groups_to_id_names->{$group} } == 0 ) {
268 delete( $self->_groups_to_id_names->{$group} );
269 }
270}
271
272
# spent 3.34s (195ms+3.15) within Bio::Roary::AnnotateGroups::reannotate which was called: # once (195ms+3.15s) by Bio::Roary::PostAnalysis::run at line 75 of lib/Bio/Roary/PostAnalysis.pm
sub reannotate {
273634.9ms my ($self) = @_;
274
27513.03s $self->_split_groups;
# spent 3.03s making 1 call to Bio::Roary::AnnotateGroups::_split_groups
276
27713µs my %groups_to_id_names = %{ $self->_groups_to_id_names };
278116.0ms for
# spent 16.0ms making 1 call to Bio::Roary::AnnotateGroups::CORE:sort
279 my $group_name ( sort { @{ $groups_to_id_names{$b} } <=> @{ $groups_to_id_names{$a} } } keys %groups_to_id_names )
280 {
28136430130ms1821530.4ms my $consensus_gene_name = $self->_groups_to_consensus_gene_names->{$group_name};
# spent 30.4ms making 18215 calls to Bio::Roary::AnnotateGroups::_groups_to_consensus_gene_names, avg 2µs/call
282 print { $self->_output_fh } $consensus_gene_name . ": "
2835464565.8ms . join( "\t", @{ $self->_groups_to_id_names->{$group_name} } ) . "\n";
# spent 28.7ms making 18215 calls to Bio::Roary::AnnotateGroups::_output_fh, avg 2µs/call # spent 27.7ms making 18215 calls to Bio::Roary::AnnotateGroups::_groups_to_id_names, avg 2µs/call # spent 9.43ms making 18215 calls to Bio::Roary::AnnotateGroups::CORE:print, avg 518ns/call
284 }
2852387µs close( $self->_output_fh );
# spent 373µs making 1 call to Bio::Roary::AnnotateGroups::CORE:close # spent 14µs making 1 call to Bio::Roary::AnnotateGroups::_output_fh
286 return $self;
287}
288
289sub full_annotation {
290 my ( $self, $group ) = @_;
291
292 my @id_names = @{ $self->_groups_to_id_names->{$group} };
293
294 my %product_freq;
295 for my $id_name ( @id_names ) {
296 next unless ( defined( $self->_ids_to_verbose_stats->{$id_name}->{'product'} ) );
297 $product_freq{ $self->_ids_to_verbose_stats->{$id_name}->{'product'} }++;
298 }
299
300 my @sorted_product_keys = sort { $product_freq{$b} <=> $product_freq{$a} } keys(%product_freq);
301
302 if ( @sorted_product_keys > 0 ) {
303 return join('; ', @sorted_product_keys);
304 }
305 else {
306 return '';
307 }
308
309}
310
311sub inference {
312 my ( $self, $group ) = @_;
313
314 my @infs;
315 foreach my $g ( @{ $self->_groups_to_id_names->{$group} } ){
316 next unless ( defined $self->_ids_to_verbose_stats->{$g}->{'inference'} );
317 push( @infs, $self->_ids_to_verbose_stats->{$g}->{'inference'} );
318 }
319
320 # maybe make a consensus in the future?
321
322 return $infs[0];
323}
324
325276µs2334µs
# spent 175µs (16+159) within Bio::Roary::AnnotateGroups::BEGIN@325 which was called: # once (16µs+159µs) by Bio::Roary::PostAnalysis::BEGIN@16 at line 325
no Moose;
# spent 175µs making 1 call to Bio::Roary::AnnotateGroups::BEGIN@325 # spent 159µs making 1 call to Moose::unimport
32617µs28.15ms__PACKAGE__->meta->make_immutable;
# spent 8.14ms making 1 call to Class::MOP::Class::make_immutable # spent 15µs making 1 call to Bio::Roary::AnnotateGroups::meta
327
328171µs1;
 
# spent 373µs within Bio::Roary::AnnotateGroups::CORE:close which was called: # once (373µs+0s) by Bio::Roary::AnnotateGroups::reannotate at line 285
sub Bio::Roary::AnnotateGroups::CORE:close; # opcode
# spent 57.9ms within Bio::Roary::AnnotateGroups::CORE:match which was called 54653 times, avg 1µs/call: # 18215 times (42.8ms+0s) by Bio::Roary::AnnotateGroups::_builder__groups_to_id_names at line 172, avg 2µs/call # 18215 times (9.84ms+0s) by Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names at line 230, avg 540ns/call # 18215 times (5.22ms+0s) by Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names at line 223, avg 286ns/call # 8 times (10µs+0s) by Bio::Roary::AnnotateGroups::_build__filtered_gff_files at line 92, avg 1µs/call
sub Bio::Roary::AnnotateGroups::CORE:match; # opcode
# spent 404µs within Bio::Roary::AnnotateGroups::CORE:open which was called 2 times, avg 202µs/call: # once (358µs+0s) by Bio::Roary::AnnotateGroups::_build__output_fh at line 84 # once (46µs+0s) by Bio::Roary::AnnotateGroups::_builder__groups_to_id_names at line 167
sub Bio::Roary::AnnotateGroups::CORE:open; # opcode
# spent 9.43ms within Bio::Roary::AnnotateGroups::CORE:print which was called 18215 times, avg 518ns/call: # 18215 times (9.43ms+0s) by Bio::Roary::AnnotateGroups::reannotate at line 283, avg 518ns/call
sub Bio::Roary::AnnotateGroups::CORE:print; # opcode
# spent 12.2ms within Bio::Roary::AnnotateGroups::CORE:readline which was called 18216 times, avg 670ns/call: # 18215 times (12.2ms+0s) by Bio::Roary::AnnotateGroups::_builder__groups_to_id_names at line 172, avg 669ns/call # once (17µs+0s) by Bio::Roary::AnnotateGroups::_builder__groups_to_id_names at line 169
sub Bio::Roary::AnnotateGroups::CORE:readline; # opcode
# spent 6.29ms within Bio::Roary::AnnotateGroups::CORE:regcomp which was called 36430 times, avg 173ns/call: # 18215 times (4.29ms+0s) by Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names at line 230, avg 236ns/call # 18215 times (2.00ms+0s) by Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names at line 223, avg 110ns/call
sub Bio::Roary::AnnotateGroups::CORE:regcomp; # opcode
# spent 572ms (348+224) within Bio::Roary::AnnotateGroups::CORE:sort which was called 51203 times, avg 11µs/call: # 32985 times (21.9ms+0s) by Bio::Roary::AnnotateGroups::_consensus_gene_name_for_group at line 204, avg 663ns/call # 18215 times (9.83ms+0s) by Bio::Roary::AnnotateGroups::consensus_product_for_id_names at line 153, avg 540ns/call # once (151ms+112ms) by Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names at line 227 # once (149ms+113ms) by Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names at line 220 # once (16.0ms+0s) by Bio::Roary::AnnotateGroups::reannotate at line 278
sub Bio::Roary::AnnotateGroups::CORE:sort; # opcode