Profile of lib/Bio/Roary/OrderGenes.pm

← 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:46:14 2015

Filename | /Users/ap13/pathogens/Roary/lib/Bio/Roary/OrderGenes.pm
Statements | Executed 467208 statements in 613ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 401ms | 2.45s | Bio::Roary::OrderGenes::::_build__groups_to_file_contigsBio::Roary::OrderGenes::_build__groups_to_file_contigs
2 | 2 | 1 | 170ms | 4.11s | Bio::Roary::OrderGenes::::_reorder_connected_componentsBio::Roary::OrderGenes::_reorder_connected_components
1 | 1 | 1 | 102ms | 3.95s | Bio::Roary::OrderGenes::::_add_groups_to_graphBio::Roary::OrderGenes::_add_groups_to_graph
1 | 1 | 1 | 85.8ms | 193ms | Bio::Roary::OrderGenes::::_create_accessory_graphBio::Roary::OrderGenes::_create_accessory_graph
1 | 1 | 1 | 85.1ms | 2.53s | Bio::Roary::OrderGenes::::_build_group_orderBio::Roary::OrderGenes::_build_group_order
1 | 1 | 1 | 57.5ms | 102ms | Bio::Roary::OrderGenes::::BEGIN@22Bio::Roary::OrderGenes::BEGIN@22
1 | 1 | 1 | 31.3ms | 9.70s | Bio::Roary::OrderGenes::::_build_groups_to_contigsBio::Roary::OrderGenes::_build_groups_to_contigs
1 | 1 | 1 | 13.7ms | 23.6ms | Bio::Roary::OrderGenes::::_remove_weak_edges_from_graphBio::Roary::OrderGenes::_remove_weak_edges_from_graph
1 | 1 | 1 | 845µs | 28.4ms | Bio::Roary::OrderGenes::::BEGIN@21Bio::Roary::OrderGenes::BEGIN@21
1 | 1 | 1 | 64µs | 4.69ms | Bio::Roary::OrderGenes::::BEGIN@18Bio::Roary::OrderGenes::BEGIN@18
1 | 1 | 1 | 27µs | 410µs | Bio::Roary::OrderGenes::::_build_group_graphsBio::Roary::OrderGenes::_build_group_graphs
1 | 1 | 1 | 14µs | 140µs | Bio::Roary::OrderGenes::::BEGIN@352Bio::Roary::OrderGenes::BEGIN@352
1 | 1 | 1 | 12µs | 26µs | Bio::Roary::OrderGenes::::_build_number_of_filesBio::Roary::OrderGenes::_build_number_of_files
1 | 1 | 1 | 9µs | 9µs | Bio::Roary::OrderGenes::::__ANON__[lib/Bio/Roary/OrderGenes.pm:33]Bio::Roary::OrderGenes::__ANON__[lib/Bio/Roary/OrderGenes.pm:33]
1 | 1 | 1 | 9µs | 9µs | Bio::Roary::OrderGenes::::BEGIN@19Bio::Roary::OrderGenes::BEGIN@19
1 | 1 | 1 | 6µs | 6µs | Bio::Roary::OrderGenes::::BEGIN@20Bio::Roary::OrderGenes::BEGIN@20
0 | 0 | 0 | 0s | 0s | Bio::Roary::OrderGenes::::_build_groupsBio::Roary::OrderGenes::_build_groups

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Bio::Roary::OrderGenes;
2 |  |  |  |  |
3 |  |  |  |  | # ABSTRACT: Take in GFF files and create a matrix of what genes are beside what other genes
4 |  |  |  |  |
5 |  |  |  |  | =head1 SYNOPSIS
6 |  |  |  |  |
7 |  |  |  |  | Take in the analyse groups and create a matrix of what genes are beside what other genes
8 |  |  |  |  | use Bio::Roary::OrderGenes;
9 |  |  |  |  |
10 |  |  |  |  | my $obj = Bio::Roary::OrderGenes->new(
11 |  |  |  |  | analyse_groups_obj => $analyse_groups_obj,
12 |  |  |  |  | gff_files => ['file1.gff','file2.gff']
13 |  |  |  |  | );
14 |  |  |  |  | $obj->groups_to_contigs;
15 |  |  |  |  |
16 |  |  |  |  | =cut
17 |  |  |  |  |
18 | 2 | 50µs | 2 | 9.31ms | # spent 4.69ms (64µs+4.62) within Bio::Roary::OrderGenes::BEGIN@18 which was called: # once (64µs+4.62ms) by Bio::Roary::PostAnalysis::BEGIN@20 at line 18 use Moose; # spent 4.69ms making 1 call to Bio::Roary::OrderGenes::BEGIN@18 # spent 4.62ms making 1 call to Moose::import
19 | 2 | 25µs | 1 | 9µs | # spent 9µs within Bio::Roary::OrderGenes::BEGIN@19 which was called: # once (9µs+0s) by Bio::Roary::PostAnalysis::BEGIN@20 at line 19 use Bio::Roary::Exceptions; # spent 9µs making 1 call to Bio::Roary::OrderGenes::BEGIN@19
20 | 2 | 22µs | 1 | 6µs | # spent 6µs within Bio::Roary::OrderGenes::BEGIN@20 which was called: # once (6µs+0s) by Bio::Roary::PostAnalysis::BEGIN@20 at line 20 use Bio::Roary::AnalyseGroups; # spent 6µs making 1 call to Bio::Roary::OrderGenes::BEGIN@20
21 | 2 | 160µs | 1 | 28.4ms | # spent 28.4ms (845µs+27.5) within Bio::Roary::OrderGenes::BEGIN@21 which was called: # once (845µs+27.5ms) by Bio::Roary::PostAnalysis::BEGIN@20 at line 21 use Bio::Roary::ContigsToGeneIDsFromGFF; # spent 28.4ms making 1 call to Bio::Roary::OrderGenes::BEGIN@21
22 | 2 | 1.94ms | 1 | 102ms | # spent 102ms (57.5+44.7) within Bio::Roary::OrderGenes::BEGIN@22 which was called: # once (57.5ms+44.7ms) by Bio::Roary::PostAnalysis::BEGIN@20 at line 22 use Graph; # spent 102ms making 1 call to Bio::Roary::OrderGenes::BEGIN@22
23 |  |  |  |  |
24 | 1 | 3µs | 1 | 2.73ms | has 'gff_files' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); # spent 2.73ms making 1 call to Moose::has
25 | 1 | 3µs | 1 | 2.63ms | has 'analyse_groups_obj' => ( is => 'ro', isa => 'Bio::Roary::AnalyseGroups', required => 1 ); # spent 2.63ms making 1 call to Moose::has
26 | 1 | 4µs | 1 | 2.34ms | has 'group_order' => ( is => 'ro', isa => 'HashRef', lazy => 1, builder => '_build_group_order'); # spent 2.34ms making 1 call to Moose::has
27 | 1 | 3µs | 1 | 2.65ms | has 'group_graphs' => ( is => 'ro', isa => 'Graph', lazy => 1, builder => '_build_group_graphs'); # spent 2.65ms making 1 call to Moose::has
28 | 1 | 3µs | 1 | 2.05ms | has 'groups_to_contigs' => ( is => 'ro', isa => 'HashRef', lazy => 1, builder => '_build_groups_to_contigs'); # spent 2.05ms making 1 call to Moose::has
29 | 1 | 4µs | 1 | 2.14ms | has '_groups_to_file_contigs' => ( is => 'ro', isa => 'ArrayRef', lazy => 1, builder => '_build__groups_to_file_contigs'); # spent 2.14ms making 1 call to Moose::has
30 |  |  |  |  |
31 | 1 | 3µs | 1 | 1.96ms | has '_groups' => ( is => 'ro', isa => 'HashRef', lazy => 1, builder => '_build_groups'); # spent 1.96ms making 1 call to Moose::has
32 | 1 | 3µs | 1 | 2.76ms | has 'number_of_files' => ( is => 'ro', isa => 'Int', lazy => 1, builder => '_build_number_of_files'); # spent 2.76ms making 1 call to Moose::has
33 | 2 | 17µs | 1 | 1.76ms | # spent 9µs within Bio::Roary::OrderGenes::__ANON__[lib/Bio/Roary/OrderGenes.pm:33] which was called: # once (9µs+0s) by Bio::Roary::OrderGenes::new at line 52 of (eval 25)[Eval/Closure.pm:125] has '_groups_qc' => ( is => 'ro', isa => 'HashRef', default => sub {{}}); # spent 1.76ms making 1 call to Moose::has
34 |  |  |  |  |
35 | 1 | 2µs | 1 | 1.54ms | has '_percentage_of_largest_weak_threshold' => ( is => 'ro', isa => 'Num', default => 0.9); # spent 1.54ms making 1 call to Moose::has
36 |  |  |  |  |
37 |  |  |  |  | sub _build_number_of_files
38 |  |  |  |  | # spent 26µs (12+13) within Bio::Roary::OrderGenes::_build_number_of_files which was called: # once (12µs+13µs) by Bio::Roary::OrderGenes::number_of_files at line 12 of (eval 25)[Eval/Closure.pm:125] {
39 | 1 | 1µs |  |  | my ($self) = @_;
40 | 1 | 17µs | 1 | 13µs | return @{$self->gff_files}; # spent 13µs making 1 call to Bio::Roary::OrderGenes::gff_files
41 |  |  |  |  | }
42 |  |  |  |  |
43 |  |  |  |  | sub _build_groups
44 |  |  |  |  | {
45 |  |  |  |  | my ($self) = @_;
46 |  |  |  |  | my %groups;
47 |  |  |  |  | for my $group_name (@{$self->analyse_groups_obj->_groups})
48 |  |  |  |  | {
49 |  |  |  |  | $groups{$group_name}++;
50 |  |  |  |  | }
51 |  |  |  |  | return \%groups;
52 |  |  |  |  | }
53 |  |  |  |  |
54 |  |  |  |  |
55 |  |  |  |  | sub _build__groups_to_file_contigs
56 |  |  |  |  | # spent 2.45s (401ms+2.05) within Bio::Roary::OrderGenes::_build__groups_to_file_contigs which was called: # once (401ms+2.05s) by Bio::Roary::OrderGenes::_groups_to_file_contigs at line 12 of (eval 25)[Eval/Closure.pm:125] {
57 | 1 | 3µs |  |  | my ($self) = @_;
58 | 1 | 400ns |  |  | my @groups_to_contigs;
59 | 1 | 200ns |  |  | my @overlapping_hypothetical_gene_ids;
60 |  |  |  |  |
61 |  |  |  |  | # Open each GFF file
62 | 1 | 16µs | 1 | 10µs | for my $filename (@{$self->gff_files}) # spent 10µs making 1 call to Bio::Roary::OrderGenes::gff_files
63 |  |  |  |  | {
64 | 8 | 238µs | 8 | 894µs | my $contigs_to_ids_obj = Bio::Roary::ContigsToGeneIDsFromGFF->new(gff_file => $filename); # spent 894µs making 8 calls to Bio::Roary::ContigsToGeneIDsFromGFF::new, avg 112µs/call
65 |  |  |  |  |
66 |  |  |  |  | # Loop over each contig in the GFF file
67 | 8 | 57.7ms | 16 | 1.40s | for my $contig_name (keys %{$contigs_to_ids_obj->contig_to_ids}) # spent 1.40s making 8 calls to Bio::Roary::ContigsToGeneIDsFromGFF::contig_to_ids, avg 175ms/call # spent 180µs making 8 calls to Bio::Roary::ContigsToGeneIDsFromGFF::DESTROY, avg 23µs/call
68 |  |  |  |  | {
69 | 444 | 72µs |  |  | my @groups_on_contig;
70 |  |  |  |  | #Â loop over each gene in each contig in the GFF file
71 | 444 | 1.95ms | 444 | 1.15ms | for my $gene_id (@{$contigs_to_ids_obj->contig_to_ids->{$contig_name}}) # spent 1.15ms making 444 calls to Bio::Roary::ContigsToGeneIDsFromGFF::contig_to_ids, avg 3µs/call
72 |  |  |  |  | {
73 |  |  |  |  | #Â convert to group name
74 | 40008 | 115ms | 80016 | 108ms | my $group_name = $self->analyse_groups_obj->_genes_to_groups->{$gene_id}; # spent 54.5ms making 40008 calls to Bio::Roary::OrderGenes::analyse_groups_obj, avg 1µs/call # spent 53.8ms making 40008 calls to Bio::Roary::AnalyseGroups::_genes_to_groups, avg 1µs/call
75 | 40008 | 4.79ms |  |  | next unless(defined($group_name));
76 |  |  |  |  |
77 | 37678 | 43.7ms | 37725 | 536ms | if($contigs_to_ids_obj->overlapping_hypothetical_protein_ids->{$gene_id}) # spent 536ms making 37678 calls to Bio::Roary::ContigsToGeneIDsFromGFF::overlapping_hypothetical_protein_ids, avg 14µs/call # spent 266µs making 47 calls to Bio::Roary::OrderGenes::_groups_qc, avg 6µs/call
78 |  |  |  |  | {
79 |  |  |  |  | $self->_groups_qc->{$group_name} = 'Hypothetical protein with no hits to refseq/uniprot/clusters/cdd/tigrfams/pfam overlapping another protein with hits';
80 |  |  |  |  | }
81 | 37678 | 38.9ms |  |  | push(@groups_on_contig, $group_name);
82 |  |  |  |  | }
83 | 444 | 561µs |  |  | push(@groups_to_contigs,\@groups_on_contig);
84 |  |  |  |  | }
85 |  |  |  |  | }
86 |  |  |  |  |
87 | 1 | 30µs |  |  | return \@groups_to_contigs;
88 |  |  |  |  |
89 |  |  |  |  | }
90 |  |  |  |  |
91 |  |  |  |  | sub _build_group_order
92 |  |  |  |  | # spent 2.53s (85.1ms+2.45) within Bio::Roary::OrderGenes::_build_group_order which was called: # once (85.1ms+2.45s) by Bio::Roary::OrderGenes::group_order at line 12 of (eval 25)[Eval/Closure.pm:125] {
93 | 1 | 3µs |  |  | my ($self) = @_;
94 | 1 | 2µs |  |  | my %group_order;
95 |  |  |  |  |
96 | 1 | 14µs | 1 | 2.45s | for my $groups_on_contig (@{$self->_groups_to_file_contigs}) # spent 2.45s making 1 call to Bio::Roary::OrderGenes::_groups_to_file_contigs
97 |  |  |  |  | {
98 | 444 | 8.29ms |  |  | for(my $i = 1; $i < @{$groups_on_contig}; $i++)
99 |  |  |  |  | {
100 | 37243 | 6.01ms |  |  | my $group_from = $groups_on_contig->[$i -1];
101 | 37243 | 7.63ms |  |  | my $group_to = $groups_on_contig->[$i];
102 | 37243 | 18.1ms |  |  | $group_order{$group_from}{$group_to}++;
103 |  |  |  |  | # TODO: remove because you only need half the matix
104 | 37243 | 24.2ms |  |  | $group_order{$group_to}{$group_from}++;
105 |  |  |  |  | }
106 | 444 | 683µs |  |  | if(@{$groups_on_contig} == 1)
107 |  |  |  |  | {
108 | 14 | 9µs |  |  | my $group_from = $groups_on_contig->[0];
109 | 14 | 5µs |  |  | my $group_to = $groups_on_contig->[0];
110 | 14 | 22µs |  |  | $group_order{$group_from}{$group_to}++;
111 |  |  |  |  | }
112 |  |  |  |  | }
113 |  |  |  |  |
114 | 1 | 35µs |  |  | return \%group_order;
115 |  |  |  |  | }
116 |  |  |  |  |
117 |  |  |  |  | sub _build_group_graphs
118 |  |  |  |  | # spent 410µs (27+383) within Bio::Roary::OrderGenes::_build_group_graphs which was called: # once (27µs+383µs) by Bio::Roary::OrderGenes::group_graphs at line 12 of (eval 25)[Eval/Closure.pm:125] {
119 | 1 | 3µs |  |  | my($self) = @_;
120 | 1 | 30µs | 1 | 383µs | return Graph->new(undirected => 1); # spent 383µs making 1 call to Graph::new
121 |  |  |  |  | }
122 |  |  |  |  |
123 |  |  |  |  |
124 |  |  |  |  | sub _add_groups_to_graph
125 |  |  |  |  | # spent 3.95s (102ms+3.85) within Bio::Roary::OrderGenes::_add_groups_to_graph which was called: # once (102ms+3.85s) by Bio::Roary::OrderGenes::_build_groups_to_contigs at line 204 {
126 | 1 | 3µs |  |  | my($self) = @_;
127 |  |  |  |  |
128 | 1 | 927µs | 1 | 2.53s | for my $current_group (keys %{$self->group_order()}) # spent 2.53s making 1 call to Bio::Roary::OrderGenes::group_order
129 |  |  |  |  | {
130 | 4871 | 20.7ms | 4871 | 9.74ms | for my $group_to (keys %{$self->group_order->{$current_group}}) # spent 9.74ms making 4871 calls to Bio::Roary::OrderGenes::group_order, avg 2µs/call
131 |  |  |  |  | {
132 | 9767 | 17.9ms | 9767 | 17.8ms | my $weight = 1.0/($self->group_order->{$current_group}->{$group_to} ); # spent 17.8ms making 9767 calls to Bio::Roary::OrderGenes::group_order, avg 2µs/call
133 | 9767 | 27.4ms | 19534 | 1.29s | $self->group_graphs->add_weighted_edge($current_group,$group_to, $weight); # spent 1.27s making 9767 calls to Graph::add_weighted_edge, avg 131µs/call # spent 17.6ms making 9767 calls to Bio::Roary::OrderGenes::group_graphs, avg 2µs/call
134 |  |  |  |  | }
135 |  |  |  |  | }
136 |  |  |  |  |
137 |  |  |  |  | }
138 |  |  |  |  |
139 |  |  |  |  |
140 |  |  |  |  | sub _reorder_connected_components
141 |  |  |  |  | # spent 4.11s (170ms+3.94) within Bio::Roary::OrderGenes::_reorder_connected_components which was called 2 times, avg 2.05s/call: # once (165ms+3.81s) by Bio::Roary::OrderGenes::_build_groups_to_contigs at line 233 # once (4.71ms+127ms) by Bio::Roary::OrderGenes::_build_groups_to_contigs at line 214 {
142 | 2 | 2µs |  |  | my($self, $graph_groups) = @_;
143 |  |  |  |  |
144 | 2 | 1µs |  |  | my @ordered_graph_groups;
145 |  |  |  |  |
146 | 2 | 700ns |  |  | my @paths_and_weights;
147 |  |  |  |  |
148 | 2 | 5µs |  |  | for my $graph_group( @{$graph_groups})
149 |  |  |  |  | {
150 |  |  |  |  |
151 | 36 | 304µs | 36 | 5.46ms | my $graph = Graph->new(undirected => 1); # spent 5.46ms making 36 calls to Graph::new, avg 152µs/call
152 | 36 | 9µs |  |  | my %groups;
153 | 36 | 3.03ms |  |  | $groups{$_}++ for (@{$graph_group});
154 |  |  |  |  |
155 | 36 | 17µs |  |  | my $total_weight =0;
156 | 36 | 14µs |  |  | my $number_of_edges = 0;
157 | 36 | 1.45ms |  |  | for my $current_group (keys %groups)
158 |  |  |  |  | {
159 | 4991 | 18.3ms | 4991 | 9.88ms | for my $group_to (keys %{$self->group_order->{$current_group}}) # spent 9.88ms making 4991 calls to Bio::Roary::OrderGenes::group_order, avg 2µs/call
160 |  |  |  |  | {
161 | 10006 | 4.55ms |  |  | next if(! defined($groups{$group_to}));
162 | 9998 | 11.7ms | 9998 | 70.4ms | next if($graph->has_edge($group_to,$current_group)); # spent 70.4ms making 9998 calls to Graph::has_edge, avg 7µs/call
163 | 5005 | 7.95ms | 5005 | 9.03ms | my $current_weight = $self->group_order->{$current_group}->{$group_to} ; # spent 9.03ms making 5005 calls to Bio::Roary::OrderGenes::group_order, avg 2µs/call
164 | 5005 | 5.40ms | 5005 | 8.85ms | $current_weight = $self->number_of_files if($current_weight > $self->number_of_files); # spent 8.85ms making 5005 calls to Bio::Roary::OrderGenes::number_of_files, avg 2µs/call
165 | 5005 | 6.27ms | 5005 | 7.64ms | my $weight = ($self->number_of_files - $current_weight) +1; # spent 7.64ms making 5005 calls to Bio::Roary::OrderGenes::number_of_files, avg 2µs/call
166 |  |  |  |  |
167 | 5005 | 6.85ms | 5005 | 753ms | $graph->add_weighted_edge($current_group,$group_to, $weight); # spent 753ms making 5005 calls to Graph::add_weighted_edge, avg 150µs/call
168 | 5005 | 996µs |  |  | $total_weight += $weight;
169 | 5005 | 4.20ms |  |  | $number_of_edges++;
170 |  |  |  |  | }
171 |  |  |  |  | }
172 |  |  |  |  |
173 | 36 | 10µs |  |  | my $average_weight ;
174 | 36 | 29µs |  |  | if($number_of_edges <= 0)
175 |  |  |  |  | {
176 |  |  |  |  | $average_weight = $self->number_of_files;
177 |  |  |  |  | }
178 |  |  |  |  | else
179 |  |  |  |  | {
180 | 36 | 46µs |  |  | $average_weight = $total_weight/$number_of_edges;
181 |  |  |  |  | }
182 |  |  |  |  |
183 | 36 | 137µs | 36 | 1.80s | my $minimum_spanning_tree = $graph->minimum_spanning_tree; # spent 1.80s making 36 calls to Graph::MST_Prim, avg 50.0ms/call
184 | 36 | 226µs | 36 | 20.7ms | my $dfs_obj = Graph::Traversal::DFS->new($minimum_spanning_tree); # spent 20.7ms making 36 calls to Graph::Traversal::new, avg 575µs/call
185 | 36 | 883µs | 36 | 1.26s | my @reordered_dfs_groups = $dfs_obj->dfs; # spent 1.26s making 36 calls to Graph::Traversal::postorder, avg 34.9ms/call
186 |  |  |  |  |
187 | 36 | 55.6ms |  |  | push(@paths_and_weights, {
188 |  |  |  |  | path => \@reordered_dfs_groups,
189 |  |  |  |  | average_weight => $average_weight
190 |  |  |  |  | });
191 |  |  |  |  |
192 |  |  |  |  | }
193 |  |  |  |  |
194 | 2 | 88µs | 2 | 64µs | my @ordered_paths_and_weights = sort { $a->{average_weight} <=> $b->{average_weight} } @paths_and_weights; # spent 64µs making 2 calls to Bio::Roary::OrderGenes::CORE:sort, avg 32µs/call
195 |  |  |  |  |
196 | 2 | 19µs |  |  | @ordered_graph_groups = map { $_->{path}} @ordered_paths_and_weights;
197 |  |  |  |  |
198 | 2 | 24µs |  |  | return \@ordered_graph_groups;
199 |  |  |  |  | }
200 |  |  |  |  |
201 |  |  |  |  | sub _build_groups_to_contigs
202 |  |  |  |  | # spent 9.70s (31.3ms+9.66) within Bio::Roary::OrderGenes::_build_groups_to_contigs which was called: # once (31.3ms+9.66s) by Bio::Roary::OrderGenes::groups_to_contigs at line 12 of (eval 25)[Eval/Closure.pm:125] {
203 | 1 | 900ns |  |  | my($self) = @_;
204 | 1 | 570µs | 1 | 3.95s | $self->_add_groups_to_graph; # spent 3.95s making 1 call to Bio::Roary::OrderGenes::_add_groups_to_graph
205 |  |  |  |  |
206 | 1 | 4µs |  |  | my %groups_to_contigs;
207 | 1 | 800ns |  |  | my $counter = 1;
208 | 1 | 300ns |  |  | my $overall_counter = 1 ;
209 | 1 | 200ns |  |  | my $counter_filtered = 1;
210 |  |  |  |  |
211 |  |  |  |  | # Accessory
212 | 1 | 10µs | 1 | 193ms | my $accessory_graph = $self->_create_accessory_graph; # spent 193ms making 1 call to Bio::Roary::OrderGenes::_create_accessory_graph
213 | 1 | 17µs | 1 | 34.7ms | my @group_graphs = $accessory_graph->connected_components(); # spent 34.7ms making 1 call to Graph::connected_components
214 | 1 | 6µs | 1 | 132ms | my $reordered_graphs = $self->_reorder_connected_components(\@group_graphs); # spent 132ms making 1 call to Bio::Roary::OrderGenes::_reorder_connected_components
215 |  |  |  |  |
216 | 1 | 4µs |  |  | for my $contig_groups (@{$reordered_graphs})
217 |  |  |  |  | {
218 | 8 | 1µs |  |  | my $order_counter = 1;
219 |  |  |  |  |
220 | 8 | 5µs |  |  | for my $group_name (@{$contig_groups})
221 |  |  |  |  | {
222 | 116 | 102µs |  |  | $groups_to_contigs{$group_name}{accessory_label} = $counter;
223 | 116 | 30µs |  |  | $groups_to_contigs{$group_name}{accessory_order} = $order_counter;
224 | 116 | 32µs |  |  | $groups_to_contigs{$group_name}{'accessory_overall_order'} = $overall_counter;
225 | 116 | 5µs |  |  | $order_counter++;
226 | 116 | 25µs |  |  | $overall_counter++;
227 |  |  |  |  | }
228 | 8 | 2µs |  |  | $counter++;
229 |  |  |  |  | }
230 |  |  |  |  |
231 |  |  |  |  | # Core + accessory
232 | 1 | 11µs | 2 | 1.37s | my @group_graphs_all = $self->group_graphs->connected_components(); # spent 1.37s making 1 call to Graph::connected_components # spent 6µs making 1 call to Bio::Roary::OrderGenes::group_graphs
233 | 1 | 4µs | 1 | 3.98s | my $reordered_graphs_all = $self->_reorder_connected_components(\@group_graphs_all); # spent 3.98s making 1 call to Bio::Roary::OrderGenes::_reorder_connected_components
234 |  |  |  |  |
235 | 1 | 500ns |  |  | $overall_counter = 1;
236 | 1 | 200ns |  |  | $counter = 1;
237 | 1 | 300ns |  |  | $counter_filtered = 1;
238 | 1 | 1µs |  |  | for my $contig_groups (@{$reordered_graphs_all})
239 |  |  |  |  | {
240 | 28 | 3µs |  |  | my $order_counter = 1;
241 |  |  |  |  |
242 | 28 | 19µs |  |  | for my $group_name (@{$contig_groups})
243 |  |  |  |  | {
244 | 4868 | 5.13ms |  |  | $groups_to_contigs{$group_name}{label} = $counter;
245 | 4868 | 2.21ms |  |  | $groups_to_contigs{$group_name}{comment} = '';
246 | 4868 | 1.52ms |  |  | $groups_to_contigs{$group_name}{order} = $order_counter;
247 | 4868 | 1.46ms |  |  | $groups_to_contigs{$group_name}{'core_accessory_overall_order'} = $overall_counter;
248 |  |  |  |  |
249 | 4868 | 6.12ms | 4884 | 6.39ms | if(@{$contig_groups} <= 2) # spent 6.39ms making 4884 calls to Bio::Roary::OrderGenes::_groups_qc, avg 1µs/call
250 |  |  |  |  | {
251 |  |  |  |  | $groups_to_contigs{$group_name}{comment} = 'Investigate';
252 |  |  |  |  | }
253 |  |  |  |  | elsif($self->_groups_qc->{$group_name})
254 |  |  |  |  | {
255 |  |  |  |  | $groups_to_contigs{$group_name}{comment} = $self->_groups_qc->{$group_name};
256 |  |  |  |  | }
257 |  |  |  |  | else
258 |  |  |  |  | {
259 | 4852 | 1.63ms |  |  | $groups_to_contigs{$group_name}{'core_accessory_overall_order_filtered'} = $counter_filtered;
260 | 4852 | 496µs |  |  | $counter_filtered++;
261 |  |  |  |  | }
262 | 4868 | 20µs |  |  | $order_counter++;
263 | 4868 | 1.19ms |  |  | $overall_counter++;
264 |  |  |  |  | }
265 | 28 | 7µs |  |  | $counter++;
266 |  |  |  |  | }
267 |  |  |  |  |
268 | 1 | 200ns |  |  | $counter_filtered = 1;
269 | 1 | 1µs |  |  | for my $contig_groups (@{$reordered_graphs})
270 |  |  |  |  | {
271 | 8 | 5µs |  |  | for my $group_name (@{$contig_groups})
272 |  |  |  |  | {
273 | 116 | 90µs |  |  | if( (!defined($groups_to_contigs{$group_name}{comment})) || (defined($groups_to_contigs{$group_name}{comment}) && $groups_to_contigs{$group_name}{comment} eq '') )
274 |  |  |  |  | {
275 | 115 | 73µs |  |  | $groups_to_contigs{$group_name}{'accessory_overall_order_filtered'} = $counter_filtered;
276 | 115 | 12µs |  |  | $counter_filtered++;
277 |  |  |  |  | }
278 |  |  |  |  | }
279 |  |  |  |  | }
280 |  |  |  |  |
281 |  |  |  |  |
282 | 1 | 1.31ms |  |  | return \%groups_to_contigs;
283 |  |  |  |  | }
284 |  |  |  |  |
285 |  |  |  |  | sub _create_accessory_graph
286 |  |  |  |  | # spent 193ms (85.8+107) within Bio::Roary::OrderGenes::_create_accessory_graph which was called: # once (85.8ms+107ms) by Bio::Roary::OrderGenes::_build_groups_to_contigs at line 212 {
287 | 1 | 1µs |  |  | my($self) = @_;
288 | 1 | 7µs | 1 | 145µs | my $graph = Graph->new(undirected => 1); # spent 145µs making 1 call to Graph::new
289 |  |  |  |  |
290 | 1 | 200ns |  |  | my %core_groups;
291 |  |  |  |  |
292 | 1 | 1.69ms | 1 | 2µs | for my $current_group (keys %{$self->group_order()}) # spent 2µs making 1 call to Bio::Roary::OrderGenes::group_order
293 |  |  |  |  | {
294 | 4871 | 844µs |  |  | my $sum_of_weights = 0;
295 | 4871 | 16.5ms | 4871 | 10.1ms | for my $group_to (keys %{$self->group_order->{$current_group}}) # spent 10.1ms making 4871 calls to Bio::Roary::OrderGenes::group_order, avg 2µs/call
296 |  |  |  |  | {
297 | 9767 | 20.5ms | 9767 | 19.9ms | $sum_of_weights += $self->group_order->{$current_group}->{$group_to}; # spent 19.9ms making 9767 calls to Bio::Roary::OrderGenes::group_order, avg 2µs/call
298 |  |  |  |  | }
299 | 4871 | 10.7ms | 4871 | 9.53ms | if($sum_of_weights >= $self->number_of_files ) # spent 9.53ms making 4871 calls to Bio::Roary::OrderGenes::number_of_files, avg 2µs/call
300 |  |  |  |  | {
301 |  |  |  |  | $core_groups{$current_group}++;
302 |  |  |  |  | }
303 |  |  |  |  | }
304 |  |  |  |  |
305 | 1 | 2.31ms | 1 | 10µs | for my $current_group (keys %{$self->group_order()}) # spent 10µs making 1 call to Bio::Roary::OrderGenes::group_order
306 |  |  |  |  | {
307 | 4871 | 1.90ms |  |  | next if(defined($core_groups{$current_group}));
308 | 163 | 783µs | 163 | 471µs | for my $group_to (keys %{$self->group_order->{$current_group}}) # spent 471µs making 163 calls to Bio::Roary::OrderGenes::group_order, avg 3µs/call
309 |  |  |  |  | {
310 | 308 | 157µs |  |  | next if(defined($core_groups{$group_to}));
311 | 231 | 922µs | 462 | 1.12ms | my $weight = ($self->number_of_files - $self->group_order->{$current_group}->{$group_to}) +1; # spent 609µs making 231 calls to Bio::Roary::OrderGenes::number_of_files, avg 3µs/call # spent 515µs making 231 calls to Bio::Roary::OrderGenes::group_order, avg 2µs/call
312 | 231 | 630µs | 231 | 42.5ms | $graph->add_weighted_edge($current_group,$group_to, $weight); # spent 42.5ms making 231 calls to Graph::add_weighted_edge, avg 184µs/call
313 |  |  |  |  | }
314 |  |  |  |  | }
315 | 1 | 649µs | 1 | 23.6ms | $self->_remove_weak_edges_from_graph($graph); # spent 23.6ms making 1 call to Bio::Roary::OrderGenes::_remove_weak_edges_from_graph
316 | 1 | 311µs |  |  | return $graph;
317 |  |  |  |  | }
318 |  |  |  |  |
319 |  |  |  |  | sub _remove_weak_edges_from_graph
320 |  |  |  |  | # spent 23.6ms (13.7+9.91) within Bio::Roary::OrderGenes::_remove_weak_edges_from_graph which was called: # once (13.7ms+9.91ms) by Bio::Roary::OrderGenes::_create_accessory_graph at line 315 {
321 | 1 | 1µs |  |  | my($self, $graph) = @_;
322 |  |  |  |  |
323 | 1 | 1.42ms | 1 | 3µs | for my $current_group (keys %{$self->group_order()}) # spent 3µs making 1 call to Bio::Roary::OrderGenes::group_order
324 |  |  |  |  | {
325 | 4871 | 5.18ms | 4871 | 9.00ms | next unless($graph->has_vertex($current_group)); # spent 9.00ms making 4871 calls to Graph::has_vertex, avg 2µs/call
326 |  |  |  |  |
327 | 120 | 14µs |  |  | my $largest = 0;
328 | 120 | 275µs | 120 | 201µs | for my $group_to (keys %{$self->group_order->{$current_group}}) # spent 201µs making 120 calls to Bio::Roary::OrderGenes::group_order, avg 2µs/call
329 |  |  |  |  | {
330 | 239 | 522µs | 361 | 529µs | if($largest < $self->group_order->{$current_group}->{$group_to}) # spent 529µs making 361 calls to Bio::Roary::OrderGenes::group_order, avg 1µs/call
331 |  |  |  |  | {
332 |  |  |  |  | $largest = $self->group_order->{$current_group}->{$group_to};
333 |  |  |  |  | }
334 |  |  |  |  | }
335 | 120 | 160µs | 120 | 160µs | my $threshold_link = int($largest*$self->_percentage_of_largest_weak_threshold); # spent 160µs making 120 calls to Bio::Roary::OrderGenes::_percentage_of_largest_weak_threshold, avg 1µs/call
336 | 120 | 38µs |  |  | next if($threshold_link <= 1);
337 |  |  |  |  |
338 | 4 | 9µs | 4 | 6µs | for my $group_to (keys %{$self->group_order->{$current_group}}) # spent 6µs making 4 calls to Bio::Roary::OrderGenes::group_order, avg 2µs/call
339 |  |  |  |  | {
340 | 6 | 10µs | 6 | 9µs | if($self->group_order->{$current_group}->{$group_to} < $threshold_link && $graph->has_edge($current_group,$group_to)) # spent 9µs making 6 calls to Bio::Roary::OrderGenes::group_order, avg 1µs/call
341 |  |  |  |  | {
342 |  |  |  |  | $graph->delete_edge($current_group, $group_to);
343 |  |  |  |  | }
344 |  |  |  |  | }
345 |  |  |  |  | }
346 |  |  |  |  |
347 |  |  |  |  | }
348 |  |  |  |  |
- - |  |  |  |  |
352 | 2 | 58µs | 2 | 265µs | # spent 140µs (14+125) within Bio::Roary::OrderGenes::BEGIN@352 which was called: # once (14µs+125µs) by Bio::Roary::PostAnalysis::BEGIN@20 at line 352 no Moose; # spent 140µs making 1 call to Bio::Roary::OrderGenes::BEGIN@352 # spent 125µs making 1 call to Moose::unimport
353 | 1 | 7µs | 2 | 7.09ms | __PACKAGE__->meta->make_immutable; # spent 7.08ms making 1 call to Class::MOP::Class::make_immutable # spent 14µs making 1 call to Bio::Roary::OrderGenes::meta
354 |  |  |  |  |
355 | 1 | 97µs |  |  | 1;