Filename | /Users/ap13/pathogens/Roary/lib/Bio/Roary/ClustersRole.pm |
Statements | Executed 16454 statements in 28.2ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 22.5ms | 30.0ms | _build__clustered_genes | Bio::Roary::ClustersRole::
5250 | 2 | 1 | 5.88ms | 5.88ms | CORE:match (opcode) | Bio::Roary::ClustersRole::
2626 | 2 | 1 | 1.59ms | 1.59ms | CORE:readline (opcode) | Bio::Roary::ClustersRole::
1 | 1 | 1 | 1.07ms | 12.0ms | BEGIN@11 | Bio::Roary::ClustersRole::
1 | 1 | 1 | 15µs | 15µs | CORE:open (opcode) | Bio::Roary::ClustersRole::
1 | 1 | 1 | 14µs | 32µs | _build__clusters_fh | Bio::Roary::ClustersRole::
1 | 1 | 1 | 8µs | 8µs | BEGIN@12 | Bio::Roary::ClustersRole::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Bio::Roary::ClustersRole; | ||||
2 | # ABSTRACT: A role to read a clusters file from CD hit | ||||
3 | |||||
4 | =head1 SYNOPSIS | ||||
5 | |||||
6 | A role to read a clusters file from CD hit | ||||
7 | with 'Bio::Roary::ClustersRole'; | ||||
8 | |||||
9 | =cut | ||||
10 | |||||
11 | 2 | 145µs | 2 | 15.2ms | # spent 12.0ms (1.07+10.9) within Bio::Roary::ClustersRole::BEGIN@11 which was called:
# once (1.07ms+10.9ms) by Module::Runtime::require_module at line 11 # spent 12.0ms making 1 call to Bio::Roary::ClustersRole::BEGIN@11
# spent 3.22ms making 1 call to Moose::Role::import |
12 | 2 | 326µs | 1 | 8µs | # spent 8µs within Bio::Roary::ClustersRole::BEGIN@12 which was called:
# once (8µs+0s) by Module::Runtime::require_module at line 12 # spent 8µs making 1 call to Bio::Roary::ClustersRole::BEGIN@12 |
13 | |||||
14 | 1 | 3µs | 1 | 220µs | has 'clusters_filename' => ( is => 'ro', isa => 'Str', required => 1 ); # spent 220µs making 1 call to Moose::Role::has |
15 | 1 | 1µs | 1 | 91µs | has '_clustered_genes' => ( is => 'ro',lazy => 1, builder => '_build__clustered_genes' ); # spent 91µs making 1 call to Moose::Role::has |
16 | 1 | 1µs | 1 | 86µs | has '_clusters_fh' => ( is => 'ro',lazy => 1, builder => '_build__clusters_fh' ); # spent 86µs making 1 call to Moose::Role::has |
17 | |||||
18 | sub _build__clusters_fh | ||||
19 | # spent 32µs (14+19) within Bio::Roary::ClustersRole::_build__clusters_fh which was called:
# once (14µs+19µs) by Bio::Roary::InflateClusters::_clusters_fh at line 11 of (eval 25)[Eval/Closure.pm:125] | ||||
20 | 1 | 500ns | my($self) = @_; | ||
21 | 1 | 24µs | 2 | 18µs | open(my $fh, $self->clusters_filename) or Bio::Roary::Exceptions::FileNotFound->throw( error => 'Cant open file: ' . $self->clusters_filename ); # spent 15µs making 1 call to Bio::Roary::ClustersRole::CORE:open
# spent 4µs making 1 call to Bio::Roary::InflateClusters::clusters_filename |
22 | 1 | 3µs | return $fh; | ||
23 | } | ||||
24 | |||||
25 | sub _build__clustered_genes | ||||
26 | # spent 30.0ms (22.5+7.51) within Bio::Roary::ClustersRole::_build__clustered_genes which was called:
# once (22.5ms+7.51ms) by Bio::Roary::InflateClusters::_clustered_genes at line 11 of (eval 25)[Eval/Closure.pm:125] | ||||
27 | 1 | 700ns | my($self) = @_; | ||
28 | 1 | 3µs | 1 | 48µs | my $fh = $self->_clusters_fh; # spent 48µs making 1 call to Bio::Roary::InflateClusters::_clusters_fh |
29 | 1 | 500ns | my %clustered_genes ; | ||
30 | |||||
31 | 1 | 100ns | my %raw_clusters; | ||
32 | 1 | 100ns | my $current_cluster_name; | ||
33 | 1 | 17µs | 1 | 11µs | while(<$fh>) # spent 11µs making 1 call to Bio::Roary::ClustersRole::CORE:readline |
34 | { | ||||
35 | 2625 | 564µs | my $line = $_; | ||
36 | 2625 | 4.96ms | 2625 | 1.15ms | if($line =~ /^>(.+)$/) # spent 1.15ms making 2625 calls to Bio::Roary::ClustersRole::CORE:match, avg 437ns/call |
37 | { | ||||
38 | $current_cluster_name = $1; | ||||
39 | } | ||||
40 | |||||
41 | #>Cluster 5 | ||||
42 | #0 4201aa, >6630_4#9_00008... * | ||||
43 | #1 4201aa, >6631_1#23_00379... at 100.00% | ||||
44 | |||||
45 | 2625 | 15.3ms | 5250 | 6.30ms | if($line =~ /[\d]+\t[\w]+, >(.+)\.\.\. (.+)$/) # spent 4.73ms making 2625 calls to Bio::Roary::ClustersRole::CORE:match, avg 2µs/call
# spent 1.58ms making 2625 calls to Bio::Roary::ClustersRole::CORE:readline, avg 600ns/call |
46 | { | ||||
47 | 2140 | 1.29ms | my $gene_name = $1; | ||
48 | 2140 | 591µs | my $identity = $2; | ||
49 | |||||
50 | 2140 | 1.56ms | if($identity eq '*') | ||
51 | { | ||||
52 | $raw_clusters{$current_cluster_name}{representative_gene_name} = $gene_name; | ||||
53 | } | ||||
54 | else | ||||
55 | { | ||||
56 | 1655 | 1.94ms | push(@{$raw_clusters{$current_cluster_name}{gene_names}}, $gene_name); | ||
57 | } | ||||
58 | } | ||||
59 | } | ||||
60 | |||||
61 | # iterate over the raw clusters and convert to a simple hash | ||||
62 | 1 | 173µs | for my $cluster_name (keys %raw_clusters) | ||
63 | { | ||||
64 | 485 | 841µs | $clustered_genes{$raw_clusters{$cluster_name}{representative_gene_name}} = $raw_clusters{$cluster_name}{gene_names}; | ||
65 | } | ||||
66 | |||||
67 | 1 | 411µs | return \%clustered_genes; | ||
68 | } | ||||
69 | |||||
70 | 1 | 10µs | 1; | ||
# spent 5.88ms within Bio::Roary::ClustersRole::CORE:match which was called 5250 times, avg 1µs/call:
# 2625 times (4.73ms+0s) by Bio::Roary::ClustersRole::_build__clustered_genes at line 45, avg 2µs/call
# 2625 times (1.15ms+0s) by Bio::Roary::ClustersRole::_build__clustered_genes at line 36, avg 437ns/call | |||||
# spent 15µs within Bio::Roary::ClustersRole::CORE:open which was called:
# once (15µs+0s) by Bio::Roary::ClustersRole::_build__clusters_fh at line 21 | |||||
sub Bio::Roary::ClustersRole::CORE:readline; # opcode |