| Filename | /Users/ap13/pathogens/Roary/lib/Bio/Roary/GeneNamesFromGFF.pm |
| Statements | Executed 511423 statements in 1.47s |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 8 | 1 | 1 | 855ms | 1.66s | Bio::Roary::GeneNamesFromGFF::_build_ids_to_gene_name |
| 1 | 1 | 1 | 4.47ms | 91.2ms | Bio::Roary::GeneNamesFromGFF::BEGIN@19 |
| 8 | 1 | 1 | 58µs | 58µs | Bio::Roary::GeneNamesFromGFF::__ANON__[lib/Bio/Roary/GeneNamesFromGFF.pm:23] |
| 1 | 1 | 1 | 44µs | 4.98ms | Bio::Roary::GeneNamesFromGFF::BEGIN@17 |
| 1 | 1 | 1 | 12µs | 116µs | Bio::Roary::GeneNamesFromGFF::BEGIN@65 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Bio::Roary::GeneNamesFromGFF; | ||||
| 2 | |||||
| 3 | # ABSTRACT: Parse a GFF and efficiently extract ID -> Gene Name | ||||
| 4 | |||||
| 5 | =head1 SYNOPSIS | ||||
| 6 | |||||
| 7 | Parse a GFF and efficiently extract ID -> Gene Name | ||||
| 8 | use Bio::Roary::GeneNamesFromGFF; | ||||
| 9 | |||||
| 10 | my $obj = Bio::Roary::GeneNamesFromGFF->new( | ||||
| 11 | gff_file => 'abc.gff' | ||||
| 12 | ); | ||||
| 13 | $obj->ids_to_gene_name; | ||||
| 14 | |||||
| 15 | =cut | ||||
| 16 | |||||
| 17 | 2 | 89µs | 2 | 9.92ms | # spent 4.98ms (44µs+4.94) within Bio::Roary::GeneNamesFromGFF::BEGIN@17 which was called:
# once (44µs+4.94ms) by Bio::Roary::AnnotateGroups::BEGIN@21 at line 17 # spent 4.98ms making 1 call to Bio::Roary::GeneNamesFromGFF::BEGIN@17
# spent 4.94ms making 1 call to Moose::import |
| 18 | |||||
| 19 | 2 | 535µs | 1 | 91.2ms | # spent 91.2ms (4.47+86.7) within Bio::Roary::GeneNamesFromGFF::BEGIN@19 which was called:
# once (4.47ms+86.7ms) by Bio::Roary::AnnotateGroups::BEGIN@21 at line 19 # spent 91.2ms making 1 call to Bio::Roary::GeneNamesFromGFF::BEGIN@19 |
| 20 | 1 | 3µs | 1 | 15.4ms | with 'Bio::Roary::ParseGFFAnnotationRole'; # spent 15.4ms making 1 call to Moose::with |
| 21 | |||||
| 22 | 1 | 4µs | 1 | 2.54ms | has 'ids_to_gene_name' => ( is => 'ro', isa => 'HashRef', lazy => 1, builder => '_build_ids_to_gene_name' ); # spent 2.54ms making 1 call to Moose::has |
| 23 | 9 | 54µs | 1 | 1.93ms | # spent 58µs within Bio::Roary::GeneNamesFromGFF::__ANON__[lib/Bio/Roary/GeneNamesFromGFF.pm:23] which was called 8 times, avg 7µs/call:
# 8 times (58µs+0s) by Bio::Roary::GeneNamesFromGFF::new at line 90 of (eval 25)[Eval/Closure.pm:125], avg 7µs/call # spent 1.93ms making 1 call to Moose::has |
| 24 | |||||
| 25 | #Ā Parsing with the perl GFF module is exceptionally slow. | ||||
| 26 | # spent 1.66s (855ms+809ms) within Bio::Roary::GeneNamesFromGFF::_build_ids_to_gene_name which was called 8 times, avg 208ms/call:
# 8 times (855ms+809ms) by Bio::Roary::GeneNamesFromGFF::ids_to_gene_name at line 12 of (eval 25)[Eval/Closure.pm:125], avg 208ms/call | ||||
| 27 | 511404 | 1.47s | my ($self) = @_; | ||
| 28 | my %id_to_gene_name; | ||||
| 29 | |||||
| 30 | 16 | 17.1ms | open( my $fh, '-|', $self->_gff_fh_input_string ) or die "Couldnt open GFF file"; # spent 16.6ms making 8 calls to Bio::Roary::GeneNamesFromGFF::CORE:open, avg 2.07ms/call
# spent 506µs making 8 calls to Bio::Roary::ParseGFFAnnotationRole::_gff_fh_input_string, avg 63µs/call | ||
| 31 | 8 | 226ms | while(<$fh>) # spent 226ms making 8 calls to Bio::Roary::GeneNamesFromGFF::CORE:readline, avg 28.3ms/call | ||
| 32 | { | ||||
| 33 | chomp; | ||||
| 34 | my $line = $_; | ||||
| 35 | my $id_name; | ||||
| 36 | 40008 | 90.5ms | if($line =~/ID=["']?([^;"']+)["']?;?/i) # spent 90.5ms making 40008 calls to Bio::Roary::GeneNamesFromGFF::CORE:match, avg 2µs/call | ||
| 37 | { | ||||
| 38 | $id_name = $1; | ||||
| 39 | 40008 | 16.6ms | $id_name =~ s!"!!g; # spent 16.6ms making 40008 calls to Bio::Roary::GeneNamesFromGFF::CORE:subst, avg 415ns/call | ||
| 40 | } | ||||
| 41 | else | ||||
| 42 | { | ||||
| 43 | next; | ||||
| 44 | } | ||||
| 45 | |||||
| 46 | 40008 | 65.9ms | if($line =~/gene=["']?([^;"']+)["']?;?/i) # spent 65.9ms making 40008 calls to Bio::Roary::GeneNamesFromGFF::CORE:match, avg 2µs/call | ||
| 47 | { | ||||
| 48 | my $gene_name = $1; | ||||
| 49 | 27819 | 9.20ms | $gene_name =~ s!"!!g; # spent 9.20ms making 27819 calls to Bio::Roary::GeneNamesFromGFF::CORE:subst, avg 331ns/call | ||
| 50 | next if ( $gene_name eq "" ); | ||||
| 51 | $id_to_gene_name{$id_name} = $gene_name; | ||||
| 52 | } | ||||
| 53 | |||||
| 54 | 80016 | 294ms | if($line =~/product=["']?([^;,"']+)[,"']?;?/i) # spent 180ms making 40008 calls to Bio::Roary::GeneNamesFromGFF::CORE:readline, avg 5µs/call
# spent 114ms making 40008 calls to Bio::Roary::GeneNamesFromGFF::CORE:match, avg 3µs/call | ||
| 55 | { | ||||
| 56 | my $product = $1; | ||||
| 57 | 40008 | 88.2ms | $self->ids_to_product->{$id_name} = $product; # spent 88.2ms making 40008 calls to Bio::Roary::GeneNamesFromGFF::ids_to_product, avg 2µs/call | ||
| 58 | } | ||||
| 59 | |||||
| 60 | } | ||||
| 61 | 8 | 329µs | close($fh); # spent 329µs making 8 calls to Bio::Roary::GeneNamesFromGFF::CORE:close, avg 41µs/call | ||
| 62 | return \%id_to_gene_name; | ||||
| 63 | } | ||||
| 64 | |||||
| 65 | 2 | 41µs | 2 | 220µs | # spent 116µs (12+104) within Bio::Roary::GeneNamesFromGFF::BEGIN@65 which was called:
# once (12µs+104µs) by Bio::Roary::AnnotateGroups::BEGIN@21 at line 65 # spent 116µs making 1 call to Bio::Roary::GeneNamesFromGFF::BEGIN@65
# spent 104µs making 1 call to Moose::unimport |
| 66 | 1 | 6µs | 2 | 5.47ms | __PACKAGE__->meta->make_immutable; # spent 5.46ms making 1 call to Class::MOP::Class::make_immutable
# spent 15µs making 1 call to Bio::Roary::GeneNamesFromGFF::meta |
| 67 | |||||
| 68 | 1 | 31µs | 1; |