| 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 | Bio::Roary::AnnotateGroups::_ids_grouped_by_gene_name_for_group |
| 18215 | 1 | 1 | 973ms | 1.38s | Bio::Roary::AnnotateGroups::consensus_product_for_id_names |
| 51203 | 5 | 1 | 348ms | 572ms | Bio::Roary::AnnotateGroups::CORE:sort (opcode) |
| 32985 | 2 | 2 | 319ms | 3.39s | Bio::Roary::AnnotateGroups::_consensus_gene_name_for_group |
| 1 | 1 | 1 | 216ms | 250ms | Bio::Roary::AnnotateGroups::_generate__ids_to_groups |
| 1 | 1 | 1 | 208ms | 263ms | Bio::Roary::AnnotateGroups::_builder__groups_to_id_names |
| 1 | 1 | 1 | 195ms | 3.34s | Bio::Roary::AnnotateGroups::reannotate |
| 1 | 1 | 1 | 192ms | 2.78s | Bio::Roary::AnnotateGroups::_generate_groups_to_consensus_gene_names |
| 1 | 1 | 1 | 163ms | 1.83s | Bio::Roary::AnnotateGroups::_build__ids_to_gene_names |
| 8 | 5 | 2 | 77.7ms | 77.8ms | Bio::Roary::AnnotateGroups::_groups |
| 54653 | 4 | 1 | 57.9ms | 57.9ms | Bio::Roary::AnnotateGroups::CORE:match (opcode) |
| 18216 | 2 | 1 | 12.2ms | 12.2ms | Bio::Roary::AnnotateGroups::CORE:readline (opcode) |
| 18215 | 1 | 1 | 9.43ms | 9.43ms | Bio::Roary::AnnotateGroups::CORE:print (opcode) |
| 36430 | 2 | 1 | 6.29ms | 6.29ms | Bio::Roary::AnnotateGroups::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 3.99ms | 4.74ms | Bio::Roary::AnnotateGroups::BEGIN@22 |
| 1 | 1 | 1 | 962µs | 1.25ms | Bio::Roary::AnnotateGroups::BEGIN@25 |
| 1 | 1 | 1 | 516µs | 122ms | Bio::Roary::AnnotateGroups::BEGIN@21 |
| 2 | 2 | 1 | 404µs | 404µs | Bio::Roary::AnnotateGroups::CORE:open (opcode) |
| 1 | 1 | 1 | 374µs | 466µs | Bio::Roary::AnnotateGroups::BEGIN@23 |
| 1 | 1 | 1 | 373µs | 373µs | Bio::Roary::AnnotateGroups::CORE:close (opcode) |
| 1 | 1 | 1 | 84µs | 3.03s | Bio::Roary::AnnotateGroups::_split_groups |
| 1 | 1 | 1 | 50µs | 5.78ms | Bio::Roary::AnnotateGroups::BEGIN@19 |
| 1 | 1 | 1 | 37µs | 55µs | Bio::Roary::AnnotateGroups::_build__filtered_gff_files |
| 1 | 1 | 1 | 27µs | 1.83s | Bio::Roary::AnnotateGroups::BUILD |
| 1 | 1 | 1 | 19µs | 386µs | Bio::Roary::AnnotateGroups::_build__output_fh |
| 1 | 1 | 1 | 16µs | 175µs | Bio::Roary::AnnotateGroups::BEGIN@325 |
| 1 | 1 | 1 | 12µs | 12µs | Bio::Roary::AnnotateGroups::__ANON__[lib/Bio/Roary/AnnotateGroups.pm:31] |
| 1 | 1 | 1 | 9µs | 9µs | Bio::Roary::AnnotateGroups::BEGIN@20 |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::AnnotateGroups::__ANON__[lib/Bio/Roary/AnnotateGroups.pm:116] |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::AnnotateGroups::_build__groups_to_consensus_gene_names |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::AnnotateGroups::_build__ids_to_verbose_stats |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::AnnotateGroups::_build__number_of_files |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::AnnotateGroups::_builder__group_counter |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::AnnotateGroups::_builder__ids_to_groups |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::AnnotateGroups::_remove_ids_from_group |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::AnnotateGroups::full_annotation |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::AnnotateGroups::inference |
| 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 | 2 | 37µs | my ($self) = @_; | ||
| 47 | 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 | 162511 | 161ms | my ($self) = @_; | ||
| 67 | my %ids_to_groups; | ||||
| 68 | |||||
| 69 | 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 | 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 | $ids_to_groups{$id_name} = $group; | ||||
| 72 | } | ||||
| 73 | } | ||||
| 74 | 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 | 3 | 379µs | my ($self) = @_; | ||
| 84 | 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 | 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 | 3 | 43µs | my ($self) = @_; | ||
| 92 | 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 | 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 | 46 | 139ms | my ($self) = @_; | ||
| 98 | my %ids_to_gene_names; | ||||
| 99 | my %ids_to_product; | ||||
| 100 | 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 | 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 | 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 | @ids_to_gene_names{ keys %id_to_gene_lookup } = values %id_to_gene_lookup; | ||||
| 104 | |||||
| 105 | 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 | 1 | 24.6ms | 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 | 19µ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 | |||||
| 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 | 379659 | 662ms | my ( $self, $id_names ) = @_; | ||
| 147 | my %product_freq; | ||||
| 148 | for my $id_name ( @{$id_names} ) { | ||||
| 149 | 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 | 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 | 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 | 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 | 127510 | 246ms | my ($self) = @_; | ||
| 165 | my %groups_to_id_names; | ||||
| 166 | |||||
| 167 | 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 | 17µs | while (<$fh>) { # spent 17µs making 1 call to Bio::Roary::AnnotateGroups::CORE:readline | ||
| 170 | chomp; | ||||
| 171 | my $line = $_; | ||||
| 172 | 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 | 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 | ||||
| 184 | 24 | 77.8ms | my ($self) = @_; | ||
| 185 | 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 | 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 | 393199 | 1.25s | my ( $self, $group_name ) = @_; | ||
| 191 | my %gene_name_freq; | ||||
| 192 | 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 | 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 | 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 | 141148 | 324ms | my ( $self, $group_name ) = @_; | ||
| 202 | 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 | 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 | 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 | ||||
| 214 | 88965 | 357ms | my ($self) = @_; | ||
| 215 | my %groups_to_gene_names; | ||||
| 216 | my %gene_name_freq; | ||||
| 217 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | |||||
| 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 | 3 | 62µs | my ($self) = @_; | ||
| 257 | |||||
| 258 | 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 | 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 | 36436 | 165ms | my ($self) = @_; | ||
| 274 | |||||
| 275 | 1 | 3.03s | $self->_split_groups; # spent 3.03s making 1 call to Bio::Roary::AnnotateGroups::_split_groups | ||
| 276 | |||||
| 277 | 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 | 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 | 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 | 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 | 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 | 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 |