| Filename | /Users/ap13/pathogens/Roary/lib/Bio/Roary/External/ProteinMuscleAlignmentFromNucleotides.pm |
| Statements | Executed 15 statements in 570µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 48µs | 5.18ms | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@23 |
| 1 | 1 | 1 | 12µs | 124µs | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@88 |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::_build__core_alignment_cmd |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::_build__memory_required_in_mb |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::_command_to_run |
| 0 | 0 | 0 | 0s | 0s | Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::run |
| 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 | 438µs | 2 | 10.3ms | # spent 5.18ms (48µs+5.14) within Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@23 which was called:
# once (48µs+5.14ms) by Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@15 at line 23 # spent 5.18ms making 1 call to Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@23
# spent 5.14ms making 1 call to Moose::import |
| 24 | 1 | 3µs | 1 | 16.8ms | with 'Bio::Roary::JobRunner::Role'; # spent 16.8ms making 1 call to Moose::with |
| 25 | |||||
| 26 | 1 | 4µs | 1 | 1.63ms | has 'fasta_files' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); # spent 1.63ms making 1 call to Moose::has |
| 27 | 1 | 2µs | 1 | 1.52ms | has 'exec' => ( is => 'ro', isa => 'Str', default => 'protein_muscle_alignment_from_nucleotides' ); # spent 1.52ms making 1 call to Moose::has |
| 28 | 1 | 2µs | 1 | 1.85ms | has 'translation_table' => ( is => 'rw', isa => 'Int', default => 11 ); # spent 1.85ms making 1 call to Moose::has |
| 29 | 1 | 2µs | 1 | 1.51ms | has 'core_definition' => ( is => 'ro', isa => 'Num', default => 1 ); # spent 1.51ms making 1 call to Moose::has |
| 30 | |||||
| 31 | # Overload Role | ||||
| 32 | 1 | 2µs | 1 | 2.19ms | has '_memory_required_in_mb' => ( is => 'ro', isa => 'Int', lazy => 1, builder => '_build__memory_required_in_mb' ); # spent 2.19ms making 1 call to Moose::has |
| 33 | 1 | 2µs | 1 | 2.00ms | has '_queue' => ( is => 'rw', isa => 'Str', default => 'normal' ); # spent 2.00ms making 1 call to Moose::has |
| 34 | 1 | 2µs | 1 | 1.51ms | has '_files_per_chunk' => ( is => 'ro', isa => 'Int', default => 25 ); # spent 1.51ms making 1 call to Moose::has |
| 35 | 1 | 2µs | 1 | 3.97ms | has '_core_alignment_cmd' => ( is => 'rw', isa => 'Str', lazy_build => 1 ); # spent 3.97ms 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 | 58µs | 2 | 236µs | # spent 124µs (12+112) within Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@88 which was called:
# once (12µs+112µs) by Bio::Roary::CommandLine::RoaryPostAnalysis::BEGIN@15 at line 88 # spent 124µs making 1 call to Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::BEGIN@88
# spent 112µs making 1 call to Moose::unimport |
| 89 | 1 | 7µs | 2 | 9.35ms | __PACKAGE__->meta->make_immutable; # spent 9.33ms making 1 call to Class::MOP::Class::make_immutable
# spent 16µs making 1 call to Bio::Roary::External::ProteinMuscleAlignmentFromNucleotides::meta |
| 90 | 1 | 48µs | 1; |