| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::SearchIO::waba | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # Cared for by Jason Stajich <jason@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright Jason Stajich | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | Bio::SearchIO::waba - SearchIO parser for Jim Kent WABA program | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | alignment output | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # do not use this object directly, rather through Bio::SearchIO | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | use Bio::SearchIO; | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | my $in = Bio::SearchIO->new(-format => 'waba', | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | -file => 'output.wab'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | while( my $result = $in->next_result ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | while( my $hit = $result->next_hit ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | while( my $hsp = $result->next_hsp ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | This parser will process the waba output (NOT the human readable format). | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | web: | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | =head1 AUTHOR - Jason Stajich | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||
| 70 | Email jason-at-bioperl.org | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | package Bio::SearchIO::waba; | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | $Bio::SearchIO::waba::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | ▶ | use vars qw(%MODEMAP %MAPPING @STATES); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # Object preamble - inherits from Bio::Root::Root | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | ▶ | use Bio::Search::Result::ResultFactory; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | ▶ | use Bio::Search::HSP::HSPFactory; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | ▶ | use POSIX; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 2 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # mapping of NCBI Blast terms to Bioperl hash keys | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 2 | %MODEMAP = ('WABAOutput' => 'result', | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | 'Hit' => 'hit', | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 'Hsp' => 'hsp' | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | @STATES = qw(Hsp_qseq Hsp_hseq Hsp_stateseq); | |||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | %MAPPING = | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 'Hsp_query-from'=> 'HSP-query_start', | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 'Hsp_query-to' => 'HSP-query_end', | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 'Hsp_hit-from' => 'HSP-hit_start', | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 'Hsp_hit-to' => 'HSP-hit_end', | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 'Hsp_qseq' => 'HSP-query_seq', | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 'Hsp_hseq' => 'HSP-hit_seq', | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 'Hsp_midline' => 'HSP-homology_seq', | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 'Hsp_stateseq' => 'HSP-hmmstate_seq', | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 'Hsp_align-len' => 'HSP-hsp_length', | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 'Hit_id' => 'HIT-name', | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 'Hit_accession' => 'HIT-accession', | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 'WABAOutput_program' => 'RESULT-algorithm_name', | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 'WABAOutput_version' => 'RESULT-algorithm_version', | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 'WABAOutput_query-def'=> 'RESULT-query_name', | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 'WABAOutput_query-db' => 'RESULT-query_database', | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 'WABAOutput_db' => 'RESULT-database_name', | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | ▶ | use base qw(Bio::SearchIO); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | Title : new | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | Usage : my $obj = Bio::SearchIO::waba->new(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | Function: Builds a new Bio::SearchIO::waba object | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | Returns : Bio::SearchIO::waba | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | Args : see Bio::SearchIO | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 1 | ▶ | sub _initialize { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_initialize: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | my ($self,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | $self->SUPER::_initialize(@args); | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | $self->_eventHandler->register_factory('result', Bio::Search::Result::ResultFactory->new(-type => 'Bio::Search::Result::WABAResult')); | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | $self->_eventHandler->register_factory('hsp', Bio::Search::HSP::HSPFactory->new(-type => 'Bio::Search::HSP::WABAHSP')); | |||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | =head2 next_result | ||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | Title : next_result | ||||||||||||||||||||||||||||||||||||||||||||||
| 150 | Usage : my $hit = $searchio->next_result; | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | Function: Returns the next Result from a search | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | Returns : Bio::Search::Result::ResultI object | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | Args : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 3 | ▶ | sub next_result{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_result: called CC=19 SCAR=31.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | 3 | local $/ = "\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | 3 | local $_; | |||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 3 | my ($curquery,$curhit); | |||||||||||||||||||||||||||||||||||||||||||||
| 163 | 3 | my $state = -1; | |||||||||||||||||||||||||||||||||||||||||||||
| 164 | 3 | $self->start_document(); | |||||||||||||||||||||||||||||||||||||||||||||
| 165 | 3 | my @hit_signifs; | |||||||||||||||||||||||||||||||||||||||||||||
| 166 | 3 | ▶ | while( defined ($_ = $self->_readline )) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 17 | ▶ | if( $state == -1 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 5 | my ($qid, $qhspid,$qpercent, $junk, | |||||||||||||||||||||||||||||||||||||||||||||
| 170 | $alnlen,$qdb,$qacc,$qstart,$qend,$qstrand, | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | $hitdb,$hacc,$hstart,$hend, | ||||||||||||||||||||||||||||||||||||||||||||||
| 172 | $hstrand) = | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | ( /^(\S+)\.(\S+)\s+align\s+ # get the queryid | ||||||||||||||||||||||||||||||||||||||||||||||
| 174 | (\d+(\.\d+)?)\%\s+ # get the percentage | ||||||||||||||||||||||||||||||||||||||||||||||
| 175 | of\s+(\d+)\s+ # get the length of the alignment | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | (\S+)\s+ # this is the query database | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | (\S+):(\-?\d+)\-(\-?\d+) # The accession:start-end for query | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | \s+([\-\+]) # query strand | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | \s+(\S+)\. # hit db | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | (\S+):(\-?\d+)\-(\-?\d+) # The accession:start-end for hit | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | \s+([\-\+])\s*$ # hit strand | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | /ox ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # Curses. Jim's code is 0 based, the following is to readjust | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | if( $hstart < 0 ) { $hstart *= -1} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if( $hend < 0 ) { $hend *= -1} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | if( $qstart < 0 ) { $qstart *= -1} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if( $qend < 0 ) { $qend *= -1} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 5 | $hstart++; $hend++; $qstart++; $qend++; | |||||||||||||||||||||||||||||||||||||||||||||
| 190 | 5 | ▶ | if( ! defined $alnlen ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $self->warn("Unable to parse the rest of the WABA alignment info for: '$_'"); | |||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 5 | $self->{'_reporttype'} = 'WABA'; # hardcoded - only | |||||||||||||||||||||||||||||||||||||||||||||
| 195 | # one type of WABA AFAIK | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 5 | ▶ | if( defined $curquery && | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $curquery and $curquery ne $qid
MC/DC100%2/2
defined $curquery and $curquery ne $qid
defined $curquery
$curquery ne $qid
Truth table100%3/3
A and B
A= defined $curqueryB= $curquery ne $qid
| |||||||||||||||||||||||||||||||||||||||||||||||
| 197 | $curquery ne $qid ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 1 | $self->end_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | $self->_pushback($_); | |||||||||||||||||||||||||||||||||||||||||||||
| 200 | 1 | $self->end_element({'Name' => 'WABAOutput'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | return $self->end_document(); | |||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 4 | ▶ | if( defined $curhit && | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $curhit and $curhit ne $hacc
MC/DC0%0/2
defined $curhit and $curhit ne $hacc
defined $curhit
$curhit ne $hacc
Truth table66%2/3
A and B
A= defined $curhitB= $curhit ne $hacc
| |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | $curhit ne $hacc) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # slight duplication here -- keep these in SYNC | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | $self->end_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $self->start_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $self->element({'Name' => 'Hit_id', | |||||||||||||||||||||||||||||||||||||||||||||
| 210 | 'Data' => $hacc}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $self->element({'Name' => 'Hit_accession', | |||||||||||||||||||||||||||||||||||||||||||||
| 212 | 'Data' => $hacc}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } elsif ( ! defined $curquery ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | $self->start_element({'Name' => 'WABAOutput'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | 2 | $self->{'_result_count'}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | 2 | $self->element({'Name' => 'WABAOutput_query-def', | |||||||||||||||||||||||||||||||||||||||||||||
| 218 | 'Data' => $qid }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | $self->element({'Name' => 'WABAOutput_program', | |||||||||||||||||||||||||||||||||||||||||||||
| 220 | 'Data' => 'WABA'}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 2 | $self->element({'Name' => 'WABAOutput_query-db', | |||||||||||||||||||||||||||||||||||||||||||||
| 222 | 'Data' => $qdb}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 2 | $self->element({'Name' => 'WABAOutput_db', | |||||||||||||||||||||||||||||||||||||||||||||
| 224 | 'Data' => $hitdb}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # slight duplication here -- keep these N'SYNC ;-) | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 2 | $self->start_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 228 | 2 | $self->element({'Name' => 'Hit_id', | |||||||||||||||||||||||||||||||||||||||||||||
| 229 | 'Data' => $hacc}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 2 | $self->element({'Name' => 'Hit_accession', | |||||||||||||||||||||||||||||||||||||||||||||
| 231 | 'Data' => $hacc}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # strand is inferred by start,end values | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | # in the Result Builder | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 4 | ▶ | if( $qstrand eq '-' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ($qstart,$qend) = ($qend,$qstart); | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 4 | ▶ | if( $hstrand eq '-' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ($hstart,$hend) = ($hend,$hstart); | |||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 4 | $self->start_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | 4 | $self->element({'Name' => 'Hsp_query-from', | |||||||||||||||||||||||||||||||||||||||||||||
| 246 | 'Data' => $qstart}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 4 | $self->element({'Name' => 'Hsp_query-to', | |||||||||||||||||||||||||||||||||||||||||||||
| 248 | 'Data' => $qend}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 4 | $self->element({'Name' => 'Hsp_hit-from', | |||||||||||||||||||||||||||||||||||||||||||||
| 250 | 'Data' => $hstart}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 4 | $self->element({'Name' => 'Hsp_hit-to', | |||||||||||||||||||||||||||||||||||||||||||||
| 252 | 'Data' => $hend}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 4 | $self->element({'Name' => 'Hsp_align-len', | |||||||||||||||||||||||||||||||||||||||||||||
| 254 | 'Data' => $alnlen}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 4 | $curquery = $qid; | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | 4 | $curhit = $hacc; | |||||||||||||||||||||||||||||||||||||||||||||
| 258 | 4 | $state = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 259 | } elsif( ! defined $curquery ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | $self->warn("skipping because no Hit begin line was recognized\n$_") if( $_ !~ /^\s+$/ ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 262 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 12 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||
| 264 | 12 | $self->element({'Name' => $STATES[$state++], | |||||||||||||||||||||||||||||||||||||||||||||
| 265 | 'Data' => $_}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 12 | ▶ | if( $state >= scalar @STATES ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 4 | $state = -1; | |||||||||||||||||||||||||||||||||||||||||||||
| 268 | 4 | $self->end_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 2 | ▶ | if( defined $curquery ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 1 | $self->end_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | $self->end_element({'Name' => 'WABAOutput'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | return $self->end_document(); | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||
| 280 | =head2 start_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||
| 282 | Title : start_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 283 | Usage : $eventgenerator->start_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | Function: Handles a start element event | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | Args : hashref with at least 2 keys 'Data' and 'Name' | ||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||
| 289 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 64 | ▶ | sub start_element{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_element: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 64 | my ($self,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 293 | # we currently don't care about attributes | ||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 64 | my $nm = $data->{'Name'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 295 | 64 | ▶ | if( my $type = $MODEMAP{$nm} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 8 | $self->_mode($type); | |||||||||||||||||||||||||||||||||||||||||||||
| 297 | 8 | ▶ | if( $self->_eventHandler->will_handle($type) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 8 | my $func = sprintf("start_%s",lc $type); | |||||||||||||||||||||||||||||||||||||||||||||
| 299 | 8 | $self->_eventHandler->$func($data->{'Attributes'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 8 | unshift @{$self->{'_elements'}}, $type; | |||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 64 | ▶ | if($nm eq 'WABAOutput') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 2 | $self->{'_values'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 305 | 2 | $self->{'_result'}= undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 306 | 2 | $self->{'_mode'} = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||
| 311 | =head2 end_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||
| 313 | Title : start_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 314 | Usage : $eventgenerator->end_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 315 | Function: Handles an end element event | ||||||||||||||||||||||||||||||||||||||||||||||
| 316 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | Args : hashref with at least 2 keys 'Data' and 'Name' | ||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||
| 320 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 64 | ▶ | sub end_element { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_element: called CC=8 SCAR=21.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 64 | my ($self,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 324 | 64 | my $nm = $data->{'Name'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 325 | 64 | my $rc; | |||||||||||||||||||||||||||||||||||||||||||||
| 326 | # Hsp are sort of weird, in that they end when another | ||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # object begins so have to detect this in end_element for now | ||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 64 | ▶ | if( $nm eq 'Hsp' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 4 | foreach ( qw(Hsp_qseq Hsp_midline Hsp_hseq) ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 330 | $self->element({'Name' => $_, | ||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 12 | 'Data' => $self->{'_last_hspdata'}->{$_}}); | |||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 4 | $self->{'_last_hspdata'} = {} | |||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 64 | ▶ | if( my $type = $MODEMAP{$nm} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 8 | ▶ | if( $self->_eventHandler->will_handle($type) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 8 | my $func = sprintf("end_%s",lc $type); | |||||||||||||||||||||||||||||||||||||||||||||
| 339 | $rc = $self->_eventHandler->$func($self->{'_reporttype'}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 8 | $self->{'_values'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 8 | shift @{$self->{'_elements'}}; | |||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } elsif( $MAPPING{$nm} ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 56 | ▶ | if ( ref($MAPPING{$nm}) =~ /hash/i ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | my $key = (keys %{$MAPPING{$nm}})[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $self->{'_values'}->{$key}->{$MAPPING{$nm}->{$key}} = $self->{'_last_data'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 348 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 56 | $self->{'_values'}->{$MAPPING{$nm}} = $self->{'_last_data'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $self->warn( "unknown nm $nm ignoring\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 64 | $self->{'_last_data'} = ''; # remove read data if we are at | |||||||||||||||||||||||||||||||||||||||||||||
| 355 | # end of an element | ||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 64 | ▶ | $self->{'_result'} = $rc if( $nm eq 'WABAOutput' ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 64 | return $rc; | |||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||
| 361 | =head2 element | ||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||
| 363 | Title : element | ||||||||||||||||||||||||||||||||||||||||||||||
| 364 | Usage : $eventhandler->element({'Name' => $name, 'Data' => $str}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 365 | Function: Convience method that calls start_element, characters, end_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 366 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 367 | Args : Hash ref with the keys 'Name' and 'Data' | ||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||
| 370 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 56 | ▶ | sub element{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
element: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 56 | my ($self,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 374 | 56 | $self->start_element($data); | |||||||||||||||||||||||||||||||||||||||||||||
| 375 | 56 | $self->characters($data); | |||||||||||||||||||||||||||||||||||||||||||||
| 376 | 56 | $self->end_element($data); | |||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||
| 380 | =head2 characters | ||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||
| 382 | Title : characters | ||||||||||||||||||||||||||||||||||||||||||||||
| 383 | Usage : $eventgenerator->characters($str) | ||||||||||||||||||||||||||||||||||||||||||||||
| 384 | Function: Send a character events | ||||||||||||||||||||||||||||||||||||||||||||||
| 385 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 386 | Args : string | ||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||
| 389 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 56 | ▶ | sub characters{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
characters: called CC=6 SCAR=18.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 56 | my ($self,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 56 | ▶ | return unless ( defined $data->{'Data'} ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 52 | ▶ | if( $data->{'Data'} =~ /^\s+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | return unless $data->{'Name'} =~ /Hsp\_(midline|qseq|hseq)/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 52 | ▶ | if( $self->in_element('hsp') && | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->in_element("hsp") and $data->{"Name"} =~ /Hsp\_(qseq|hseq|midline)/
MC/DC100%2/2
$self->in_element("hsp") and $data->{"Name"} =~ /Hsp\_(qseq|hseq|midline)/
$self->in_element("hsp")
$data->{"Name"} =~ /Hsp\_(qseq|hseq|midline)/
Truth table100%3/3
A and B
A= $self->in_element("hsp")B= $data->{"Name"} =~ /Hsp\_(qseq|hseq|midline)/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 400 | $data->{'Name'} =~ /Hsp\_(qseq|hseq|midline)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 16 | $self->{'_last_hspdata'}->{$data->{'Name'}} .= $data->{'Data'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 52 | $self->{'_last_data'} = $data->{'Data'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||
| 408 | =head2 _mode | ||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||
| 410 | Title : _mode | ||||||||||||||||||||||||||||||||||||||||||||||
| 411 | Usage : $obj->_mode($newval) | ||||||||||||||||||||||||||||||||||||||||||||||
| 412 | Function: | ||||||||||||||||||||||||||||||||||||||||||||||
| 413 | Example : | ||||||||||||||||||||||||||||||||||||||||||||||
| 414 | Returns : value of _mode | ||||||||||||||||||||||||||||||||||||||||||||||
| 415 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||
| 418 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 8 | ▶ | sub _mode{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mode: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 8 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 422 | 8 | ▶ | if( defined $value) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 8 | $self->{'_mode'} = $value; | |||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 8 | return $self->{'_mode'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||
| 428 | =head2 within_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||
| 430 | Title : within_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 431 | Usage : if( $eventgenerator->within_element($element) ) {} | ||||||||||||||||||||||||||||||||||||||||||||||
| 432 | Function: Test if we are within a particular element | ||||||||||||||||||||||||||||||||||||||||||||||
| 433 | This is different than 'in' because within can be tested | ||||||||||||||||||||||||||||||||||||||||||||||
| 434 | for a whole block. | ||||||||||||||||||||||||||||||||||||||||||||||
| 435 | Returns : boolean | ||||||||||||||||||||||||||||||||||||||||||||||
| 436 | Args : string element name | ||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||
| 439 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | sub within_element{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
within_element: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | my ($self,$name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 443 | return 0 if ( ! defined $name && | ||||||||||||||||||||||||||||||||||||||||||||||
| 444 | ! defined $self->{'_elements'} || | ||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | scalar @{$self->{'_elements'}} == 0) ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not defined $name || defined $self->{"_elements"} or scalar @{$self->{"_elements"};} == 0
defined $name || defined $self->{'_elements'}
MC/DC0%0/3
not defined $name || defined $self->{"_elements"} or scalar @{$self->{"_elements"};} == 0
defined $name
defined $self->{'_elements'}
scalar @{$self->{"_elements"};} == 0
Truth table0%0/5
not(A || B) or C
A= defined $nameB= defined $self->{'_elements'}C= scalar @{$self->{"_elements"};} == 0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | foreach ( @{$self->{'_elements'}} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | if( $_ eq $name ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||
| 454 | =head2 in_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||
| 456 | Title : in_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 457 | Usage : if( $eventgenerator->in_element($element) ) {} | ||||||||||||||||||||||||||||||||||||||||||||||
| 458 | Function: Test if we are in a particular element | ||||||||||||||||||||||||||||||||||||||||||||||
| 459 | This is different than 'in' because within can be tested | ||||||||||||||||||||||||||||||||||||||||||||||
| 460 | for a whole block. | ||||||||||||||||||||||||||||||||||||||||||||||
| 461 | Returns : boolean | ||||||||||||||||||||||||||||||||||||||||||||||
| 462 | Args : string element name | ||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||
| 465 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 52 | ▶ | sub in_element{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
in_element: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 52 | my ($self,$name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 469 | 52 | ▶ | return 0 if ! defined $self->{'_elements'}->[0]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 52 | return ( $self->{'_elements'}->[0] eq $name) | |||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||
| 474 | =head2 start_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||
| 476 | Title : start_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 477 | Usage : $eventgenerator->start_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 478 | Function: Handles a start document event | ||||||||||||||||||||||||||||||||||||||||||||||
| 479 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 480 | Args : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||
| 483 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 3 | ▶ | sub start_document{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_document: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 487 | 3 | $self->{'_lasttype'} = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 488 | 3 | $self->{'_values'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 489 | 3 | $self->{'_result'}= undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 490 | 3 | $self->{'_mode'} = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 491 | 3 | $self->{'_elements'} = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||
| 495 | =head2 end_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||
| 497 | Title : end_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 498 | Usage : $eventgenerator->end_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 499 | Function: Handles an end document event | ||||||||||||||||||||||||||||||||||||||||||||||
| 500 | Returns : Bio::Search::Result::ResultI object | ||||||||||||||||||||||||||||||||||||||||||||||
| 501 | Args : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||
| 504 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 2 | ▶ | sub end_document{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_document: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 2 | my ($self,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 508 | 2 | return $self->{'_result'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||
| 511 | =head2 result_count | ||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||
| 513 | Title : result_count | ||||||||||||||||||||||||||||||||||||||||||||||
| 514 | Usage : my $count = $searchio->result_count | ||||||||||||||||||||||||||||||||||||||||||||||
| 515 | Function: Returns the number of results we have processed | ||||||||||||||||||||||||||||||||||||||||||||||
| 516 | Returns : integer | ||||||||||||||||||||||||||||||||||||||||||||||
| 517 | Args : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||
| 520 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | sub result_count { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_count: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | return $self->{'_result_count'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | sub report_count { shift->result_count } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
report_count: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||