Drivers/Blast/Database.pm

filter: Statementstmt 74.1% 23 / 31 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 51.8% 28 / 54 CC 6 SCAR 31.5
CC
6
Cov
53%
BUILD
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 23.4
« Drivers/Cap3.pm ↑ Summary Drivers/Exonerate/Aligned.pm »
1 package Bio::MUST::Drivers::Blast::Database;
2 # ABSTRACT: Internal class for BLAST driver
3 5 $Bio::MUST::Drivers::Blast::Database::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  
12 5 extends 'Bio::FastParsers::Base';
13  
14 # TODO: warn user that we need to build db with -parse_seqids
15  
16 5 has 'type' => (
17 is => 'ro',
18 isa => 'Str',
19 init_arg => undef,
20 writer => '_set_type',
21 );
22  
23 5 has 'remote' => (
24 is => 'ro',
25 isa => 'Bool',
26 default => 0,
27 );
28  
29 5 with 'Bio::MUST::Drivers::Roles::Blastable';
30  
31 # TODO: complete this with list of NCBI databases
32 # http://ncbiinsights.ncbi.nlm.nih.gov/2013/03/19/\
33 # blastdbinfo-api-access-to-a-database-of-blast-databases/
34 5 my %type_for = ( # cannot be made constant to allow undefined keys
35 nt => 'nucl',
36 nr => 'prot',
37 );
38  
39 sub BUILD {
40 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=6 SCAR=37.4
Pod undocumented
41  
42 0 my $basename = $self->filename;
43  
44 # check for existence of BLAST database and set its type (nucl or prot)
45 0 ▶ if ($self->remote) {
Branch: 3 branches
BranchTrueFalseTotal
if ($self->remote) { } 0 0 0
elsif (-e "$basename.psq" or -e "$basename.pal") { } 0 0 0
elsif (-e "$basename.nsq" or -e "$basename.nal") { } 0 0 0
46 0 $self->_set_type( $type_for{$basename} );
47 }
48 ▶ elsif (-e "$basename.psq" || -e "$basename.pal") {
Condition0%0/3
-e "$basename.psq" or -e "$basename.pal"
l!l&&r!l&&!r
000
MC/DC0%0/2
-e "$basename.psq" or -e "$basename.pal"
-e "$basename.psq" -e "$basename.pal"
Truth table0%0/3
A or B
A= -e "$basename.psq"B= -e "$basename.pal"
ABresult
1X1
011
000
49 0 $self->_set_type('prot');
50 }
51 ▶ elsif (-e "$basename.nsq" || -e "$basename.nal") {
Condition0%0/3
-e "$basename.nsq" or -e "$basename.nal"
l!l&&r!l&&!r
000
MC/DC0%0/2
-e "$basename.nsq" or -e "$basename.nal"
-e "$basename.nsq" -e "$basename.nal"
Truth table0%0/3
A or B
A= -e "$basename.nsq"B= -e "$basename.nal"
ABresult
1X1
011
000
52 0 $self->_set_type('nucl');
53 }
54 else {
55 0 croak "[BMD] Error: BLAST database not found at $basename; aborting!";
56 }
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 - 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
« Drivers/Cap3.pm ↑ Summary Drivers/Exonerate/Aligned.pm »