« blib/lib/Bio/Tools/Run/Infernal.pm
↑ Summary
blib/lib/Bio/Tools/Run/StandAloneBlastPlus/BlastMethods.pm »
| 1 | # $Id$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # BioPerl module for Bio::Tools::Run::StandAloneBlastPlus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Cared for by Mark A. Jensen <maj -at- fortinbras -dot- us> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # Copyright Mark A. Jensen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | Bio::Tools::Run::StandAloneBlastPlus - Compute with NCBI's blast+ suite *ALPHA* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | B<NOTE>: This module is related to the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | L<Bio::Tools::Run::StandAloneBlast> system in name (and inspiration) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | only. You must use this module directly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # existing blastdb: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | -db_name => 'mydb' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # create blastdb from fasta file and attach | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | -db_name => 'mydb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | -db_data => 'myseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # create blastdb from BioPerl sequence collection objects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | $alnio = Bio::AlignIO->new( -file => 'alignment.msf' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | -db_name => 'mydb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | -db_data => $alnio, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | @seqs = $alnio->next_aln->each_seq; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | -db_name => 'mydb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | -db_data => \@seqs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # create database with masks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | -db_name => 'my_masked_db', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | -db_data => 'myseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | -masker => 'dustmasker', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | -mask_data => 'maskseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # create a mask datafile separately | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | $mask_file = $fac->make_mask( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | -data => 'maskseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | -masker => 'dustmasker' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # query database for metadata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | $info_hash = $fac->db_info; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | $num_seq = $fac->db_num_sequences; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | @mask_metadata = @{ $fac->db_filter_algorithms }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # perform blast methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | $result = $fac->tblastn( -query => $seqio ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # see Bio::Tools::Run::StandAloneBlastPlus::BlastMethods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # for many more details | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | B<NOTE:> This module requires BLAST+ v. 2.2.24+ and higher. Until the API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | stabilizes for BLAST+, consider this module highly experimental. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | This module along with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | L<Bio::Tools::Run::StandAloneBlastPlus::BlastMethods> allows the user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | to perform BLAST functions using the external program suite C<blast+> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | (available at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | L<ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/>), using | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | BioPerl objects and L<Bio::SearchIO> facilities. This wrapper can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | prepare BLAST databases as well as run BLAST searches. It can also be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | used to run C<blast+> programs independently. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | This module encapsulates object construction and production of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | databases and masks. Blast analysis methods (C<blastp, psiblast>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | etc>) are contained in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | L<Bio::Tools::Run::StandAloneBlastPlus::BlastMethods>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | =head1 USAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | The basic mantra is to (1) create a BlastPlus factory using the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | C<new()> constructor, and (2) perform BLAST analyses by calling the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | desired BLAST program by name off the factory object. The blast | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | database itself and any masking data are attached to the factory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | object (step 1). Query sequences and any parameters associated with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | particular programs are provided to the blast method call (step 2), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | and are run against the attached database. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | =head2 Factory construction/initialization | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | The factory needs to be told where the blast+ programs live. The | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | C<BLASTPLUSDIR> environment variable will be checked for the default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | executable directory. The program directory can be set for individual | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | factory instances with the C<PROG_DIR> parameter. All the blast+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | programs must be accessible from that directory (i.e., as executable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | files or symlinks). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | Either the database or BLAST subject data must be specified at object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | construction. Databases can be pre-existing formatted BLAST dbs, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | can be built directly from fasta sequence files or BioPerl sequence | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | object collections of several kinds. The key constructor parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | are C<DB_NAME>, C<DB_DATA>, C<DB_DIR>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | To specify a pre-existing BLAST database, use C<DB_NAME> alone: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | -DB_NAME => 'mydb' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | The directory can be specified along with the basename, or separately | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | with C<DB_DIR>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | -DB_NAME => '~/home/blast/mydb' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | #same as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | -DB_NAME => 'mydb', -DB_DIR => '~/home/blast' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | To create a BLAST database de novo, see L</Creating a BLAST database>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | If you wish to apply pre-existing mask data (i.e., the final ASN1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | output from one of the blast+ masker programs), to the database before | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | querying, specify it with C<MASK_FILE>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | -DB_NAME => 'mydb', -MASK_FILE => 'mymaskdata.asn' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | =head2 Creating a BLAST database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | There are several options for creating the database de novo using | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | attached data, both before and after factory construction. If a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | temporary database (one that can be deleted by the C<cleanup()> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | method) is desired, leave out the C<-db_name> parameter. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | C<-db_name> is specified, the database will be preserved with the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | basename specified. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | Use C<-create => 1> to create a new database (otherwise the factory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | will look for an existing database). Use C<-overwrite => 1> to create | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | and overwrite an existing database. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | Note that the database is not created immediately on factory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | construction. It will be created if necessary on the first use of a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | factory BLAST method, or you can force database creation by executing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | $fac->make_db(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | =item * Specify data during construction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | With a FASTA file: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | -db_name => 'mydb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | -db_data => 'myseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | With another BioPerl object collection: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | $alnio = Bio::AlignIO->new( -file => 'alignment.msf' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | -db_name => 'mydb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | -db_data => $alnio, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | @seqs = $alnio->next_aln->each_seq; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | -db_name => 'mydb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | -db_data => \@seqs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | Other collections (e.g., L<Bio::SeqIO>) are valid. If a certain type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | does not work, please submit an enhancement request. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | To create temporary databases, leave out the C<-db_name>, e.g. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | -db_data => 'myseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | To get the tempfile basename, do: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | $dbname = $fac->db; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | =item * Specify data post-construction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | Use the explict attribute setters: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | $fac->set_db_data('myseqs.fas'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | $fac->make_db; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | =head2 Creating and using mask data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | The blast+ mask utilities C<windowmasker>, C<segmasker>, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | C<dustmasker> are available. Masking can be rolled into database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | creation, or can be executed later. If your mask data is already | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | created and in ASN1 format, set the C<-mask_file> attribute on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | construction (see L</Factory constuction/initialization>). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | To create a mask from raw data or an existing database and apply the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | mask upon database creation, construct the factory like so: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | -db_name => 'my_masked_db', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | -db_data => 'myseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | -masker => 'dustmasker', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | -mask_data => 'maskseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | The masked database will be created during C<make_db>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | The C<-mask_data> parameter can be a FASTA filename or any BioPerl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | sequence object collection. If the datatype ('nucl' or 'prot') of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | mask data is not compatible with the selected masker, an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | will be thrown with a message to that effect. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | To create a mask ASN1 file that can be used in the C<-mask_file> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | parameter separately from the attached database, use the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | C<make_mask()> method directly: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | $mask_file = $fac->make_mask(-data => 'maskseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | -masker => 'dustmasker'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | # segmasker can use a blastdb as input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | $mask_file = $fac->make_mask(-mask_db => 'mydb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | -masker => 'segmasker') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | -db_name => 'my_masked_db', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | -db_data => 'myseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | -mask_file => $mask_file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | =head2 Getting database information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | To get a hash containing useful metadata on an existing database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | (obtained by running C<blastdbcmd -info>, use C<db_info()>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # get info on the attached database.. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | $info = $fac->db_info; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | # get info on another database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | $info = $fac->db_info('~/home/blastdbs/another'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | To get a particular info element for the attached database, just call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | the element name off the factory: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | $num_seqs = $fac->db_num_sequences; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # info on all the masks applied to the db, if any: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | @masking_info = @{ $fac->db_filter_algorithms }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | =head2 Accessing the L<Bio::Tools::Run::BlastPlus> factory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | The blast+ programs are actually executed by a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | L<Bio::Tools::Run::BlastPlus> wrapper instance. This instance is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | available for peeking and poking in the L<StandAloneBlastPlus> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | C<factory()> attribute. For convenience, C<BlastPlus> methods can be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | run from the C<StandAloneBlastPlus> object, and are delegated to the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | C<factory()> attribute. For example, to get the blast+ program to be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | executed, examine either | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | $fac->factory->command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | $fac->command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | Similarly, the current parameters for the C<BlastPlus> factory are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | @parameters = $fac->get_parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | =head2 Cleaning up temp files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | Temporary analysis files produced under a single factory instances can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | be unlinked by running | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | $fac->cleanup; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | Tempfiles are generally not removed unless this method is explicitly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | called. C<cleanup()> only unlinks "registered" files and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | databases. All temporary files are automatically registered; in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | particular, "anonymous" databases (such as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | $fac->Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | -db_data => 'myseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | without a C<-db_name> specification) are registered for cleanup. Any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | file or database can be registered with an internal method: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | $fac->_register_temp_for_cleanup('testdb'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | =head2 Other Goodies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | =item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | You can check whether a given basename points to a properly formatted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | BLAST database by doing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | $is_good = $fac->check_db('putative_db'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | =item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | User parameters can be passed to the underlying blast+ programs (if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | you know what you're doing) with C<db_make_args> and C<mask_make_args>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | $fac = Bio::Tools::Run::StandAloneBlastPlus->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | -db_name => 'customdb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | -db_data => 'myseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | -db_make_args => [ '-taxid_map' => 'seq_to_taxa.txt' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | -masker => 'windowmasker', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | -mask_data => 'myseqs.fas', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | -mask_make_args => [ '-dust' => 'T' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | -create => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | =item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | You can prevent exceptions from being thrown by failed blast+ program | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | executions by setting C<no_throw_on_crash>. Examine the error with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | C<stderr()>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | $fac->no_throw_on_crash(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | $fac->make_db; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | if ($fac->stderr =~ /Error:/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | #handle error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | L<Bio::Tools::Run::StandAloneBlastPlus::BlastMethods>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | L<Bio::Tools::Run::BlastPlus> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | L<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | of the bugs and their resolution. Bug reports can be submitted via | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | the web: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | http://redmine.open-bio.org/projects/bioperl/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | =head1 AUTHOR - Mark A. Jensen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | Email maj -at- fortinbras -dot- us | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | =head1 CONTRIBUTORS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | package Bio::Tools::Run::StandAloneBlastPlus; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 1 | our $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # Object preamble - inherits from Bio::Root::Root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 1 | ▶ | use lib '../../..'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 1 | ▶ | use Bio::Root::Root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 1 | ▶ | use Bio::SeqIO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 1 | ▶ | use Bio::Tools::GuessSeqFormat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 1 | ▶ | use Bio::Tools::Run::StandAloneBlastPlus::BlastMethods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 1 | ▶ | use File::Temp 0.22; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 1 | ▶ | use IO::String; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 1 | ▶ | use base qw(Bio::Root::Root); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 1 | ▶ | unless ( eval "require Bio::Tools::Run::BlastPlus" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | Bio::Root::Root->throw("This module requires 'Bio::Tools::Run::BlastPlus'"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 1 | my %AVAILABLE_MASKERS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 'windowmasker' => 'nucl', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 'dustmasker' => 'nucl', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 'segmasker' => 'prot' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 1 | my %MASKER_ENCODING = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 'windowmasker' => 'maskinfo_asn1_text', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 'dustmasker' => 'maskinfo_asn1_text', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 'segmasker' => 'maskinfo_asn1_text' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 1 | my $bp_class = 'Bio::Tools::Run::BlastPlus'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | # what's the desire here? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # * factory object (created by new()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | # - points to some blast db entity, so all functions run off the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | # the factory (except bl2seq?) use the associated db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # * create a blast formatted database: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # - specify a file, or an AlignI object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | # - store for later, or store in a tempfile to throw away | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # - object should store its own database pointer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # - provide masking options based on the maskers provided | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # * perform database actions via db-oriented blast+ commands | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # via the object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # * perform blast searches against the database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | # - blastx, blastp, blastn, tblastx, tblastn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # - specify Bio::Seq objects or files as queries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # - output the results as a file or as a Bio::Search::Result::BlastResult | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # * perform 'special' (i.e., ones I don't know) searches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # - psiblast, megablast, rpsblast, rpstblastn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | # some of these are "tasks" under particular programs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # check out psiblast, why special (special 'iteration' handling in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # ...::BlastResult) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | # check out rpsblast, megablast | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # * perform bl2seq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | # - return the alignment directly as a convenience, using Bio::Search | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # lazy db formatting: makeblastdb only on first blast request... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # ParameterBaseI delegation : use AUTOLOAD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | Title : new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | Usage : my $obj = new Bio::Tools::Run::StandAloneBlastPlus(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | Function: Builds a new Bio::Tools::Run::StandAloneBlastPlus object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | Returns : an instance of Bio::Tools::Run::StandAloneBlastPlus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | Args : named argument (key => value) pairs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | -db : blastdb name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | my ($class,@args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=30 SCAR=68.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my ($db_name, $db_data, $db_dir, $db_make_args, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | $mask_file, $mask_data, $mask_make_args, $masker, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | $create, $overwrite, $is_remote, $prog_dir, $program_dir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | = $self->_rearrange([qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | DB_NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | DB_DATA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | DB_DIR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | DB_MAKE_ARGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | MASK_FILE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | MASK_DATA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | MASK_MAKE_ARGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | MASKER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | CREATE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | OVERWRITE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | REMOTE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | PROG_DIR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | PROGRAM_DIR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | )], @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | # parm taint checks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | if ($db_name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | $self->throw("DB name contains invalid characters") unless $db_name =~ m{^[a-z0-9_/:.+-]+$}i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | if ( $db_dir ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | $self->throw("DB directory (DB_DIR) not found") unless (-d $db_dir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | $self->{'_db_dir'} = $db_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | $self->{'_db_dir'} = '.'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | $program_dir ||= $prog_dir; # alias | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$program_dir ||= $prog_dir
MC/DC0%0/2
$program_dir ||= $prog_dir
$program_dir
$prog_dir
Truth table0%0/3
A ||= B
A= $program_dirB= $prog_dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | # now handle these systematically (bug #3003) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | # allow db_name to include path info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # let db_dir act as root if present and db_name is a relative path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | # db property contains the pathless name only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | if ($db_name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | my ($v,$d,$f) = File::Spec->splitpath($db_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | $self->throw("No DB name at the end of path '$db_name'") unless $f; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $f =~ s/\..*$//; # tolerant of extensions, but ignore them | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | $self->{_db} = $f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # now establish db_path property as the internal authority on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # db location... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | if ( File::Spec->file_name_is_absolute($db_name) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | $self->throw("Path specified in DB name ('$d') does not exist") unless !$d || (-d $d); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $d or -d $d
MC/DC0%0/2
not $d or -d $d
not $d
-d $d
Truth table0%0/3
not(A) or B
A= not $dB= -d $d
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $self->{_db_path} = File::Spec->catfile($d,$f); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $self->{_db_dir} = $d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | # ignore $db_dir, give heads-up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | $self->warn("DB name is an absolute path; setting db_dir to '".$self->db_dir."'") if $db_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | $d = File::Spec->catdir($self->db_dir, $d); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | $self->throw("Path specified by DB_DIR+DB_NAME ('$d') does not exist") unless !$d || (-d $d); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $d or -d $d
MC/DC0%0/2
not $d or -d $d
not $d
-d $d
Truth table0%0/3
not(A) or B
A= not $dB= -d $d
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $self->{_db_path} = File::Spec->catfile($d,$f); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | if ($masker) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | $self->throw("Masker '$masker' not available") unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | grep /^$masker$/, keys %AVAILABLE_MASKERS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $self->{_masker} = $masker; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | if ($program_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | $self->throw("Can't find program directory '$program_dir'") unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | -d $program_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $self->{_program_dir} = $program_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | elsif ($ENV{BLASTPLUSDIR}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | $self->{_program_dir} = $ENV{BLASTPLUSDIR}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | $Bio::Tools::Run::BlastPlus::program_dir = $self->{_program_dir} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | $Bio::Tools::Run::BlastPlus::program_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'_program_dir'} || $Bio::Tools::Run::BlastPlus::program_dir
MC/DC0%0/2
$self->{'_program_dir'} || $Bio::Tools::Run::BlastPlus::program_dir
$self->{'_program_dir'}
$Bio::Tools::Run::BlastPlus::program_dir
Truth table0%0/3
A || B
A= $self->{'_program_dir'}B= $Bio::Tools::Run::BlastPlus::program_dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | $self->set_db_make_args( $db_make_args) if ( $db_make_args ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | $self->set_mask_make_args( $mask_make_args) if ($mask_make_args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | $self->{'_create'} = $create; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | $self->{'_overwrite'} = $overwrite; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | $self->{'_is_remote'} = $is_remote; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | $self->{'_db_data'} = $db_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | $self->{'_mask_file'} = $mask_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | $self->{'_mask_data'} = $mask_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | # check db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | if (defined $self->check_db and $self->check_db == 0 and !$self->is_remote) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->check_db and $self->check_db == 0 and not $self->is_remote
defined $self->check_db and $self->check_db == 0
MC/DC0%0/3
defined $self->check_db and $self->check_db == 0 and not $self->is_remote
defined $self->check_db
$self->check_db == 0
not $self->is_remote
Truth table0%0/4
A and B and not(C)
A= defined $self->check_dbB= $self->check_db == 0C= not $self->is_remote
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | ▶ | $self->throw("DB '".$self->db."' can't be found. To create, set -create => 1.") unless ($create || $overwrite); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$create or $overwrite
MC/DC0%0/2
$create or $overwrite
$create
$overwrite
Truth table0%0/3
A or B
A= $createB= $overwrite
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | if (!$self->db) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | # allow this to pass; catch lazily at make_db... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | if (!$self->db_data) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | $self->debug('No database or db data specified. '. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 'To create a new database, provide '. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | '-db_data => [fasta|\@seqs|$seqio_object]') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | # no db specified; create temp db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | $self->{_create} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | if ($self->db_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | my $fh = File::Temp->new(TEMPLATE => 'DBXXXXX', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | DIR => $self->db_dir, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | UNLINK => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | my ($v,$d,$f) = File::Spec->splitpath($fh->filename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | $self->{_db} = $f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | $self->{_db_path} = $fh->filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | $self->_register_temp_for_cleanup($self->db_path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | $fh->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | $self->{_db_dir} = File::Temp->newdir('DBDXXXXX'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | $self->{_db} = 'DBTEMP'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | $self->{_db_path} = File::Spec->catfile($self->db_dir, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | $self->db); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | =head2 db() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | Title : db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | Usage : $obj->db($newval) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | Function: contains the basename of the local blast database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | Example : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | Returns : value of db (a scalar string) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | Args : readonly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | sub db { shift->{_db} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | ▶ | sub db_name { shift->{_db} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | ▶ | sub set_db_name { shift->{_db} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_db_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | ▶ | sub db_dir { shift->{_db_dir} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | sub set_db_dir { shift->{_db_dir} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_db_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | sub db_path { shift->{_db_path} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_path: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | ▶ | sub db_data { shift->{_db_data} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_data: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | ▶ | sub set_db_data { shift->{_db_data} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_db_data: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | ▶ | sub db_type { shift->{_db_type} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | ▶ | sub masker { shift->{_masker} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
masker: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | sub set_masker { shift->{_masker} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_masker: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | sub mask_file { shift->{_mask_file} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mask_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | sub set_mask_file { shift->{_mask_file} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_mask_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | sub mask_data { shift->{_mask_data} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mask_data: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | ▶ | sub set_mask_data { shift->{_mask_data} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_mask_data: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | =head2 factory() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | Title : factory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | Usage : $obj->factory($newval) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | Function: attribute containing the Bio::Tools::Run::BlastPlus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | factory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | Example : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | Returns : value of factory (Bio::Tools::Run::BlastPlus object) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | Args : readonly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | sub factory { shift->{_factory} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
factory: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | ▶ | sub create { shift->{_create} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | sub overwrite { shift->{_overwrite} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
overwrite: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | sub is_remote { shift->{_is_remote} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_remote: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | =head2 program_version() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | Title : program_version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | Usage : $version = $bedtools_fac->program_version() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | Function: Returns the program version (if available) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | Returns : string representing location and version of the program | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | Note : this works around the WrapperBase::version() method conflicting with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | the -version parameter for SABlast (good argument for not having | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | getter/setters for these) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | =head2 package_version() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | Title : package_version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | Usage : $version = $bedtools_fac->package_version() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | Function: Returns the BLAST+ package version (if available) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | Returns : string representing BLAST+ package version (may differ from version()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | sub program_version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
program_version: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | my $fac = $self->factory; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | ▶ | $fac->program_version(@_) if $fac; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | sub package_version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
package_version: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | my $fac = $self->factory; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | ▶ | $fac->package_version(@_) if $fac; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | =head1 DB methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | =head2 make_db() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | Title : make_db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | Function: create the blast database (if necessary), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | imposing masking if specified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | Returns : true on success | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | Args : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | # should also provide facility for creating subdatabases from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | # existing databases (i.e., another format for $data: the name of an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | # existing blastdb...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | sub make_db { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_db: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | ▶ | return 1 if ( $self->check_db && !$self->overwrite ); # already there or force make | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->check_db and not $self->overwrite
MC/DC0%0/2
$self->check_db and not $self->overwrite
$self->check_db
not $self->overwrite
Truth table0%0/3
A and not(B)
A= $self->check_dbB= not $self->overwrite
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | $self->throw('No database or db data specified. '. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 'To create a new database, provide '. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | '-db_data => [fasta|\@seqs|$seqio_object]') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | unless $self->db_data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | # db_data can be: fasta file, array of seqs, Bio::SeqIO object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | my $data = $self->db_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | $data = $self->_fastize($data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | my $testio = Bio::SeqIO->new(-file=>$data, -format=>'fasta'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | ▶ | $self->{_db_type} = ($testio->next_seq->alphabet =~ /.na/) ? 'nucl' : 'prot'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | $testio->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | my ($v,$d,$name) = File::Spec->splitpath($data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | $name =~ s/\.fas$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | $self->{_db} ||= $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"_db"} ||= $name
MC/DC0%0/2
$self->{"_db"} ||= $name
$self->{"_db"}
$name
Truth table0%0/3
A ||= B
A= $self->{"_db"}B= $name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | $self->{_db_path} = File::Spec->catfile($self->db_dir,$self->db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | # <#######[ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | # deal with creating masks here, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | # and provide correct parameters to the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | # makeblastdb ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | # accomodate $self->db_make_args here -- allow them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | # to override defaults, or allow only those args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | # that are not specified here? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | ▶ | my $usr_db_args ||= $self->db_make_args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
my $usr_db_args ||= $self->db_make_args
MC/DC0%0/2
my $usr_db_args ||= $self->db_make_args
my $usr_db_args
$self->db_make_args
Truth table0%0/3
A ||= B
A= my $usr_db_argsB= $self->db_make_args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | my %usr_args = @$usr_db_args if $usr_db_args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | my %db_args = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | -in => $data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | -dbtype => $self->db_type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | -out => $self->db_path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | -title => $self->db, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | -parse_seqids => 1 # necessary for masking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | # usr arg override | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | if (%usr_args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | $db_args{$_} = $usr_args{$_} for keys %usr_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | # do masking if requested | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | # if the (masker and mask_data) OR mask_file attributes of this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | # object are set, assume that masking is desired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | ▶ | if ($self->mask_file) { # the actual masking data is provided | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | $db_args{'-mask_data'} = $self->mask_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | ▶ | elsif ($self->masker && $self->mask_data) { # build the mask | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->masker and $self->mask_data
MC/DC0%0/2
$self->masker and $self->mask_data
$self->masker
$self->mask_data
Truth table0%0/3
A and B
A= $self->maskerB= $self->mask_data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | $db_args{'-mask_data'} = $self->make_mask(-data => $self->mask_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | $self->throw("Masker error: message is '".$self->stderr."'") unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | ▶ | $db_args{'-mask_data'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | $self->{_mask_data} = $db_args{'-mask_data'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | $self->{_factory} = $bp_class->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | -command => 'makeblastdb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | %db_args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | $self->factory->no_throw_on_crash($self->no_throw_on_crash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | return $self->factory->_run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | =head2 make_mask() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | Title : make_mask | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | Function: create masking data based on specified parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | Returns : mask data filename (scalar string) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | Args : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | # mask program usage (based on blast+ manual) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | # program dbtype opn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | # windowmasker nucl mask overrep data, low-complexity (optional) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # dustmasker nucl mask low-complexity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | # segmasker prot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | sub make_mask { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_mask: not called CC=24 SCAR=64.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | my ($data, $mask_db, $make_args, $masker) = $self->_rearrange([qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | MASK_DB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | MAKE_ARGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | MASKER)], @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | my (%mask_args,%usr_args,$db_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | my $infmt = 'fasta'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | $self->throw("make_mask requires -data argument") unless $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | ▶ | $masker ||= $self->masker; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$masker ||= $self->masker
MC/DC0%0/2
$masker ||= $self->masker
$masker
$self->masker
Truth table0%0/3
A ||= B
A= $maskerB= $self->masker
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | ▶ | $self->throw("no masker specified and no masker default set in object") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | unless $masker; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | ▶ | my $usr_make_args ||= $self->mask_make_args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
my $usr_make_args ||= $self->mask_make_args
MC/DC0%0/2
my $usr_make_args ||= $self->mask_make_args
my $usr_make_args
$self->mask_make_args
Truth table0%0/3
A ||= B
A= my $usr_make_argsB= $self->mask_make_args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | ▶ | %usr_args = @$usr_make_args if $usr_make_args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | ▶ | unless (grep /^$masker$/, keys %AVAILABLE_MASKERS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | $self->throw("Masker '$masker' not available"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | ▶ | if ($self->check_db($data)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | ▶ | unless ($masker eq 'segmasker') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | $self->throw("Masker '$masker' can't use a blastdb as primary input"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | ▶ | unless ($self->db_info($data)->{_db_type} eq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | $AVAILABLE_MASKERS{$masker}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | $self->throw("Masker '$masker' is incompatible with input db sequence type"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | $infmt = 'blastdb'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $data = $self->_fastize($data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | my $sio = Bio::SeqIO->new(-file=>$data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | my $s = $sio->next_seq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | my $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | ▶ | if ($s->alphabet =~ /.na/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | $type = 'nucl'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | elsif ($s->alphabet =~ /protein/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | $type = 'prot'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | $type = 'UNK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | ▶ | unless ($type eq $AVAILABLE_MASKERS{$masker}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | $self->throw("Masker '$masker' is incompatible with sequence type '$type'"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | # check that sequence type and masker program match: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | # now, need to provide reasonable default masker arg settings, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | # and override these with $usr_make_args as necessary and appropriate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | my $mh = File::Temp->new(TEMPLATE=>'MSKXXXXX', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | UNLINK => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | DIR => $self->db_dir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | my $mask_outfile = $mh->filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | $mh->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | $self->_register_temp_for_cleanup(File::Spec->catfile($self->db_dir,$mask_outfile)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | %mask_args = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | -in => $data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | -parse_seqids => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | #-outfmt => $MASKER_ENCODING{$masker} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | # usr arg override | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | ▶ | if (%usr_args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | $mask_args{$_} = $usr_args{$_} for keys %usr_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | # masker-specific pipelines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | my $status; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | for ($masker) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | ▶ | m/dustmasker/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | $mask_args{'-out'} = $mask_outfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | $self->{_factory} = $bp_class->new(-command => $masker, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | %mask_args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | $self->factory->no_throw_on_crash($self->no_throw_on_crash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | $status = $self->factory->_run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | ▶ | m/windowmasker/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | # check mask_db if present | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | ▶ | if ($mask_db) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | ▶ | unless ($self->check_db($mask_db)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | $self->throw("Mask database '$mask_db' is not present or valid"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | my $cth = File::Temp->new(TEMPLATE=>'MCTXXXXX', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | DIR => $self->db_dir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | my $ct_file = $cth->filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | $cth->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | $mask_args{'-out'} = $ct_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | $mask_args{'-mk_counts'} = 'true'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | $self->{_factory} = $bp_class->new(-command => $masker, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | %mask_args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | $self->factory->no_throw_on_crash($self->no_throw_on_crash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | $status = $self->factory->_run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | ▶ | last unless $status; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | delete $mask_args{'-mk_counts'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | $mask_args{'-ustat'} = $ct_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | $mask_args{'-out'} = $mask_outfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | ▶ | if ($mask_db) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | $mask_args{'-in'} = $mask_db; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | $mask_args{'-infmt'} = 'blastdb'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | $self->factory->reset_parameters(%mask_args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | $self->factory->no_throw_on_crash($self->no_throw_on_crash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | $status = $self->factory->_run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | m/segmasker/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | $mask_args{'-infmt'} = $infmt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $mask_args{'-out'} = $mask_outfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | $self->{_factory} = $bp_class->new(-command => $masker, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | %mask_args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | $self->factory->no_throw_on_crash($self->no_throw_on_crash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | $status = $self->factory->_run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | $self->throw("Masker program '$masker' not recognized"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | ▶ | return $status ? $mask_outfile : $status; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | =head2 db_info() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | Title : db_info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | Function: get info for database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | (via blastdbcmd -info); add factory attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | Returns : hash of database attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | Args : [optional] db name (scalar string) (default: currently attached db) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | sub db_info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_info: not called CC=17 SCAR=57.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | my $db = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | ▶ | $db ||= $self->db_path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$db ||= $self->db_path
MC/DC0%0/2
$db ||= $self->db_path
$db
$self->db_path
Truth table0%0/3
A ||= B
A= $dbB= $self->db_path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | ▶ | unless ($db) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | $self->warn("db_info: db not specified and no db attached"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | ▶ | if ($self->is_remote) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | $self->warn("db_info: sorry, can't get info for remote database (complain to NCBI)"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | ▶ | if ($db eq $self->db and $self->{_db_info}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$db eq $self->db and $self->{"_db_info"}
MC/DC0%0/2
$db eq $self->db and $self->{"_db_info"}
$db eq $self->db
$self->{"_db_info"}
Truth table0%0/3
A and B
A= $db eq $self->dbB= $self->{"_db_info"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | return $self->{_db_info}; # memoized | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | my $db_info_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | $self->{_factory} = $bp_class->new( -command => 'blastdbcmd', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | -info => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | -db => $db ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | $self->factory->no_throw_on_crash(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | $self->factory->_run(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | $self->factory->no_throw_on_crash(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | ▶ | if ($self->factory->stderr =~ /No alias or index file found/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | $self->warn("db_info: Couldn't find database ".$self->db."; make with make_db()"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | $db_info_text = $self->factory->stdout; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | # parse info into attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | my $infh = IO::String->new($db_info_text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | my %attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | ▶ | while (<$infh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | /Database: (.*)/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | $attr{db_info_name} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | ▶ | /([0-9,]+) sequences; ([0-9,]+) total/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | $attr{db_num_sequences} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | $attr{db_total_bases} = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | $attr{db_num_sequences} =~ s/,//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 0 | $attr{db_total_bases} =~ s/,//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | ▶ | /Date: (.*?)\s+Longest sequence: ([0-9,]+)/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | $attr{db_date} = $1; # convert to more usable date object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | $attr{db_longest_sequence} = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | $attr{db_longest_sequence} =~ s/,//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | ▶ | /Algorithm ID/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | my $alg = $attr{db_filter_algorithms} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | ▶ | while (<$infh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | ▶ | if (/\s+([0-9]+)\s+([a-z0-9_]+)\s+(.*)/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | push @$alg, { algorithm_id => $1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | algorithm_name => $2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | algorithm_opts => $3 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | # get db type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | ▶ | if ( -e $db.'.psq' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | $attr{_db_type} = 'prot'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | elsif (-e $db.'.nsq') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | $attr{_db_type} = 'nucl'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | $attr{_db_type} = 'UNK'; # bork | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | ▶ | if ($db eq $self->db) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | $self->{_db_type} = $attr{_db_type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | $self->{_db_info_text} = $db_info_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 0 | $self->{_db_info} = \%attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | return \%attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | =head2 set_db_make_args() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | Title : set_db_make_args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | Function: set the DB make arguments attribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | with checking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | Returns : true on success | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | Args : arrayref or hashref of named arguments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | sub set_db_make_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_db_make_args: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 0 | ▶ | $self->throw("Arrayref or hashref required at DB_MAKE_ARGS") unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | ref($args) =~ /^ARRAY|HASH$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | ▶ | if (ref($args) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | my @a = %$args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 0 | $args = \@a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 0 | ▶ | $self->throw("Named args required for DB_MAKE_ARGS") unless !(@$args % 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | $self->{'_db_make_args'} = $args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | ▶ | sub db_make_args { shift->{_db_make_args} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_make_args: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | =head2 set_mask_make_args() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | Title : set_mask_make_args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | Function: set the masker make arguments attribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | with checking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | Returns : true on success | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | Args : arrayref or hasref of named arguments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | sub set_mask_make_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_mask_make_args: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 0 | ▶ | $self->throw("Arrayref or hashref required at MASK_MAKE_ARGS") unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | ref($args) =~ /^ARRAY|HASH$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | ▶ | if (ref($args) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | my @a = %$args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | $args = \@a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 0 | ▶ | $self->throw("Named args required at MASK_MAKE_ARGS") unless !(@$args % 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 0 | $self->{'_mask_make_args'} = $args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | ▶ | sub mask_make_args { shift->{_mask_make_args} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mask_make_args: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | =head2 check_db() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | Title : check_db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | Function: determine if database with registered name and dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | Returns : 1 if db present, 0 if not present, undef if name/dir not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | Args : [optional] db name (default is 'registered' name in $self->db) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | [optional] db directory (default is 'registered' dir in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | $self->db_dir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | sub check_db { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_db: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 0 | my ($db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 0 | my $db_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 0 | ▶ | if ($db) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 0 | my ($v,$d,$f) = File::Spec->splitpath($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | $f =~ s/\..*$//; # ignore extensions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | ▶ | $db_path = File::Spec->catfile($d||'.',$f); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$d || '.'
MC/DC0%0/1
$d || '.'
$d
Truth table0%0/2
A
A= $d
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | $db_path = $self->db_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | ▶ | if ( $db_path ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | $self->{_factory} = $bp_class->new( -command => 'blastdbcmd', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | -info => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | -db => $db_path ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | # $DB::single=1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | $self->factory->no_throw_on_crash(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | $self->factory->_run(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | $self->factory->no_throw_on_crash(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | ▶ | return 0 if ($self->factory->stderr =~ /No alias or index file found/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | =head2 no_throw_on_crash() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | Title : no_throw_on_crash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | Usage : $fac->no_throw_on_crash($newval) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | Function: set to prevent an exeception throw on a failed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | blast program execution | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | Example : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | Returns : value of no_throw_on_crash (boolean) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | Args : on set, new value (boolean) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | sub no_throw_on_crash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
no_throw_on_crash: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | ▶ | return $self->{'no_throw_on_crash'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | return $self->{'no_throw_on_crash'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | =head1 Internals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | =head2 _fastize() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | Title : _fastize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | Function: convert a sequence collection to a temporary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | fasta file (sans gaps) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | Returns : fasta filename (scalar string) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | Args : sequence collection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | sub _fastize { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fastize: not called CC=22 SCAR=62.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 0 | for ($data) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | ▶ | !ref && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | # suppose a fasta file name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 0 | ▶ | $self->throw('Sequence file not found') unless -e $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | my $guesser = Bio::Tools::GuessSeqFormat->new(-file => $data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | ▶ | $self->throw('Sequence file not in FASTA format') unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | $guesser->guess eq 'fasta'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | (ref eq 'ARRAY') && (ref $$data[0]) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | ($$data[0]->isa('Bio::Seq') || $$data[0]->isa('Bio::PrimarySeq')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | ▶ | && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
ref $_ eq "ARRAY" and ref $data->[0] and $data->[0]->isa("Bio::Seq") || $data->[0]->isa("Bio::PrimarySeq")
ref $_ eq "ARRAY" and ref $data->[0]
$data->[0]->isa("Bio::Seq") or $data->[0]->isa("Bio::PrimarySeq")
MC/DC0%0/4
ref $_ eq "ARRAY" and ref $data->[0] and $data->[0]->isa("Bio::Seq") || $data->[0]->isa("Bio::PrimarySeq")
ref $_ eq "ARRAY"
ref $data->[0]
$data->[0]->isa("Bio::Seq")
$data->[0]->isa("Bio::PrimarySeq")
Truth table0%0/5
A and B and C or D
A= ref $_ eq "ARRAY"B= ref $data->[0]C= $data->[0]->isa("Bio::Seq")D= $data->[0]->isa("Bio::PrimarySeq")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 0 | my $fh = File::Temp->new(TEMPLATE => 'DBDXXXXX', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | UNLINK => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | DIR => $self->db_dir, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | SUFFIX => '.fas'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 0 | my $fname = $fh->filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | $fh->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 0 | $self->_register_temp_for_cleanup($fname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 0 | ▶ | my $fasio = Bio::SeqIO->new(-file=>">$fname", -format=>"fasta") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | or $self->throw("Can't create temp fasta file"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 0 | for (@$data) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 0 | my $s = $_->seq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 0 | my $a = $_->alphabet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 0 | $s =~ s/[$Bio::PrimarySeq::GAP_SYMBOLS]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 0 | $_->seq( $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 0 | $_->alphabet($a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 0 | $fasio->write_seq($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 0 | $fasio->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 0 | $data = $fname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 0 | ▶ | ref && do { # some kind of object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 0 | my ($fmt) = ref($data) =~ /.*::(.*)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 0 | ▶ | if ($fmt eq 'fasta') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | $data = $data->file; # use the fasta file directly | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | # convert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 0 | my $fh = File::Temp->new(TEMPLATE => 'DBDXXXXX', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | UNLINK => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | DIR => $self->db_dir, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | SUFFIX => '.fas'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 0 | my $fname = $fh->filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 0 | $fh->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 0 | $self->_register_temp_for_cleanup($fname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 0 | ▶ | my $fasio = Bio::SeqIO->new(-file=>">$fname", -format=>"fasta") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | or $self->throw("Can't create temp fasta file"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 0 | require Bio::PrimarySeq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 0 | ▶ | if ($data->isa('Bio::AlignIO')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | my $aln = $data->next_aln; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 0 | for ($aln->each_seq) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | # must de-gap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 0 | my $s = $_->seq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 0 | my $a = $_->alphabet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | 0 | $s =~ s/[$Bio::PrimarySeq::GAP_SYMBOLS]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 0 | $_->seq( $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 0 | $_->alphabet($a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 0 | $fasio->write_seq($_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | elsif ($data->isa('Bio::SeqIO')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 0 | ▶ | while (local $_ = $data->next_seq) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | my $s = $_->seq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 0 | my $a = $_->alphabet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | $s =~ s/[$Bio::PrimarySeq::GAP_SYMBOLS]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | 0 | $_->seq( $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | $_->alphabet($a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 0 | $fasio->write_seq($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | elsif ($data->isa('Bio::Align::AlignI')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 0 | for( $data->each_seq) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | my $s = $_->seq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 0 | my $a = $_->alphabet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 0 | $s =~ s/[$Bio::PrimarySeq::GAP_SYMBOLS]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | $_->seq( $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 0 | $_->alphabet($a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 0 | $fasio->write_seq($_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | ▶ | elsif ($data->isa('Bio::Seq') || $data->isa('Bio::PrimarySeq')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$data->isa("Bio::Seq") or $data->isa("Bio::PrimarySeq")
MC/DC0%0/2
$data->isa("Bio::Seq") or $data->isa("Bio::PrimarySeq")
$data->isa("Bio::Seq")
$data->isa("Bio::PrimarySeq")
Truth table0%0/3
A or B
A= $data->isa("Bio::Seq")B= $data->isa("Bio::PrimarySeq")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | my $s = $data->seq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 0 | my $a = $data->alphabet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 0 | $s =~ s/[$Bio::PrimarySeq::GAP_SYMBOLS]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | $data->seq($s); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 0 | $data->alphabet($a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | $fasio->write_seq($data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | $self->throw("Can't handle sequence container object ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | "of type '".ref($data)."'"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 0 | $fasio->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 0 | $data = $fname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | =head2 _register_temp_for_cleanup() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | Title : _register_temp_for_cleanup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | Function: register a file for cleanup with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | cleanup() method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | Returns : true on success | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | Args : a file name or a blastdb basename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | (scalar string) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | sub _register_temp_for_cleanup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_register_temp_for_cleanup: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 0 | my @files = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 0 | for (@files) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | 0 | my ($v, $d, $n) = File::Spec->splitpath($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 0 | ▶ | $_ = File::Spec->catfile($self->db_dir, $n) unless length($d); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 0 | push @{$self->{_cleanup_list}}, File::Spec->rel2abs($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | =head2 cleanup() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | Title : cleanup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | Function: unlink files registered for cleanup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | Returns : true on success | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | Args : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | sub cleanup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanup: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 0 | ▶ | return unless $self->{_cleanup_list}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 0 | for (@{$self->{_cleanup_list}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 0 | ▶ | m/(\.[a-z0-9_]+)+$/i && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 0 | unlink $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | do { # catch all index files | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | ▶ | if ( -e $_.".psq" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | 0 | unlink glob($_.".p*"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | 0 | unlink glob($_.".??.p*"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | elsif ( -e $_.".nsq" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 0 | unlink glob($_.".n*"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 0 | unlink glob($_.".??.n*"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 0 | unlink $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | =head2 AUTOLOAD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | In this module, C<AUTOLOAD()> delegates L<Bio::Tools::Run::WrapperBase> and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | L<Bio::Tools::Run::WrapperBase::CommandExts> methods (including those | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | of L<Bio::ParamterBaseI>) to the C<factory()> attribute: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | $fac->stderr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | gives you | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | $fac->factory->stderr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | If $AUTOLOAD isn't pointing to a WrapperBase method, then AUTOLOAD attempts to return a C<db_info> attribute: e.g. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | $fac->db_num_sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | works by looking in the $fac->db_info() hash. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | Finally, if $AUTOLOAD is pointing to a blast query method, AUTOLOAD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | runs C<run> with the C<-method> parameter appropriately set. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 0 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 0 | my $method = $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | 0 | $method =~ s/.*:://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | 0 | my @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | 0 | ▶ | if (grep /^$method$/, @Bio::Tools::Run::StandAloneBlastPlus::BlastMethods) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 0 | ▶ | push @args, ('-method_args' => ['-remote' => 1] ) if ($self->is_remote); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 0 | return $self->run( -method => $method, @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 0 | ▶ | if ($self->factory and $self->factory->can($method)) { # factory method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->factory and $self->factory->can($method)
MC/DC0%0/2
$self->factory and $self->factory->can($method)
$self->factory
$self->factory->can($method)
Truth table0%0/3
A and B
A= $self->factoryB= $self->factory->can($method)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 0 | return $self->factory->$method(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 0 | ▶ | if ($self->db_info and grep /^$method$/, keys %{$self->db_info}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->db_info and grep /^$method$/, keys %{$self->db_info;}
MC/DC0%0/2
$self->db_info and grep /^$method$/, keys %{$self->db_info;}
$self->db_info
grep /^$method$/, keys %{$self->db_info;}
Truth table0%0/3
A and B
A= $self->db_infoB= grep /^$method$/, keys %{$self->db_info;}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 0 | return $self->db_info->{$method}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | # else, fail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 0 | $self->throw("Can't locate method '$method' in class ".ref($self)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||