| 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 | Bio::Roary::ClustersRole::_build__clustered_genes |
| 5250 | 2 | 1 | 5.88ms | 5.88ms | Bio::Roary::ClustersRole::CORE:match (opcode) |
| 2626 | 2 | 1 | 1.59ms | 1.59ms | Bio::Roary::ClustersRole::CORE:readline (opcode) |
| 1 | 1 | 1 | 1.07ms | 12.0ms | Bio::Roary::ClustersRole::BEGIN@11 |
| 1 | 1 | 1 | 15µs | 15µs | Bio::Roary::ClustersRole::CORE:open (opcode) |
| 1 | 1 | 1 | 14µs | 32µs | Bio::Roary::ClustersRole::_build__clusters_fh |
| 1 | 1 | 1 | 8µs | 8µs | Bio::Roary::ClustersRole::BEGIN@12 |
| 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 | 3 | 28µs | my($self) = @_; | ||
| 21 | 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 | 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 | 16443 | 27.7ms | my($self) = @_; | ||
| 28 | 1 | 48µs | my $fh = $self->_clusters_fh; # spent 48µs making 1 call to Bio::Roary::InflateClusters::_clusters_fh | ||
| 29 | my %clustered_genes ; | ||||
| 30 | |||||
| 31 | my %raw_clusters; | ||||
| 32 | my $current_cluster_name; | ||||
| 33 | 1 | 11µs | while(<$fh>) # spent 11µs making 1 call to Bio::Roary::ClustersRole::CORE:readline | ||
| 34 | { | ||||
| 35 | my $line = $_; | ||||
| 36 | 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 | 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 | my $gene_name = $1; | ||||
| 48 | my $identity = $2; | ||||
| 49 | |||||
| 50 | if($identity eq '*') | ||||
| 51 | { | ||||
| 52 | $raw_clusters{$current_cluster_name}{representative_gene_name} = $gene_name; | ||||
| 53 | } | ||||
| 54 | else | ||||
| 55 | { | ||||
| 56 | 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 | for my $cluster_name (keys %raw_clusters) | ||||
| 63 | { | ||||
| 64 | $clustered_genes{$raw_clusters{$cluster_name}{representative_gene_name}} = $raw_clusters{$cluster_name}{gene_names}; | ||||
| 65 | } | ||||
| 66 | |||||
| 67 | 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 |