lib/Bio/MUST/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
« lib/Bio/MUST/Drivers/Cap3.pm ↑ Summary lib/Bio/MUST/Drivers/Mafft.pm »
1 package Bio::MUST::Drivers::Blast::Database;
2 # ABSTRACT: Internal class for BLAST driver
3 5 $Bio::MUST::Drivers::Blast::Database::VERSION = '0.252830';
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  
15 5 has 'type' => (
16 is => 'ro',
17 isa => 'Str',
18 init_arg => undef,
19 writer => '_set_type',
20 );
21  
22 5 has 'remote' => (
23 is => 'ro',
24 isa => 'Bool',
25 default => 0,
26 );
27  
28 5 with 'Bio::MUST::Drivers::Roles::Blastable';
29  
30 # http://ncbiinsights.ncbi.nlm.nih.gov/2013/03/19/blastdbinfo-api-access-to-a-database-of-blast-databases/
31 # updated with ChatGPT in Sept 2024
32 5 my %type_for = (
33 core_nt => 'nucl', # Core nucleotide database (streamlined version of nt)
34 nt => 'nucl', # Non-redundant nucleotide sequences
35 refseq_rna => 'nucl', # RefSeq RNA sequences
36 refseq_genomic => 'nucl', # RefSeq genomic sequences
37 pdbnt => 'nucl', # Nucleotide sequences from the Protein Data Bank (PDB)
38 env_nt => 'nucl', # Non-redundant environmental nucleotide sequences
39 '16SMicrobial' => 'nucl', # 16S ribosomal RNA sequences (bacteria and archaea)
40 pat => 'nucl', # Nucleotide sequences from patents
41 tsa_nr => 'nucl', # Transcriptome Shotgun Assembly nucleotide sequences
42 wgs => 'nucl', # Whole Genome Shotgun contigs
43 est => 'nucl', # Expressed Sequence Tags
44 metagenomes => 'nucl', # Metagenomic nucleotide sequences
45 sra => 'nucl', # Sequence Read Archive
46 swissprot => 'prot', # Swiss-Prot manually curated protein sequences
47 nr => 'prot', # Non-redundant protein sequences
48 refseq_protein => 'prot', # RefSeq protein sequences
49 refseq_select => 'prot', # Streamlined RefSeq, one representative transcript per gene
50 pdbaa => 'prot', # Protein sequences from the PDB
51 env_nr => 'prot', # Non-redundant environmental protein sequences
52 pataa => 'prot', # Protein sequences from patents
53 );
54  
55 0 ▶sub BUILD {
Subroutine BUILD: not called CC=6 SCAR=37.4
Pod undocumented
56 0 my $self = shift;
57  
58 0 my $basename = $self->filename;
59  
60 # check for existence of BLAST database and set its type (nucl or prot)
61 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
62 0 $self->_set_type( $type_for{$basename} );
63 }
64 ▶ 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
65 0 $self->_set_type('prot');
66 }
67 ▶ 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
68 0 $self->_set_type('nucl');
69 }
70 else {
71 0 croak "[BMD] Error: BLAST database not found at $basename; aborting!";
72 }
73  
74 0 return;
75 }
76  
77 5 __PACKAGE__->meta->make_immutable;
78 5 1;
79  
80 __END__
« lib/Bio/MUST/Drivers/Cap3.pm ↑ Summary lib/Bio/MUST/Drivers/Mafft.pm »