Filename | /Users/ap13/pathogens/Roary/lib/Bio/Roary/CommandLine/RoaryPostAnalysis.pm |
Statements | Executed 121 statements in 2.29ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 354ms | 56.9s | run | Bio::Roary::CommandLine::RoaryPostAnalysis::
1 | 1 | 1 | 7.60ms | 10.2ms | BEGIN@12 | Bio::Roary::CommandLine::RoaryPostAnalysis::
1 | 1 | 1 | 4.43ms | 9.90ms | BEGIN@14 | Bio::Roary::CommandLine::RoaryPostAnalysis::
1 | 1 | 1 | 2.36ms | 484ms | BEGIN@11 | Bio::Roary::CommandLine::RoaryPostAnalysis::
1 | 1 | 1 | 1.87ms | 791ms | BEGIN@13 | Bio::Roary::CommandLine::RoaryPostAnalysis::
1 | 1 | 1 | 677µs | 49.2ms | BEGIN@15 | Bio::Roary::CommandLine::RoaryPostAnalysis::
2 | 1 | 1 | 158µs | 297µs | _read_file_into_array | Bio::Roary::CommandLine::RoaryPostAnalysis::
1 | 1 | 1 | 120µs | 2.54ms | BUILD | Bio::Roary::CommandLine::RoaryPostAnalysis::
1 | 1 | 1 | 12µs | 49µs | BEGIN@16 | Bio::Roary::CommandLine::RoaryPostAnalysis::
1 | 1 | 1 | 12µs | 124µs | BEGIN@188 | Bio::Roary::CommandLine::RoaryPostAnalysis::
0 | 0 | 0 | 0s | 0s | _find_input_files | Bio::Roary::CommandLine::RoaryPostAnalysis::
0 | 0 | 0 | 0s | 0s | usage_text | Bio::Roary::CommandLine::RoaryPostAnalysis::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Bio::Roary::CommandLine::RoaryPostAnalysis; | ||||
2 | |||||
3 | # ABSTRACT: Perform the post analysis on the pan genome | ||||
4 | |||||
5 | =head1 SYNOPSIS | ||||
6 | |||||
7 | Perform the post analysis on the pan genome | ||||
8 | |||||
9 | =cut | ||||
10 | |||||
11 | 2 | 136µs | 2 | 489ms | # 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 # spent 484ms making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@11
# spent 5.03ms making 1 call to Moose::import |
12 | 2 | 203µs | 2 | 11.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 # spent 10.2ms making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@12
# spent 1.53ms making 1 call to Getopt::Long::import |
13 | 2 | 147µs | 1 | 791ms | # 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 # spent 791ms making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@13 |
14 | 2 | 181µs | 2 | 9.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 # spent 9.90ms making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@14
# spent 27µs making 1 call to File::Find::Rule::import |
15 | 2 | 219µs | 1 | 49.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 # spent 49.2ms making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@15 |
16 | 2 | 770µs | 2 | 86µ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 # spent 49µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@16
# spent 37µs making 1 call to Exporter::import |
17 | 1 | 2µs | 1 | 7.73ms | extends 'Bio::Roary::CommandLine::Common'; # spent 7.73ms making 1 call to Moose::extends |
18 | |||||
19 | 1 | 4µs | 1 | 1.92ms | has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); # spent 1.92ms making 1 call to Moose::has |
20 | 1 | 3µs | 1 | 1.53ms | has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 ); # spent 1.53ms making 1 call to Moose::has |
21 | 1 | 2µs | 1 | 1.77ms | has 'help' => ( is => 'rw', isa => 'Bool', default => 0 ); # spent 1.77ms making 1 call to Moose::has |
22 | 1 | 2µs | 1 | 1.75ms | has '_error_message' => ( is => 'rw', isa => 'Str' ); # spent 1.75ms making 1 call to Moose::has |
23 | |||||
24 | 1 | 2µs | 1 | 1.73ms | has 'fasta_files' => ( is => 'rw', isa => 'Str' ); # spent 1.73ms making 1 call to Moose::has |
25 | 1 | 2µs | 1 | 2.08ms | has 'input_files' => ( is => 'rw', isa => 'Str'); # spent 2.08ms making 1 call to Moose::has |
26 | 1 | 3µs | 1 | 2.14ms | has 'output_filename' => ( is => 'rw', isa => 'Str', default => 'clustered_proteins' ); # spent 2.14ms making 1 call to Moose::has |
27 | 1 | 2µs | 1 | 1.85ms | has 'output_pan_geneome_filename' => ( is => 'rw', isa => 'Str', default => 'pan_genome.fa' ); # spent 1.85ms making 1 call to Moose::has |
28 | 1 | 2µs | 1 | 2.22ms | has 'output_statistics_filename' => ( is => 'rw', isa => 'Str', default => 'gene_presence_absence.csv' ); # spent 2.22ms making 1 call to Moose::has |
29 | 1 | 3µs | 1 | 2.54ms | has 'output_multifasta_files' => ( is => 'rw', isa => 'Bool', default => 0 ); # spent 2.54ms making 1 call to Moose::has |
30 | 1 | 2µs | 1 | 2.47ms | has 'clusters_filename' => ( is => 'rw', isa => 'Str' ); # spent 2.47ms making 1 call to Moose::has |
31 | 1 | 2µs | 1 | 2.61ms | has 'job_runner' => ( is => 'rw', isa => 'Str', default => 'Local' ); # spent 2.61ms making 1 call to Moose::has |
32 | 1 | 2µs | 1 | 2.45ms | has 'cpus' => ( is => 'rw', isa => 'Int', default => 1 ); # spent 2.45ms making 1 call to Moose::has |
33 | 1 | 2µs | 1 | 2.15ms | has 'dont_delete_files' => ( is => 'rw', isa => 'Bool', default => 0 ); # spent 2.15ms making 1 call to Moose::has |
34 | 1 | 2µs | 1 | 2.01ms | has 'dont_create_rplots' => ( is => 'rw', isa => 'Bool', default => 0 ); # spent 2.01ms making 1 call to Moose::has |
35 | 1 | 2µs | 1 | 1.97ms | has 'dont_split_groups' => ( is => 'rw', isa => 'Bool', default => 0 ); # spent 1.97ms making 1 call to Moose::has |
36 | 1 | 2µs | 1 | 1.86ms | has 'verbose_stats' => ( is => 'rw', isa => 'Bool', default => 0 ); # spent 1.86ms making 1 call to Moose::has |
37 | 1 | 2µs | 1 | 3.38ms | has 'translation_table' => ( is => 'rw', isa => 'Int', default => 11 ); # spent 3.38ms making 1 call to Moose::has |
38 | 1 | 3µs | 1 | 2.28ms | has 'group_limit' => ( is => 'rw', isa => 'Num', default => 50000 ); # spent 2.28ms making 1 call to Moose::has |
39 | 1 | 2µs | 1 | 2.05ms | has '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] | ||||
42 | 1 | 1µs | my ($self) = @_; | ||
43 | |||||
44 | my ( | ||||
45 | 1 | 1µ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 | |||||
51 | 1 | 8µs | 2 | 2.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 | |||||
72 | 1 | 500ns | $self->help($help) if(defined($help)); | ||
73 | 1 | 4µs | 1 | 9µs | $self->job_runner($job_runner) if ( defined($job_runner) ); # spent 9µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::job_runner |
74 | 1 | 4µs | 1 | 10µs | $self->fasta_files($fasta_files) if ( defined($fasta_files) ); # spent 10µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::fasta_files |
75 | 1 | 3µs | 1 | 8µs | $self->input_files($input_files) if ( defined($input_files) ); # spent 8µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::input_files |
76 | 1 | 4µs | 1 | 8µs | $self->output_filename($output_filename) if ( defined($output_filename) ); # spent 8µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::output_filename |
77 | 1 | 4µs | 1 | 8µs | $self->output_pan_geneome_filename($output_pan_geneome_filename) if ( defined($output_pan_geneome_filename) ); # spent 8µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::output_pan_geneome_filename |
78 | 1 | 3µs | 1 | 8µs | $self->output_statistics_filename($output_statistics_filename) if ( defined($output_statistics_filename) ); # spent 8µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::output_statistics_filename |
79 | 1 | 400ns | $self->output_multifasta_files($output_multifasta_files) if ( defined($output_multifasta_files) ); | ||
80 | 1 | 3µs | 1 | 8µs | $self->clusters_filename($clusters_filename) if ( defined($clusters_filename) ); # spent 8µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::clusters_filename |
81 | 1 | 3µs | 1 | 8µs | $self->dont_delete_files($dont_delete_files) if ( defined($dont_delete_files) ); # spent 8µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::dont_delete_files |
82 | 1 | 4µs | 1 | 8µs | $self->dont_create_rplots($dont_create_rplots) if ( defined($dont_create_rplots) ); # spent 8µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::dont_create_rplots |
83 | 1 | 400ns | $self->dont_split_groups($dont_split_groups) if ( defined($dont_split_groups) ); | ||
84 | 1 | 300ns | $self->verbose_stats($verbose_stats) if ( defined($verbose_stats)); | ||
85 | 1 | 4µs | 1 | 20µs | $self->translation_table($translation_table) if ( defined($translation_table) ); # spent 20µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::translation_table |
86 | 1 | 3µs | 1 | 21µs | $self->cpus($cpus) if ( defined($cpus) ); # spent 21µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::cpus |
87 | 1 | 3µs | 1 | 20µs | $self->group_limit($group_limit) if ( defined($group_limit) ); # spent 20µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::group_limit |
88 | 1 | 12µs | 1 | 23µs | $self->core_definition( $core_definition/100 ) if ( defined($core_definition) ); # spent 23µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::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 | ||||
92 | 1 | 900ns | my ($self) = @_; | ||
93 | |||||
94 | 1 | 4µs | 1 | 4µs | ( !$self->help ) or die $self->usage_text; # spent 4µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::help |
95 | 1 | 4µs | 1 | 4µs | if ( defined( $self->_error_message ) ) { # spent 4µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::_error_message |
96 | print $self->_error_message . "\n"; | ||||
97 | die $self->usage_text; | ||||
98 | } | ||||
99 | |||||
100 | 1 | 45µs | 15 | 567µs | my $obj = Bio::Roary::PostAnalysis->new( # spent 297µs making 2 calls to Bio::Roary::CommandLine::RoaryPostAnalysis::_read_file_into_array, avg 148µs/call
# spent 230µs making 1 call to Bio::Roary::PostAnalysis::new
# spent 4µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::output_multifasta_files
# spent 4µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::verbose_stats
# spent 4µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::output_filename
# spent 4µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::dont_split_groups
# spent 4µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::input_files
# spent 3µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::clusters_filename
# spent 3µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::dont_create_rplots
# spent 3µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::dont_delete_files
# spent 3µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::group_limit
# spent 3µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::output_statistics_filename
# spent 3µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::output_pan_geneome_filename
# spent 3µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::fasta_files |
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 | ); | ||||
114 | 1 | 7µs | 1 | 56.5s | $obj->run(); # spent 56.5s making 1 call to Bio::Roary::PostAnalysis::run |
115 | |||||
116 | |||||
117 | 1 | 23µs | 1 | 16µs | if($self->output_multifasta_files == 1) # spent 16µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::output_multifasta_files |
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 | |||||
139 | sub _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 | |||||
148 | sub _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 | ||||
150 | 2 | 2µs | my ($self, $filename) = @_; | ||
151 | 2 | 111µs | 2 | 92µs | open(my $in_fh, $filename); # spent 92µs making 2 calls to Bio::Roary::CommandLine::RoaryPostAnalysis::CORE:open, avg 46µs/call |
152 | |||||
153 | 2 | 700ns | my @filenames; | ||
154 | 2 | 44µs | 2 | 30µs | while(<$in_fh>){ # spent 30µs making 2 calls to Bio::Roary::CommandLine::RoaryPostAnalysis::CORE:readline, avg 15µs/call |
155 | 16 | 5µs | chomp; | ||
156 | 16 | 6µs | my $line = $_; | ||
157 | 16 | 81µs | 16 | 17µs | push(@filenames, $line); # spent 17µs making 16 calls to Bio::Roary::CommandLine::RoaryPostAnalysis::CORE:readline, avg 1µs/call |
158 | } | ||||
159 | 2 | 45µs | return \@filenames; | ||
160 | } | ||||
161 | |||||
162 | sub 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 | |||||
184 | USAGE | ||||
185 | } | ||||
186 | |||||
187 | 1 | 6µs | 2 | 15.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 |
188 | 2 | 45µs | 2 | 236µ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 # spent 124µs making 1 call to Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@188
# spent 112µs making 1 call to Moose::unimport |
189 | 1 | 92µs | 1; |