| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::Roary::External::Makeblastdb; |
|
2
|
|
|
|
|
|
|
$Bio::Roary::External::Makeblastdb::VERSION = '3.10.1'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: Wrapper around NCBIs makeblastdb command |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
110892
|
use Moose; |
|
|
5
|
|
|
|
|
882077
|
|
|
|
5
|
|
|
|
|
36
|
|
|
7
|
5
|
|
|
5
|
|
40706
|
use File::Temp; |
|
|
5
|
|
|
|
|
34991
|
|
|
|
5
|
|
|
|
|
451
|
|
|
8
|
5
|
|
|
5
|
|
40
|
use Cwd; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
1840
|
|
|
9
|
|
|
|
|
|
|
with 'Bio::Roary::JobRunner::Role'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'fasta_file' => ( is => 'ro', isa => 'Str', required => 1 ); |
|
12
|
|
|
|
|
|
|
has 'exec' => ( is => 'ro', isa => 'Str', default => 'makeblastdb' ); |
|
13
|
|
|
|
|
|
|
has '_working_directory' => ( is => 'ro', isa => 'File::Temp::Dir', default => sub { File::Temp->newdir( DIR => getcwd, CLEANUP => 1 ); } ); |
|
14
|
|
|
|
|
|
|
has '_dbtype' => ( is => 'ro', isa => 'Str', default => 'prot' ); |
|
15
|
|
|
|
|
|
|
has '_logfile' => ( is => 'ro', isa => 'Str', default => '/dev/null' ); |
|
16
|
|
|
|
|
|
|
has 'output_database' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build_output_database' ); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Overload Role |
|
19
|
|
|
|
|
|
|
has 'memory_in_mb' => ( is => 'ro', isa => 'Int', default => 4000); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _build_output_database { |
|
22
|
4
|
|
|
4
|
|
19
|
my ($self) = @_; |
|
23
|
4
|
|
|
|
|
142
|
return join( '/', ( $self->_working_directory->dirname(), 'output_contigs' ) ); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _command_to_run { |
|
27
|
9
|
|
|
9
|
|
24
|
my ($self) = @_; |
|
28
|
9
|
|
|
|
|
407
|
return join( |
|
29
|
|
|
|
|
|
|
" ", |
|
30
|
|
|
|
|
|
|
( |
|
31
|
|
|
|
|
|
|
$self->exec, |
|
32
|
|
|
|
|
|
|
'-in', $self->fasta_file, |
|
33
|
|
|
|
|
|
|
'-dbtype', $self->_dbtype, |
|
34
|
|
|
|
|
|
|
'-out', $self->output_database, |
|
35
|
|
|
|
|
|
|
'-logfile', $self->_logfile |
|
36
|
|
|
|
|
|
|
) |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub run { |
|
41
|
4
|
|
|
4
|
0
|
494
|
my ($self) = @_; |
|
42
|
4
|
|
|
|
|
8
|
my @commands_to_run; |
|
43
|
4
|
|
|
|
|
17
|
push(@commands_to_run, $self->_command_to_run ); |
|
44
|
4
|
|
|
|
|
133
|
$self->logger->info( "Running command: " . $self->_command_to_run() ); |
|
45
|
4
|
|
|
|
|
178
|
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 ); |
|
46
|
4
|
|
|
|
|
25
|
$job_runner_obj->run(); |
|
47
|
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
555
|
1; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
5
|
|
|
5
|
|
50
|
no Moose; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
32
|
|
|
52
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
53
|
|
|
|
|
|
|
1; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=encoding UTF-8 |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Bio::Roary::External::Makeblastdb - Wrapper around NCBIs makeblastdb command |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
version 3.10.1 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Take in a fasta file and create a temporary blast database. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
use Bio::Roary::External::Makeblastdb; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $blast_database= Bio::Roary::External::Makeblastdb->new( |
|
76
|
|
|
|
|
|
|
fasta_file => 'contigs.fa', |
|
77
|
|
|
|
|
|
|
exec => 'makeblastdb' |
|
78
|
|
|
|
|
|
|
); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$blast_database->run(); |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 METHODS |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 output_database |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns the path to the temporary blast database files |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This is free software, licensed under: |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |