line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Roary::External::Mafft; |
2
|
|
|
|
|
|
|
$Bio::Roary::External::Mafft::VERSION = '3.10.2'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Wrapper to run mafft |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
751
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
18
|
|
7
|
2
|
|
|
2
|
|
12474
|
use File::Spec; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
508
|
|
8
|
|
|
|
|
|
|
with 'Bio::Roary::JobRunner::Role'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'input_filename' => ( is => 'ro', isa => 'Str', required => 1 ); |
11
|
|
|
|
|
|
|
has 'output_filename' => ( is => 'ro', isa => 'Str', default => 'output' ); |
12
|
|
|
|
|
|
|
has 'exec' => ( is => 'ro', isa => 'Str', default => 'mafft' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Overload Role |
15
|
|
|
|
|
|
|
has 'memory_in_mb' => ( is => 'ro', isa => 'Int', lazy => 1, builder => '_build_memory_in_mb' ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _build_memory_in_mb { |
18
|
1
|
|
|
1
|
|
3
|
my ($self) = @_; |
19
|
1
|
|
|
|
|
3
|
my $memory_required = 2000; |
20
|
1
|
|
|
|
|
31
|
return $memory_required; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _command_to_run { |
24
|
3
|
|
|
3
|
|
5
|
my ($self) = @_; |
25
|
|
|
|
|
|
|
|
26
|
3
|
50
|
|
|
|
75
|
if(! -e $self->input_filename) |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
|
|
0
|
$self->logger->error( "Input file to MAFFT missing: " . $self->input_filename ); |
29
|
|
|
|
|
|
|
} |
30
|
3
|
|
|
|
|
61
|
return join( |
31
|
|
|
|
|
|
|
' ', |
32
|
|
|
|
|
|
|
( |
33
|
|
|
|
|
|
|
$self->exec, |
34
|
|
|
|
|
|
|
'--auto', |
35
|
|
|
|
|
|
|
'--quiet', |
36
|
|
|
|
|
|
|
$self->input_filename, |
37
|
|
|
|
|
|
|
'>', |
38
|
|
|
|
|
|
|
$self->output_filename |
39
|
|
|
|
|
|
|
) |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub run { |
44
|
1
|
|
|
1
|
0
|
3
|
my ($self) = @_; |
45
|
1
|
|
|
|
|
22
|
my @commands_to_run; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
3
|
push( @commands_to_run, $self->_command_to_run() ); |
48
|
1
|
|
|
|
|
21
|
$self->logger->info( "Running command: " . $self->_command_to_run() ); |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
31
|
my $job_runner_obj = $self->_job_runner_class->new( |
51
|
|
|
|
|
|
|
commands_to_run => \@commands_to_run, |
52
|
|
|
|
|
|
|
memory_in_mb => $self->memory_in_mb, |
53
|
|
|
|
|
|
|
queue => $self->_queue, |
54
|
|
|
|
|
|
|
cpus => $self->cpus |
55
|
|
|
|
|
|
|
); |
56
|
1
|
|
|
|
|
7
|
$job_runner_obj->run(); |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
149
|
1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
|
2
|
|
14
|
no Moose; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
8
|
|
62
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=encoding UTF-8 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 NAME |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Bio::Roary::External::Mafft - Wrapper to run mafft |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 VERSION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
version 3.10.2 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SYNOPSIS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Wrapper to run mafft |
83
|
|
|
|
|
|
|
use Bio::Roary::External::Mafft; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $mafft_obj = Bio::Roary::External::Mafft->new( |
86
|
|
|
|
|
|
|
input_filename => $fasta_file, |
87
|
|
|
|
|
|
|
output_filename => $fasta_file.'.aln', |
88
|
|
|
|
|
|
|
job_runner => 'Local' |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
$mafft_obj->run(); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software, licensed under: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |