Filename | /Users/ap13/pathogens/Roary/lib/Bio/Roary/External/ProteinMuscleAlignmentFromNucleotides.pm |
Statements | Executed 15 statements in 514µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 48µs | 4.42ms | BEGIN@23 | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::
1 | 1 | 1 | 11µs | 110µs | BEGIN@88 | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::
0 | 0 | 0 | 0s | 0s | _build__core_alignment_cmd | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::
0 | 0 | 0 | 0s | 0s | _build__memory_required_in_mb | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::
0 | 0 | 0 | 0s | 0s | _command_to_run | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::
0 | 0 | 0 | 0s | 0s | run | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides; | ||||
2 | |||||
3 | # ABSTRACT: Take in a multifasta file of nucleotides, convert to proteins and align with muscle | ||||
4 | |||||
5 | =head1 SYNOPSIS | ||||
6 | |||||
7 | Take in a multifasta file of nucleotides, convert to proteins and align with muscle | ||||
8 | |||||
9 | use Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides; | ||||
10 | |||||
11 | my $seg = Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides->new( | ||||
12 | fasta_files => [], | ||||
13 | ); | ||||
14 | |||||
15 | $seg->run(); | ||||
16 | |||||
17 | =method output_file | ||||
18 | |||||
19 | Returns the path to the results file | ||||
20 | |||||
21 | =cut | ||||
22 | |||||
23 | 2 | 385µs | 2 | 8.79ms | # spent 4.42ms (48µs+4.37) within Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@23 which was called:
# once (48µs+4.37ms) by Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@15 at line 23 # spent 4.42ms making 1 call to Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@23
# spent 4.37ms making 1 call to Moose::import |
24 | 1 | 3µs | 1 | 16.9ms | with 'Bio::Roary::JobRunner::Role'; # spent 16.9ms making 1 call to Moose::with |
25 | |||||
26 | 1 | 4µs | 1 | 1.72ms | has 'fasta_files' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); # spent 1.72ms making 1 call to Moose::has |
27 | 1 | 2µs | 1 | 1.53ms | has 'exec' => ( is => 'ro', isa => 'Str', default => 'protein_muscle_alignment_from_nucleotides' ); # spent 1.53ms making 1 call to Moose::has |
28 | 1 | 2µs | 1 | 2.72ms | has 'translation_table' => ( is => 'rw', isa => 'Int', default => 11 ); # spent 2.72ms making 1 call to Moose::has |
29 | 1 | 2µs | 1 | 1.72ms | has 'core_definition' => ( is => 'ro', isa => 'Num', default => 1 ); # spent 1.72ms making 1 call to Moose::has |
30 | |||||
31 | # Overload Role | ||||
32 | 1 | 2µs | 1 | 2.23ms | has '_memory_required_in_mb' => ( is => 'ro', isa => 'Int', lazy => 1, builder => '_build__memory_required_in_mb' ); # spent 2.23ms making 1 call to Moose::has |
33 | 1 | 2µs | 1 | 2.17ms | has '_queue' => ( is => 'rw', isa => 'Str', default => 'normal' ); # spent 2.17ms making 1 call to Moose::has |
34 | 1 | 2µs | 1 | 1.59ms | has '_files_per_chunk' => ( is => 'ro', isa => 'Int', default => 25 ); # spent 1.59ms making 1 call to Moose::has |
35 | 1 | 2µs | 1 | 4.22ms | has '_core_alignment_cmd' => ( is => 'rw', isa => 'Str', lazy_build => 1 ); # spent 4.22ms making 1 call to Moose::has |
36 | |||||
37 | sub _build__memory_required_in_mb { | ||||
38 | my ($self) = @_; | ||||
39 | my $memory_required = 5000; | ||||
40 | return $memory_required; | ||||
41 | } | ||||
42 | |||||
43 | sub _command_to_run { | ||||
44 | my ( $self, $fasta_files, ) = @_; | ||||
45 | return $self->exec. " -t ".$self->translation_table." ". join( " ", @{$fasta_files} ); | ||||
46 | } | ||||
47 | |||||
48 | sub _build__core_alignment_cmd { | ||||
49 | my ( $self ) = @_; | ||||
50 | |||||
51 | my $core_cmd = "pan_genome_core_alignment"; | ||||
52 | $core_cmd .= " -cd " . ($self->core_definition*100) if ( defined $self->core_definition ); | ||||
53 | return $core_cmd; | ||||
54 | } | ||||
55 | |||||
56 | sub run { | ||||
57 | my ($self) = @_; | ||||
58 | my @commands_to_run; | ||||
59 | |||||
60 | my @files_chunk; | ||||
61 | for my $fasta_file ( @{ $self->fasta_files } ) { | ||||
62 | push(@files_chunk,$fasta_file); | ||||
63 | if(@files_chunk == $self->_files_per_chunk ) | ||||
64 | { | ||||
65 | push(@commands_to_run, $self->_command_to_run(\@files_chunk)); | ||||
66 | @files_chunk = (); | ||||
67 | } | ||||
68 | } | ||||
69 | |||||
70 | if(@files_chunk > 0) | ||||
71 | { | ||||
72 | push(@commands_to_run, $self->_command_to_run(\@files_chunk)); | ||||
73 | } | ||||
74 | |||||
75 | my $job_runner_obj = $self->_job_runner_class->new( | ||||
76 | commands_to_run => \@commands_to_run, | ||||
77 | memory_in_mb => $self->_memory_required_in_mb, | ||||
78 | queue => $self->_queue, | ||||
79 | dont_wait => 1, | ||||
80 | cpus => $self->cpus | ||||
81 | ); | ||||
82 | $job_runner_obj->run(); | ||||
83 | |||||
84 | $job_runner_obj->submit_dependancy_job($self->_core_alignment_cmd); | ||||
85 | 1; | ||||
86 | } | ||||
87 | |||||
88 | 2 | 49µs | 2 | 209µs | # spent 110µs (11+99) within Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@88 which was called:
# once (11µs+99µs) by Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@15 at line 88 # spent 110µs making 1 call to Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@88
# spent 99µs making 1 call to Moose::unimport |
89 | 1 | 8µs | 2 | 9.23ms | __PACKAGE__->meta->make_immutable; # spent 9.20ms making 1 call to Class::MOP::Class::make_immutable
# spent 22µs making 1 call to Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::meta |
90 | 1 | 49µs | 1; |