← 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:45:54 2015

Filename/Users/ap13/pathogens/Roary/lib/Bio/Roary/CommandLine/RoaryPostAnalysis.pm
StatementsExecuted 121 statements in 2.29ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111354ms56.9sBio::Roary::CommandLine::RoaryPostAnalysis::::runBio::Roary::CommandLine::RoaryPostAnalysis::run
1117.60ms10.2msBio::Roary::CommandLine::RoaryPostAnalysis::::BEGIN@12Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@12
1114.43ms9.90msBio::Roary::CommandLine::RoaryPostAnalysis::::BEGIN@14Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@14
1112.36ms484msBio::Roary::CommandLine::RoaryPostAnalysis::::BEGIN@11Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@11
1111.87ms791msBio::Roary::CommandLine::RoaryPostAnalysis::::BEGIN@13Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@13
111677µs49.2msBio::Roary::CommandLine::RoaryPostAnalysis::::BEGIN@15Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@15
211158µs297µsBio::Roary::CommandLine::RoaryPostAnalysis::::_read_file_into_arrayBio::Roary::CommandLine::RoaryPostAnalysis::_read_file_into_array
111120µs2.54msBio::Roary::CommandLine::RoaryPostAnalysis::::BUILDBio::Roary::CommandLine::RoaryPostAnalysis::BUILD
11112µs49µsBio::Roary::CommandLine::RoaryPostAnalysis::::BEGIN@16Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@16
11112µs124µsBio::Roary::CommandLine::RoaryPostAnalysis::::BEGIN@188Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@188
0000s0sBio::Roary::CommandLine::RoaryPostAnalysis::::_find_input_filesBio::Roary::CommandLine::RoaryPostAnalysis::_find_input_files
0000s0sBio::Roary::CommandLine::RoaryPostAnalysis::::usage_textBio::Roary::CommandLine::RoaryPostAnalysis::usage_text
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Bio::Roary::CommandLine::RoaryPostAnalysis;
2
3# ABSTRACT: Perform the post analysis on the pan genome
4
5=head1 SYNOPSIS
6
7Perform the post analysis on the pan genome
8
9=cut
10
112136µs2489ms
# spent 484ms (2.36+481) within Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@11 which was called: # once (2.36ms+481ms) by Bio::Roary::Main::RoaryPostAnalysis::BEGIN@17 at line 11
use Moose;
# spent 484ms making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@11 # spent 5.03ms making 1 call to Moose::import
122203µs211.8ms
# spent 10.2ms (7.60+2.65) within Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@12 which was called: # once (7.60ms+2.65ms) by Bio::Roary::Main::RoaryPostAnalysis::BEGIN@17 at line 12
use Getopt::Long qw(GetOptionsFromArray);
# spent 10.2ms making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@12 # spent 1.53ms making 1 call to Getopt::Long::import
132147µs1791ms
# spent 791ms (1.87+789) within Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@13 which was called: # once (1.87ms+789ms) by Bio::Roary::Main::RoaryPostAnalysis::BEGIN@17 at line 13
use Bio::Roary::PostAnalysis;
142181µs29.93ms
# spent 9.90ms (4.43+5.47) within Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@14 which was called: # once (4.43ms+5.47ms) by Bio::Roary::Main::RoaryPostAnalysis::BEGIN@17 at line 14
use File::Find::Rule;
# spent 9.90ms making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@14 # spent 27µs making 1 call to File::Find::Rule::import
152219µs149.2ms
# spent 49.2ms (677µs+48.6) within Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@15 which was called: # once (677µs+48.6ms) by Bio::Roary::Main::RoaryPostAnalysis::BEGIN@17 at line 15
use Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides;
162770µs286µs
# spent 49µs (12+37) within Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@16 which was called: # once (12µs+37µs) by Bio::Roary::Main::RoaryPostAnalysis::BEGIN@17 at line 16
use File::Path qw(remove_tree);
# spent 49µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@16 # spent 37µs making 1 call to Exporter::import
1712µs17.73msextends 'Bio::Roary::CommandLine::Common';
# spent 7.73ms making 1 call to Moose::extends
18
1914µs11.92mshas 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
# spent 1.92ms making 1 call to Moose::has
2013µs11.53mshas 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
# spent 1.53ms making 1 call to Moose::has
2112µs11.77mshas 'help' => ( is => 'rw', isa => 'Bool', default => 0 );
# spent 1.77ms making 1 call to Moose::has
2212µs11.75mshas '_error_message' => ( is => 'rw', isa => 'Str' );
# spent 1.75ms making 1 call to Moose::has
23
2412µs11.73mshas 'fasta_files' => ( is => 'rw', isa => 'Str' );
# spent 1.73ms making 1 call to Moose::has
2512µs12.08mshas 'input_files' => ( is => 'rw', isa => 'Str');
# spent 2.08ms making 1 call to Moose::has
2613µs12.14mshas 'output_filename' => ( is => 'rw', isa => 'Str', default => 'clustered_proteins' );
# spent 2.14ms making 1 call to Moose::has
2712µs11.85mshas 'output_pan_geneome_filename' => ( is => 'rw', isa => 'Str', default => 'pan_genome.fa' );
# spent 1.85ms making 1 call to Moose::has
2812µs12.22mshas 'output_statistics_filename' => ( is => 'rw', isa => 'Str', default => 'gene_presence_absence.csv' );
# spent 2.22ms making 1 call to Moose::has
2913µs12.54mshas 'output_multifasta_files' => ( is => 'rw', isa => 'Bool', default => 0 );
# spent 2.54ms making 1 call to Moose::has
3012µs12.47mshas 'clusters_filename' => ( is => 'rw', isa => 'Str' );
# spent 2.47ms making 1 call to Moose::has
3112µs12.61mshas 'job_runner' => ( is => 'rw', isa => 'Str', default => 'Local' );
# spent 2.61ms making 1 call to Moose::has
3212µs12.45mshas 'cpus' => ( is => 'rw', isa => 'Int', default => 1 );
# spent 2.45ms making 1 call to Moose::has
3312µs12.15mshas 'dont_delete_files' => ( is => 'rw', isa => 'Bool', default => 0 );
# spent 2.15ms making 1 call to Moose::has
3412µs12.01mshas 'dont_create_rplots' => ( is => 'rw', isa => 'Bool', default => 0 );
# spent 2.01ms making 1 call to Moose::has
3512µs11.97mshas 'dont_split_groups' => ( is => 'rw', isa => 'Bool', default => 0 );
# spent 1.97ms making 1 call to Moose::has
3612µs11.86mshas 'verbose_stats' => ( is => 'rw', isa => 'Bool', default => 0 );
# spent 1.86ms making 1 call to Moose::has
3712µs13.38mshas 'translation_table' => ( is => 'rw', isa => 'Int', default => 11 );
# spent 3.38ms making 1 call to Moose::has
3813µs12.28mshas 'group_limit' => ( is => 'rw', isa => 'Num', default => 50000 );
# spent 2.28ms making 1 call to Moose::has
3912µs12.05mshas 'core_definition' => ( is => 'rw', isa => 'Num', default => 1.0 );
# spent 2.05ms making 1 call to Moose::has
40
41
# spent 2.54ms (120µs+2.42) within Bio::Roary::CommandLine::RoaryPostAnalysis::BUILD which was called: # once (120µs+2.42ms) by Bio::Roary::CommandLine::RoaryPostAnalysis::new at line 301 of (eval 25)[Eval/Closure.pm:125]
sub BUILD {
4211µs my ($self) = @_;
43
44 my (
4511µs $output_filename, $dont_create_rplots, $dont_delete_files, $dont_split_groups, $output_pan_geneome_filename,
46 $job_runner, $output_statistics_filename, $output_multifasta_files, $clusters_filename, $core_definition,
47 $fasta_files, $input_files, $verbose_stats, $translation_table, $help, $cpus,$group_limit
48 );
49
50
5118µs22.26ms GetOptionsFromArray(
# spent 2.25ms making 1 call to Getopt::Long::GetOptionsFromArray # spent 4µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::args
52 $self->args,
53 'o|output=s' => \$output_filename,
54 'j|job_runner=s' => \$job_runner,
55 'output_multifasta_files' => \$output_multifasta_files,
56 'p=s' => \$output_pan_geneome_filename,
57 's=s' => \$output_statistics_filename,
58 'c=s' => \$clusters_filename,
59 'f=s' => \$fasta_files,
60 'i=s' => \$input_files,
61 'dont_delete_files' => \$dont_delete_files,
62 'dont_create_rplots' => \$dont_create_rplots,
63 'dont_split_groups' => \$dont_split_groups,
64 'verbose_stats' => \$verbose_stats,
65 'processors=i' => \$cpus,
66 't|translation_table=i' => \$translation_table,
67 'group_limit=i' => \$group_limit,
68 'cd|core_definition=f' => \$core_definition,
69 'h|help' => \$help,
70 );
71
721500ns $self->help($help) if(defined($help));
7314µs19µs $self->job_runner($job_runner) if ( defined($job_runner) );
7414µs110µs $self->fasta_files($fasta_files) if ( defined($fasta_files) );
7513µs18µs $self->input_files($input_files) if ( defined($input_files) );
7614µs18µs $self->output_filename($output_filename) if ( defined($output_filename) );
7714µs18µs $self->output_pan_geneome_filename($output_pan_geneome_filename) if ( defined($output_pan_geneome_filename) );
7813µs18µs $self->output_statistics_filename($output_statistics_filename) if ( defined($output_statistics_filename) );
791400ns $self->output_multifasta_files($output_multifasta_files) if ( defined($output_multifasta_files) );
8013µs18µs $self->clusters_filename($clusters_filename) if ( defined($clusters_filename) );
8113µs18µs $self->dont_delete_files($dont_delete_files) if ( defined($dont_delete_files) );
8214µs18µs $self->dont_create_rplots($dont_create_rplots) if ( defined($dont_create_rplots) );
831400ns $self->dont_split_groups($dont_split_groups) if ( defined($dont_split_groups) );
841300ns $self->verbose_stats($verbose_stats) if ( defined($verbose_stats));
8514µs120µs $self->translation_table($translation_table) if ( defined($translation_table) );
8613µs121µs $self->cpus($cpus) if ( defined($cpus) );
# spent 21µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::cpus
8713µs120µs $self->group_limit($group_limit) if ( defined($group_limit) );
88112µs123µs $self->core_definition( $core_definition/100 ) if ( defined($core_definition) );
89}
90
91
# spent 56.9s (354ms+56.5) within Bio::Roary::CommandLine::RoaryPostAnalysis::run which was called: # once (354ms+56.5s) by main::RUNTIME at line 19 of bin/pan_genome_post_analysis
sub run {
921900ns my ($self) = @_;
93
9414µs14µs ( !$self->help ) or die $self->usage_text;
9514µs14µs if ( defined( $self->_error_message ) ) {
96 print $self->_error_message . "\n";
97 die $self->usage_text;
98 }
99
100145µs15567µs my $obj = Bio::Roary::PostAnalysis->new(
101 fasta_files => $self->_read_file_into_array($self->fasta_files) ,
102 input_files => $self->_read_file_into_array($self->input_files) ,
103 output_filename => $self->output_filename ,
104 output_pan_geneome_filename => $self->output_pan_geneome_filename,
105 output_statistics_filename => $self->output_statistics_filename ,
106 output_multifasta_files => $self->output_multifasta_files ,
107 clusters_filename => $self->clusters_filename ,
108 dont_delete_files => $self->dont_delete_files,
109 dont_create_rplots => $self->dont_create_rplots,
110 dont_split_groups => $self->dont_split_groups,
111 verbose_stats => $self->verbose_stats,
112 group_limit => $self->group_limit,
113 );
11417µs156.5s $obj->run();
# spent 56.5s making 1 call to Bio::Roary::PostAnalysis::run
115
116
117123µs116µs if($self->output_multifasta_files == 1)
118 {
119 my $output_gene_files = $self->_find_input_files;
120 my $seg = Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides->new(
121 fasta_files => $output_gene_files,
122 job_runner => $self->job_runner,
123 translation_table => $self->translation_table,
124 core_definition => $self->core_definition,
125 cpus => $self->cpus
126 );
127 $seg->run();
128
129 # Cleanup intermediate multifasta files
130 if($self->dont_delete_files == 0)
131 {
132 remove_tree('pan_genome_sequences');
133 }
134 }
135
136
137}
138
139sub _find_input_files
140{
141 my ($self) = @_;
142 my @files = File::Find::Rule->file()
143 ->name( '*.fa' )
144 ->in('pan_genome_sequences' );
145 return \@files;
146}
147
148sub _read_file_into_array
149
# spent 297µs (158+138) within Bio::Roary::CommandLine::RoaryPostAnalysis::_read_file_into_array which was called 2 times, avg 148µs/call: # 2 times (158µs+138µs) by Bio::Roary::CommandLine::RoaryPostAnalysis::run at line 100, avg 148µs/call
{
15022µs my ($self, $filename) = @_;
1512111µs292µs open(my $in_fh, $filename);
# spent 92µs making 2 calls to Bio::Roary::CommandLine::RoaryPostAnalysis::CORE:open, avg 46µs/call
152
1532700ns my @filenames;
154244µs230µs while(<$in_fh>){
# spent 30µs making 2 calls to Bio::Roary::CommandLine::RoaryPostAnalysis::CORE:readline, avg 15µs/call
155165µs chomp;
156166µs my $line = $_;
1571681µs1617µs push(@filenames, $line);
# spent 17µs making 16 calls to Bio::Roary::CommandLine::RoaryPostAnalysis::CORE:readline, avg 1µs/call
158 }
159245µs return \@filenames;
160}
161
162sub usage_text {
163 my ($self) = @_;
164
165 return <<USAGE;
166 Usage: pan_genome_post_analysis [options]
167 Perform the post analysis on the pan genome. This script is usally only called by another script.
168
169 #Normal usage
170 pan_genome_post_analysis
171 -o <output_groups_filename>
172 -p <output_pan_genome_filename>
173 -s <output_stats_filename>
174 -c <output_clusters_filename>
175 -f <file_of_proteins>
176 -i <file_of_gffs>
177 --processors <number of processors>
178 --verbose_stats
179 --core_definition <percentage of genomes required to qualify gene as core>
180
181 # This help message
182 pan_genome_post_analysis -h
183
184USAGE
185}
186
18716µs215.4ms__PACKAGE__->meta->make_immutable;
# spent 15.4ms making 1 call to Class::MOP::Class::make_immutable # spent 15µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::meta
188245µs2236µs
# spent 124µs (12+112) within Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@188 which was called: # once (12µs+112µs) by Bio::Roary::Main::RoaryPostAnalysis::BEGIN@17 at line 188
no Moose;
# spent 124µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@188 # spent 112µs making 1 call to Moose::unimport
189192µs1;