| 1 | package Bio::MUST::Drivers::Blast::Database::Temporary; | ||||||||||
| 2 | # ABSTRACT: Internal class for BLAST driver | ||||||||||
| 3 | 5 | $Bio::MUST::Drivers::Blast::Database::Temporary::VERSION = '0.210160'; | |||||||||
| 4 | 5 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 5 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 5 | ▶ | use autodie; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 5 | ▶ | use feature qw(say); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 5 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 5 | ▶ | use IPC::System::Simple qw(system); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 5 | ▶ | use Module::Runtime qw(use_module); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 5 | ▶ | use Path::Class qw(file); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 5 | extends 'Bio::MUST::Core::Ali::Temporary'; | |||||||||
| 16 | |||||||||||
| 17 | 5 | with 'Bio::MUST::Drivers::Roles::Blastable'; | |||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | # overload equivalent attribute in plain Database | ||||||||||
| 21 | sub remote { | ||||||||||
| 22 | 0 | ▶ | return 0; | ||||||||
|
Subroutine
remote: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | sub BUILD { | ||||||||||
| 26 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
BUILD: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 27 | |||||||||||
| 28 | # provision executable | ||||||||||
| 29 | 0 | my $app = use_module('Bio::MUST::Provision::Blast')->new; | |||||||||
| 30 | 0 | $app->meet(); | |||||||||
| 31 | |||||||||||
| 32 | 0 | my $in = $self->filename; | |||||||||
| 33 | 0 | my $dbtype = $self->type; | |||||||||
| 34 | |||||||||||
| 35 | # create makeblastdb command | ||||||||||
| 36 | 0 | my $pgm = file($ENV{BMD_BLAST_BINDIR}, 'makeblastdb'); | |||||||||
| 37 | 0 | my $cmd = "$pgm -in $in -dbtype $dbtype > /dev/null 2> /dev/null"; | |||||||||
| 38 | |||||||||||
| 39 | # try to robustly execute makeblastdb | ||||||||||
| 40 | 0 | my $ret_code = system( [ 0, 127 ], $cmd); | |||||||||
| 41 | 0 | ▶ | if ($ret_code == 127) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | # TODO: do something to abort construction | ||||||||||
| 43 | 0 | carp "[BMD] Warning: cannot execute $pgm command; returning!"; | |||||||||
| 44 | 0 | return; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 0 | return; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | sub DEMOLISH { | ||||||||||
| 51 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
DEMOLISH: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 52 | |||||||||||
| 53 | # unlink temp files | ||||||||||
| 54 | 0 | my $basename = $self->filename; | |||||||||
| 55 | 0 | ▶ | my @suffices = $self->type eq 'prot' ? qw(phr pin psq) : qw(nhr nin nsq); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 0 | file($_)->remove for map { "$basename.$_" } @suffices; | |||||||||
| 57 | |||||||||||
| 58 | 0 | return; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 5 | __PACKAGE__->meta->make_immutable; | |||||||||
| 62 | 5 | 1; | |||||||||
| 63 | |||||||||||
| 64 | __END__ | ||||||||||
| 65 | |||||||||||
| 66 | =pod | ||||||||||
| 67 | |||||||||||
| 68 | =head1 NAME | ||||||||||
| 69 | |||||||||||
| 70 | Bio::MUST::Drivers::Blast::Database::Temporary - Internal class for BLAST driver | ||||||||||
| 71 | |||||||||||
| 72 | =head1 VERSION | ||||||||||
| 73 | |||||||||||
| 74 | version 0.210160 | ||||||||||
| 75 | |||||||||||
| 76 | =head1 SYNOPSIS | ||||||||||
| 77 | |||||||||||
| 78 | # TODO | ||||||||||
| 79 | |||||||||||
| 80 | =head1 DESCRIPTION | ||||||||||
| 81 | |||||||||||
| 82 | # TODO | ||||||||||
| 83 | |||||||||||
| 84 | =head1 AUTHOR | ||||||||||
| 85 | |||||||||||
| 86 | Denis BAURAIN <denis.baurain@uliege.be> | ||||||||||
| 87 | |||||||||||
| 88 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 89 | |||||||||||
| 90 | This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN. | ||||||||||
| 91 | |||||||||||
| 92 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 93 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 94 | |||||||||||
| 95 | =cut | ||||||||||