Filename | /Users/ap13/pathogens/Roary/lib/Bio/Roary/AnnotateGroups.pm |
Statements | Executed 1329540 statements in 3.41s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
32985 | 1 | 1 | 1.95s | 3.05s | _ids_grouped_by_gene_name_for_group | Bio::Roary::AnnotateGroups::
18215 | 1 | 1 | 973ms | 1.38s | consensus_product_for_id_names | Bio::Roary::AnnotateGroups::
51203 | 5 | 1 | 348ms | 572ms | CORE:sort (opcode) | Bio::Roary::AnnotateGroups::
32985 | 2 | 2 | 319ms | 3.39s | _consensus_gene_name_for_group | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 216ms | 250ms | _generate__ids_to_groups | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 208ms | 263ms | _builder__groups_to_id_names | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 195ms | 3.34s | reannotate | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 192ms | 2.78s | _generate_groups_to_consensus_gene_names | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 163ms | 1.83s | _build__ids_to_gene_names | Bio::Roary::AnnotateGroups::
8 | 5 | 2 | 77.7ms | 77.8ms | _groups | Bio::Roary::AnnotateGroups::
54653 | 4 | 1 | 57.9ms | 57.9ms | CORE:match (opcode) | Bio::Roary::AnnotateGroups::
18216 | 2 | 1 | 12.2ms | 12.2ms | CORE:readline (opcode) | Bio::Roary::AnnotateGroups::
18215 | 1 | 1 | 9.43ms | 9.43ms | CORE:print (opcode) | Bio::Roary::AnnotateGroups::
36430 | 2 | 1 | 6.29ms | 6.29ms | CORE:regcomp (opcode) | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 3.99ms | 4.74ms | BEGIN@22 | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 962µs | 1.25ms | BEGIN@25 | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 516µs | 122ms | BEGIN@21 | Bio::Roary::AnnotateGroups::
2 | 2 | 1 | 404µs | 404µs | CORE:open (opcode) | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 374µs | 466µs | BEGIN@23 | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 373µs | 373µs | CORE:close (opcode) | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 84µs | 3.03s | _split_groups | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 50µs | 5.78ms | BEGIN@19 | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 37µs | 55µs | _build__filtered_gff_files | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 27µs | 1.83s | BUILD | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 19µs | 386µs | _build__output_fh | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 16µs | 175µs | BEGIN@325 | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 12µs | 12µs | __ANON__[lib/Bio/Roary/AnnotateGroups.pm:31] | Bio::Roary::AnnotateGroups::
1 | 1 | 1 | 9µs | 9µs | BEGIN@20 | Bio::Roary::AnnotateGroups::
0 | 0 | 0 | 0s | 0s | __ANON__[lib/Bio/Roary/AnnotateGroups.pm:116] | Bio::Roary::AnnotateGroups::
0 | 0 | 0 | 0s | 0s | _build__groups_to_consensus_gene_names | Bio::Roary::AnnotateGroups::
0 | 0 | 0 | 0s | 0s | _build__ids_to_verbose_stats | Bio::Roary::AnnotateGroups::
0 | 0 | 0 | 0s | 0s | _build__number_of_files | Bio::Roary::AnnotateGroups::
0 | 0 | 0 | 0s | 0s | _builder__group_counter | Bio::Roary::AnnotateGroups::
0 | 0 | 0 | 0s | 0s | _builder__ids_to_groups | Bio::Roary::AnnotateGroups::
0 | 0 | 0 | 0s | 0s | _remove_ids_from_group | Bio::Roary::AnnotateGroups::
0 | 0 | 0 | 0s | 0s | full_annotation | Bio::Roary::AnnotateGroups::
0 | 0 | 0 | 0s | 0s | inference | Bio::Roary::AnnotateGroups::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package 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 | |||||
7 | Take 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 | |||||
19 | 2 | 67µs | 2 | 11.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 # spent 5.78ms making 1 call to Bio::Roary::AnnotateGroups::BEGIN@19
# spent 5.73ms making 1 call to Moose::import |
20 | 2 | 30µs | 1 | 9µ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 # spent 9µs making 1 call to Bio::Roary::AnnotateGroups::BEGIN@20 |
21 | 2 | 170µs | 1 | 122ms | # 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 # spent 122ms making 1 call to Bio::Roary::AnnotateGroups::BEGIN@21 |
22 | 2 | 157µs | 2 | 4.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 # spent 4.74ms making 1 call to Bio::Roary::AnnotateGroups::BEGIN@22
# spent 36µs making 1 call to Exporter::import |
23 | 2 | 143µs | 2 | 515µ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 # spent 466µs making 1 call to Bio::Roary::AnnotateGroups::BEGIN@23
# spent 49µs making 1 call to Exporter::import |
24 | |||||
25 | 2 | 1.81ms | 2 | 1.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 # spent 1.25ms making 1 call to Bio::Roary::AnnotateGroups::BEGIN@25
# spent 34µs making 1 call to Exporter::import |
26 | |||||
27 | 1 | 4µs | 1 | 2.51ms | has 'gff_files' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); # spent 2.51ms making 1 call to Moose::has |
28 | 1 | 2µs | 1 | 1.97ms | has 'output_filename' => ( is => 'ro', isa => 'Str', default => 'reannotated_groups_file' ); # spent 1.97ms making 1 call to Moose::has |
29 | 1 | 3µs | 1 | 1.60ms | has 'groups_filename' => ( is => 'ro', isa => 'Str', required => 1 ); # spent 1.60ms making 1 call to Moose::has |
30 | 1 | 2µs | 1 | 1.77ms | has '_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 |
31 | 2 | 17µs | 1 | 1.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] # spent 1.72ms making 1 call to Moose::has |
32 | 1 | 2µs | 1 | 1.78ms | has '_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 |
33 | 1 | 2µs | 1 | 2.05ms | has '_output_fh' => ( is => 'ro', lazy => 1, builder => '_build__output_fh' ); # spent 2.05ms making 1 call to Moose::has |
34 | 1 | 11µs | 1 | 2.47ms | has '_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' ); | ||||
36 | 1 | 3µs | 1 | 2.38ms | has '_filtered_gff_files' => ( is => 'ro', isa => 'ArrayRef', lazy => 1, builder => '_build__filtered_gff_files' ); # spent 2.38ms making 1 call to Moose::has |
37 | 1 | 3µs | 1 | 2.23ms | has '_number_of_files' => ( is => 'ro', isa => 'Int', lazy => 1, builder => '_build__number_of_files' ); # spent 2.23ms making 1 call to Moose::has |
38 | 1 | 2µs | 1 | 2.75ms | has '_ids_to_groups' => ( is => 'rw', isa => 'HashRef', lazy => 1, builder => '_builder__ids_to_groups' ); # spent 2.75ms making 1 call to Moose::has |
39 | |||||
40 | 1 | 3µs | 1 | 3.27ms | has '_group_counter' => ( is => 'rw', isa => 'Int', lazy => 1, builder => '_builder__group_counter' ); # spent 3.27ms making 1 call to Moose::has |
41 | 1 | 2µs | 1 | 2.05ms | has '_group_default_prefix' => ( is => 'rw', isa => 'Str', default => 'group_' ); # spent 2.05ms making 1 call to Moose::has |
42 | |||||
43 | 1 | 2µs | 1 | 4.28ms | has '_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] | ||||
46 | 1 | 900ns | my ($self) = @_; | ||
47 | 1 | 36µs | 1 | 1.83s | $self->_ids_to_gene_names; # spent 1.83s making 1 call to Bio::Roary::AnnotateGroups::_ids_to_gene_names |
48 | } | ||||
49 | |||||
50 | sub _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 | ||||
66 | 1 | 2µs | my ($self) = @_; | ||
67 | 1 | 400ns | my %ids_to_groups; | ||
68 | |||||
69 | 1 | 6.73ms | 1 | 6µs | for my $group ( keys %{ $self->_groups_to_id_names } ) { # spent 6µs making 1 call to Bio::Roary::AnnotateGroups::_groups_to_id_names |
70 | 18215 | 44.9ms | 18215 | 33.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 |
71 | 144292 | 110ms | $ids_to_groups{$id_name} = $group; | ||
72 | } | ||||
73 | } | ||||
74 | 1 | 18µs | return \%ids_to_groups; | ||
75 | } | ||||
76 | |||||
77 | sub _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] | ||||
83 | 1 | 1µs | my ($self) = @_; | ||
84 | 1 | 374µs | 2 | 367µ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 | 1 | 4µs | 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] | ||||
91 | 1 | 600ns | my ($self) = @_; | ||
92 | 1 | 37µs | 9 | 18µ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 | 1 | 5µs | 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] | ||||
97 | 1 | 900ns | my ($self) = @_; | ||
98 | 1 | 300ns | my %ids_to_gene_names; | ||
99 | 1 | 200ns | my %ids_to_product; | ||
100 | 1 | 15µs | 1 | 94µs | for my $filename ( @{ $self->_filtered_gff_files } ) { # spent 94µs making 1 call to Bio::Roary::AnnotateGroups::_filtered_gff_files |
101 | 8 | 232µs | 8 | 740µ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 |
102 | 8 | 26.1ms | 8 | 1.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 | 8 | 23.9ms | @ids_to_gene_names{ keys %id_to_gene_lookup } = values %id_to_gene_lookup; | ||
104 | |||||
105 | 8 | 32.7ms | 8 | 93µ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 |
106 | 8 | 80.3ms | 8 | 298µ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 | } | ||||
108 | 1 | 16µs | 1 | 19µs | $self->_ids_to_product( \%ids_to_product ); # spent 19µs making 1 call to Bio::Roary::AnnotateGroups::_ids_to_product |
109 | |||||
110 | 1 | 13µs | return \%ids_to_gene_names; | ||
111 | } | ||||
112 | |||||
113 | sub _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 | ||||
146 | 18215 | 8.70ms | my ( $self, $id_names ) = @_; | ||
147 | 18215 | 1.75ms | my %product_freq; | ||
148 | 18215 | 11.1ms | for my $id_name ( @{$id_names} ) { | ||
149 | 144292 | 240ms | 144292 | 206ms | 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 |
150 | 144292 | 271ms | 144292 | 195ms | $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 | |||||
153 | 18215 | 67.4ms | 18215 | 9.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 | 18215 | 61.2ms | 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] | ||||
164 | 1 | 600ns | my ($self) = @_; | ||
165 | 1 | 500ns | my %groups_to_id_names; | ||
166 | |||||
167 | 1 | 69µs | 2 | 53µ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 ); | ||||
169 | 1 | 28µs | 1 | 17µs | while (<$fh>) { # spent 17µs making 1 call to Bio::Roary::AnnotateGroups::CORE:readline |
170 | 18215 | 2.43ms | chomp; | ||
171 | 18215 | 2.90ms | my $line = $_; | ||
172 | 18215 | 119ms | 36430 | 55.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 | 18215 | 8.94ms | my $group_name = $1; | ||
174 | 18215 | 4.47ms | my $genes = $2; | ||
175 | 18215 | 87.5ms | my @elements = split( /[\s\t]+/, $genes ); | ||
176 | 18215 | 21.2ms | $groups_to_id_names{$group_name} = \@elements; | ||
177 | } | ||||
178 | } | ||||
179 | |||||
180 | 1 | 27µs | 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 | ||||
184 | 8 | 7µs | my ($self) = @_; | ||
185 | 8 | 77.6ms | 8 | 45µ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 | 8 | 203µs | 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 | ||||
190 | 32985 | 18.3ms | my ( $self, $group_name ) = @_; | ||
191 | 32985 | 2.01ms | my %gene_name_freq; | ||
192 | 32985 | 63.9ms | 32985 | 59.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 |
193 | 261259 | 1.08s | 640517 | 1.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 | 32985 | 80.8ms | 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 | ||||
201 | 32985 | 19.1ms | my ( $self, $group_name ) = @_; | ||
202 | 32985 | 41.8ms | 32985 | 3.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 | |||||
204 | 32985 | 126ms | 32985 | 21.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 |
205 | 32985 | 108ms | if ( @sorted_gene_names > 0 ) { | ||
206 | return shift(@sorted_gene_names); | ||||
207 | } | ||||
208 | else { | ||||
209 | 9208 | 29.5ms | 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 | ||||
214 | 1 | 3µs | my ($self) = @_; | ||
215 | 1 | 200ns | my %groups_to_gene_names; | ||
216 | 1 | 100ns | my %gene_name_freq; | ||
217 | 1 | 11µs | 1 | 14µs | my $group_prefix = $self->_group_default_prefix; # spent 14µs making 1 call to Bio::Roary::AnnotateGroups::_group_default_prefix |
218 | |||||
219 | #Ā These are already annotated | ||||
220 | 1 | 96.7ms | 73444 | 638ms | 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 | { | ||||
223 | 18215 | 46.3ms | 36430 | 7.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 | |||||
227 | 1 | 94.7ms | 73444 | 374ms | 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 | { | ||||
230 | 18215 | 61.7ms | 36430 | 14.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 |
231 | 18215 | 24.4ms | 18215 | 1.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 | |||||
233 | 18215 | 23.6ms | if ( defined( $gene_name_freq{$consensus_gene_name} ) ) { | ||
234 | $groups_to_gene_names{$group_name} = $group_name; | ||||
235 | } | ||||
236 | else { | ||||
237 | 8049 | 4.81ms | $groups_to_gene_names{$group_name} = $consensus_gene_name; | ||
238 | 8049 | 2.96ms | $gene_name_freq{$consensus_gene_name}++; | ||
239 | } | ||||
240 | } | ||||
241 | 1 | 1.50ms | return \%groups_to_gene_names; | ||
242 | } | ||||
243 | |||||
244 | sub _build__groups_to_consensus_gene_names { | ||||
245 | my ($self) = @_; | ||||
246 | return $self->_generate_groups_to_consensus_gene_names; | ||||
247 | } | ||||
248 | |||||
249 | sub _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 | ||||
256 | 1 | 9µs | my ($self) = @_; | ||
257 | |||||
258 | 1 | 23µs | 2 | 2.78s | $self->_groups_to_consensus_gene_names( $self->_generate_groups_to_consensus_gene_names ); # spent 2.78s making 1 call to Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names
# spent 32µs making 1 call to Bio::Roary::AnnotateGroups::_groups_to_consensus_gene_names |
259 | 1 | 29µs | 2 | 250ms | $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 | |||||
262 | sub _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 | ||||
273 | 1 | 1µs | my ($self) = @_; | ||
274 | |||||
275 | 1 | 7µs | 1 | 3.03s | $self->_split_groups; # spent 3.03s making 1 call to Bio::Roary::AnnotateGroups::_split_groups |
276 | |||||
277 | 1 | 12.3ms | 1 | 3µs | my %groups_to_id_names = %{ $self->_groups_to_id_names }; # spent 3µs making 1 call to Bio::Roary::AnnotateGroups::_groups_to_id_names |
278 | 1 | 20.0ms | 1 | 16.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 | { | ||||
281 | 18215 | 25.3ms | 18215 | 30.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 . ": " | ||||
283 | 18215 | 105ms | 54645 | 65.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 | } | ||||
285 | 1 | 399µs | 2 | 387µ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 | 1 | 2.17ms | return $self; | ||
287 | } | ||||
288 | |||||
289 | sub 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 | |||||
311 | sub 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 | |||||
325 | 2 | 76µs | 2 | 334µ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 # spent 175µs making 1 call to Bio::Roary::AnnotateGroups::BEGIN@325
# spent 159µs making 1 call to Moose::unimport |
326 | 1 | 7µs | 2 | 8.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 | |||||
328 | 1 | 71µs | 1; | ||
# spent 373µs within Bio::Roary::AnnotateGroups::CORE:close which was called:
# once (373µs+0s) by Bio::Roary::AnnotateGroups::reannotate at line 285 | |||||
# 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: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 | |||||
# 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 | |||||
# 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 | |||||
# 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 |