line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::MLST::Blast::Database; |
2
|
|
|
|
|
|
|
# ABSTRACT: Wrapper around NCBIs makeblastdb command |
3
|
|
|
|
|
|
|
$Bio::MLST::Blast::Database::VERSION = '2.1.1630910'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Bio::MLST::Blast::Database; |
7
|
14
|
|
|
14
|
|
415860
|
use Moose; |
|
14
|
|
|
|
|
916101
|
|
|
14
|
|
|
|
|
155
|
|
8
|
14
|
|
|
14
|
|
103316
|
use File::Temp; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
1702
|
|
9
|
14
|
|
|
14
|
|
1906
|
use Bio::MLST::Types; |
|
14
|
|
|
|
|
30
|
|
|
14
|
|
|
|
|
642
|
|
10
|
14
|
|
|
14
|
|
105
|
use Cwd; |
|
14
|
|
|
|
|
31
|
|
|
14
|
|
|
|
|
4524
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# input variables |
13
|
|
|
|
|
|
|
has 'fasta_file' => ( is => 'ro', isa => 'Str', required => 1 ); |
14
|
|
|
|
|
|
|
has 'exec' => ( is => 'ro', isa => 'Bio::MLST::Executable', default => 'makeblastdb' ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Generated |
17
|
|
|
|
|
|
|
has '_working_directory' => ( is => 'ro', isa => 'File::Temp::Dir', default => sub { File::Temp->newdir(DIR => getcwd, CLEANUP => 1); }); |
18
|
|
|
|
|
|
|
has 'location' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build_location' ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _build_location |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
|
|
0
|
|
|
my($self) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $output_database = join('/',($self->_working_directory->dirname(),'output_contigs')); |
25
|
0
|
|
|
|
|
|
my $makeblastdb_cmd = join(" ",($self->exec, '-in', $self->fasta_file, '-dbtype nucl', '-parse_seqids', '-out', $output_database)); |
26
|
|
|
|
|
|
|
# FIXME: run this command in a more sensible fashion |
27
|
0
|
|
|
|
|
|
`$makeblastdb_cmd`; |
28
|
0
|
|
|
|
|
|
return $output_database; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
14
|
|
|
14
|
|
103
|
no Moose; |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
117
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding UTF-8 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Bio::MLST::Blast::Database - Wrapper around NCBIs makeblastdb command |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 VERSION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
version 2.1.1630910 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Take in a fasta file and create a temporary blast database. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
use Bio::MLST::Blast::Database; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $blast_database= Bio::MLST::Blast::Database->new( |
56
|
|
|
|
|
|
|
fasta_file => 'contigs.fa', |
57
|
|
|
|
|
|
|
exec => 'makeblastdb' |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$blast_database->location(); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 location |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Returns the path to the temporary blast database files |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over 4 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
L<Bio::MLST::Blast::BlastN> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=back |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by Wellcome Trust Sanger Institute. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This is free software, licensed under: |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |