line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Roary::External::Mcl; |
2
|
|
|
|
|
|
|
$Bio::Roary::External::Mcl::VERSION = '3.11.0'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Wrapper around MCL which takes in blast results and outputs clustered results |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
84568
|
use Moose; |
|
2
|
|
|
|
|
383570
|
|
|
2
|
|
|
|
|
11
|
|
7
|
2
|
|
|
2
|
|
12085
|
use File::Which; |
|
2
|
|
|
|
|
786
|
|
|
2
|
|
|
|
|
762
|
|
8
|
|
|
|
|
|
|
with 'Bio::Roary::JobRunner::Role'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'blast_results' => ( is => 'ro', isa => 'Str', required => 1 ); |
11
|
|
|
|
|
|
|
has 'mcxdeblast_exec' => ( is => 'ro', isa => 'Str', default => 'mcxdeblast' ); |
12
|
|
|
|
|
|
|
has '_full_mcxdeblast_exec' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__full_mcxdeblast_exec'); |
13
|
|
|
|
|
|
|
has 'mcl_exec' => ( is => 'ro', isa => 'Str', default => 'mcl' ); |
14
|
|
|
|
|
|
|
has 'output_file' => ( is => 'ro', isa => 'Str', default => 'output_groups' ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has '_score' => ( is => 'ro', isa => 'Str', default => 'r' ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'inflation_value' => ( is => 'ro', isa => 'Num', default => 1.5 ); |
19
|
|
|
|
|
|
|
has '_logging' => ( is => 'ro', isa => 'Str', default => '> /dev/null 2>&1' ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has 'memory_in_mb' => ( is => 'ro', isa => 'Int', lazy => 1, builder => '_build_memory_in_mb' ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _build_memory_in_mb |
24
|
|
|
|
|
|
|
{ |
25
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
#Â Todo: implement this equation for memory estimation if this hardcoded value proves too unstable. |
27
|
|
|
|
|
|
|
# http://micans.org/mcl/man/mcl.html#opt-how-much-ram |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
26
|
my $filename = $self->blast_results; |
30
|
1
|
|
|
|
|
2
|
my $memory_required = 2000; |
31
|
1
|
50
|
|
|
|
33
|
if(-e $filename) |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
|
|
0
|
$memory_required = -s $filename; |
34
|
|
|
|
|
|
|
# Convert to mb |
35
|
0
|
|
|
|
|
0
|
$memory_required = int($memory_required/1000000); |
36
|
|
|
|
|
|
|
# increase memory for worst case senario |
37
|
0
|
|
|
|
|
0
|
$memory_required *= 3; |
38
|
0
|
|
|
|
|
0
|
$memory_required += 2000; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
27
|
return $memory_required; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _build__full_mcxdeblast_exec |
46
|
|
|
|
|
|
|
{ |
47
|
2
|
|
|
2
|
|
6
|
my ($self) = @_; |
48
|
|
|
|
|
|
|
|
49
|
2
|
100
|
|
|
|
70
|
if(-e $self->mcxdeblast_exec) |
50
|
|
|
|
|
|
|
{ |
51
|
1
|
|
|
|
|
21
|
return $self->mcxdeblast_exec; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
45
|
my $full_exec = which($self->mcxdeblast_exec); |
55
|
1
|
50
|
|
|
|
343
|
if(! defined($full_exec)) |
56
|
|
|
|
|
|
|
{ |
57
|
1
|
|
|
|
|
49
|
$self->logger->error("Cannot find the mcxdeblast executable, please ensure its in your PATH") ; |
58
|
1
|
|
|
|
|
645
|
exit(); |
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
0
|
return "perl $full_exec"; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _command_to_run { |
64
|
4
|
|
|
4
|
|
10
|
my ($self) = @_; |
65
|
4
|
|
|
|
|
140
|
return join( |
66
|
|
|
|
|
|
|
" ", |
67
|
|
|
|
|
|
|
( |
68
|
|
|
|
|
|
|
$self->_full_mcxdeblast_exec, '-m9', '--score='.$self->_score, |
69
|
|
|
|
|
|
|
'--line-mode=abc', $self->blast_results, '2> /dev/null', |
70
|
|
|
|
|
|
|
'|', $self->mcl_exec, '-', '--abc', |
71
|
|
|
|
|
|
|
'-I', $self->inflation_value, '-o', $self->output_file, |
72
|
|
|
|
|
|
|
$self->_logging |
73
|
|
|
|
|
|
|
) |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub run { |
78
|
2
|
|
|
2
|
0
|
5
|
my ($self) = @_; |
79
|
2
|
|
|
|
|
6
|
my @commands_to_run; |
80
|
2
|
|
|
|
|
6
|
push(@commands_to_run, $self->_command_to_run ); |
81
|
1
|
|
|
|
|
23
|
$self->logger->info( "Running command: " . $self->_command_to_run() ); |
82
|
1
|
|
|
|
|
44
|
my $job_runner_obj = $self->_job_runner_class->new( commands_to_run => \@commands_to_run, memory_in_mb => $self->memory_in_mb, queue => $self->_queue, cpus => $self->cpus ); |
83
|
1
|
|
|
|
|
5
|
$job_runner_obj->run(); |
84
|
|
|
|
|
|
|
|
85
|
1
|
|
|
|
|
222
|
1; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
2
|
|
|
2
|
|
13
|
no Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
89
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=pod |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=encoding UTF-8 |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 NAME |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Bio::Roary::External::Mcl - Wrapper around MCL which takes in blast results and outputs clustered results |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 VERSION |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
version 3.11.0 |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 SYNOPSIS |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Wrapper around MCL which takes in blast results and outputs clustered results |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
use Bio::Roary::External::Mcl; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
my $mcl= Bio::Roary::External::Mcl->new( |
113
|
|
|
|
|
|
|
blast_results => 'db', |
114
|
|
|
|
|
|
|
mcxdeblast_exec => 'mcxdeblast', |
115
|
|
|
|
|
|
|
mcl_exec => 'mcl', |
116
|
|
|
|
|
|
|
output_file => 'output.groups' |
117
|
|
|
|
|
|
|
); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$mcl->run(); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This is free software, licensed under: |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |