Bio/SearchIO/fasta.pm

filter: Statementstmt 66.8% 328 / 491 Branchbran 50.0% 186 / 372 Conditioncond 50.0% 75 / 150 MC/DCmcdc 23.3% 18 / 77 Subroutinesub 85.7% 18 / 21 Podpod 100% 12 / 12 totaltotal 56.7% 637 / 1123 CC 241 SCAR 72.4
CC
241
Cov
58%
next_result
1824.6
_processHits
1190.0
within_element
56.0
CRAP 1394.5
↑ Summary Bio/Search/SearchUtils.pm »
1 #
2 # BioPerl module for Bio::SearchIO::fasta
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Jason Stajich <jason-at-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::fasta - A SearchIO parser for FASTA results
17  
18 =head1 SYNOPSIS
19  
20 # Do not use this object directly, use it through the SearchIO system
21 use Bio::SearchIO;
22 my $searchio = Bio::SearchIO->new(-format => 'fasta',
23 -file => 'report.FASTA');
24 while( my $result = $searchio->next_result ) {
25 # ... do what you would normally doi with Bio::SearchIO.
26 }
27  
28 =head1 DESCRIPTION
29  
30 This object contains the event based parsing code for FASTA format
31 reports. It creates L<Bio::Search::HSP::FastaHSP> objects instead of
32 L<Bio::Search::HSP::GenericHSP> for the HSP objects.
33  
34 This module will parse -m 9 -d 0 output as well as default m 1 output
35 from FASTA as well as SSEARCH.
36  
37 Also see the SearchIO HOWTO:
38 L<http://bioperl.org/howtos/SearchIO_HOWTO.html>.
39  
40 =head1 FEEDBACK
41  
42 =head2 Mailing Lists
43  
44 User feedback is an integral part of the evolution of this and other
45 Bioperl modules. Send your comments and suggestions preferably to
46 the Bioperl mailing list. Your participation is much appreciated.
47  
48 bioperl-l@bioperl.org - General discussion
49 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
50  
51 =head2 Support
52  
53 Please direct usage questions or support issues to the mailing list:
54  
55 I<bioperl-l@bioperl.org>
56  
57 rather than to the module maintainer directly. Many experienced and
58 reponsive experts will be able look at the problem and quickly
59 address it. Please include a thorough description of the problem
60 with code and data examples if at all possible.
61  
62 =head2 Reporting Bugs
63  
64 Report bugs to the Bioperl bug tracking system to help us keep track
65 of the bugs and their resolution. Bug reports can be submitted via the
66 web:
67  
68 https://github.com/bioperl/bioperl-live/issues
69  
70 =head1 AUTHOR - Jason Stajich, Aaron Mackey, William Pearson
71  
72 Email jason-at-bioperl.org
73  
74 =head1 APPENDIX
75  
76 The rest of the documentation details each of the object methods.
77 Internal methods are usually preceded with a _
78  
79 =cut
80  
81 # Let the code begin...
82  
83 package Bio::SearchIO::fasta;
84 2 $Bio::SearchIO::fasta::VERSION = '1.7.8';
85 2 ▶use vars qw(%MODEMAP %MAPPING $IDLENGTH);
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::RootI
89  
90 2 ▶use Bio::Factory::ObjectFactory;
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
93  
94 # Set IDLENGTH to a new value if you have
95 # compile FASTA with a different ID length
96 # (actually newest FASTA allows the setting of this
97 # via -C parameter, default is 6)
98 2 $IDLENGTH = 6;
99  
100 # mapping of NCBI Blast terms to Bioperl hash keys
101 2 %MODEMAP = (
102 'FastaOutput' => 'result',
103 'Hit' => 'hit',
104 'Hsp' => 'hsp'
105 );
106  
107 # This should really be done more intelligently, like with
108 # XSLT
109  
110 2 %MAPPING = (
111 'Hsp_bit-score' => 'HSP-bits',
112 'Hsp_score' => 'HSP-score',
113 'Hsp_sw-score' => 'HSP-swscore',
114 'Hsp_evalue' => 'HSP-evalue',
115 'Hsp_evalue2' => 'HSP-evalue2',
116 'Hsp_query-from' => 'HSP-query_start',
117 'Hsp_query-to' => 'HSP-query_end',
118 'Hsp_hit-from' => 'HSP-hit_start',
119 'Hsp_hit-to' => 'HSP-hit_end',
120 'Hsp_positive' => 'HSP-conserved',
121 'Hsp_identity' => 'HSP-identical',
122 'Hsp_gaps' => 'HSP-hsp_gaps',
123 'Hsp_hitgaps' => 'HSP-hit_gaps',
124 'Hsp_querygaps' => 'HSP-query_gaps',
125 'Hsp_qseq' => 'HSP-query_seq',
126 'Hsp_hseq' => 'HSP-hit_seq',
127 'Hsp_midline' => 'HSP-homology_seq',
128 'Hsp_align-len' => 'HSP-hsp_length',
129 'Hsp_query-frame' => 'HSP-query_frame',
130 'Hsp_hit-frame' => 'HSP-hit_frame',
131  
132 'Hit_id' => 'HIT-name',
133 'Hit_len' => 'HIT-length',
134 'Hit_accession' => 'HIT-accession',
135 'Hit_def' => 'HIT-description',
136 'Hit_signif' => 'HIT-significance',
137 'Hit_score' => 'HIT-score',
138  
139 'FastaOutput_program' => 'RESULT-algorithm_name',
140 'FastaOutput_version' => 'RESULT-algorithm_version',
141 'FastaOutput_query-def' => 'RESULT-query_name',
142 'FastaOutput_querydesc' => 'RESULT-query_description',
143 'FastaOutput_query-len' => 'RESULT-query_length',
144 'FastaOutput_db' => 'RESULT-database_name',
145 'FastaOutput_db-len' => 'RESULT-database_entries',
146 'FastaOutput_db-let' => 'RESULT-database_letters',
147  
148 'Parameters_matrix' => { 'RESULT-parameters' => 'matrix' },
149 'Parameters_expect' => { 'RESULT-parameters' => 'expect' },
150 'Parameters_include' => { 'RESULT-parameters' => 'include' },
151 'Parameters_sc-match' => { 'RESULT-parameters' => 'match' },
152 'Parameters_sc-mismatch' => { 'RESULT-parameters' => 'mismatch' },
153 'Parameters_gap-open' => { 'RESULT-parameters' => 'gapopen' },
154 'Parameters_gap-ext' => { 'RESULT-parameters' => 'gapext' },
155 'Parameters_word-size' => { 'RESULT-parameters' => 'wordsize' },
156 'Parameters_ktup' => { 'RESULT-parameters' => 'ktup' },
157 'Parameters_filter' => { 'RESULT-parameters' => 'filter' },
158 'Statistics_db-num' => { 'RESULT-statistics' => 'dbentries' },
159 'Statistics_db-len' => { 'RESULT-statistics' => 'dbletters' },
160 'Statistics_hsp-len' => { 'RESULT-statistics' => 'hsplength' },
161 'Statistics_eff-space' => { 'RESULT-statistics' => 'effectivespace' },
162 'Statistics_kappa' => { 'RESULT-statistics' => 'kappa' },
163 'Statistics_lambda' => { 'RESULT-statistics' => 'lambda' },
164 'Statistics_entropy' => { 'RESULT-statistics' => 'entropy' },
165 );
166 }
167  
168 2 ▶use base qw(Bio::SearchIO);
Subroutine BEGIN: called CC=1 SCAR=0.0
169  
170 =head2 new
171  
172 Title : new
173 Usage : my $obj = Bio::SearchIO::fasta->new();
174 Function: Builds a new Bio::SearchIO::fasta object
175 Returns : Bio::SearchIO::fasta
176 Args : -idlength - set ID length to something other
177 than the default (6), this is only
178 necessary if you have compiled FASTA
179 with a new default id length to display
180 in the HSP alignment blocks
181  
182 =cut
183  
184 9 ▶sub _initialize {
Subroutine _initialize: called CC=3 SCAR=11.4
185 9 my ( $self, @args ) = @_;
186 9 $self->SUPER::_initialize(@args);
187 9 ▶ return unless @args;
Branch: 1 branch
BranchTrueFalseTotal
unless @args 0 9 9
188 9 my ($idlength) = $self->_rearrange( [qw(IDLENGTH)], @args );
189 9 ▶ $self->idlength( $idlength || $IDLENGTH );
Condition33%1/3
$idlength || $Bio::SearchIO::fasta::IDLENGTH
l!l&&r!l&&!r
090
MC/DC0%0/2
$idlength || $Bio::SearchIO::fasta::IDLENGTH
$idlength $Bio::SearchIO::fasta::IDLENGTH
Truth table33%1/3
A || B
A= $idlengthB= $Bio::SearchIO::fasta::IDLENGTH
ABresult
1X1
011
000
190 9 $self->_eventHandler->register_factory(
191 'hsp',
192 Bio::Factory::ObjectFactory->new(
193 -type => 'Bio::Search::HSP::FastaHSP',
194 -interface => 'Bio::Search::HSP::HSPI'
195 )
196 );
197 9 return 1;
198 }
199  
200 =head2 next_result
201  
202 Title : next_result
203 Usage : my $hit = $searchio->next_result;
204 Function: Returns the next Result from a search
205 Returns : Bio::Search::Result::ResultI object
206 Args : none
207  
208 =cut
209  
210 13 ▶sub next_result {
Subroutine next_result: called CC=177 SCAR=75.1
Pod documented
211 13 my ($self) = @_;
212 13 local $/ = "\n";
213 13 local $_;
214  
215 13 my $data = '';
216 13 my $seentop = 0;
217 13 my $current_hsp;
218 13 my $m9HSP = 0;
219 13 $self->start_document();
220 13 my @hit_signifs;
221 13 ▶ while ( defined( $_ = $self->_readline ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = $self->_readline)) 1193 4 1197
222 1193 ▶ next if ( !$self->in_element('hsp')
Branch: 1 branch
BranchTrueFalseTotal
if not $self->in_element("hsp") and /^\s+$/ 23 1170 1193
Condition100%3/3
not $self->in_element("hsp") and /^\s+$/
!ll&&!rl&&r
87229823
MC/DC100%2/2
not $self->in_element("hsp") and /^\s+$/
not $self->in_element("hsp") /^\s+$/
Truth table100%3/3
not(A) and B
A= not $self->in_element("hsp")B= /^\s+$/
ABresult
0X0
100
111
223 && /^\s+$/ ); # skip empty lines
224 1170 ▶ if (
Branch: 14 branches
BranchTrueFalseTotal
if (/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/ or /(\S+)\s+finds\s+/ or (/^\#\s+/ and $_ = $self->_readline and /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/ or /(\S+)\s+finds\s+/)) { } 9 1161 1170
elsif (/(\d+)\s+residues\s+in\s+(\d+)\s+(?:library\s+)?sequences/) { } 9 1152 1161
elsif (/Lambda=\s*(\S+)/) { } 9 1143 1152
elsif (/K=\s*(\S+)/) { } 0 1143 1143
elsif (/^\s*(Smith-Waterman)/) { } 0 1143 1143
elsif (/The best( related| unrelated)? scores are:/) { } 9 1134 1143
elsif (/^\s*([T]?FAST[XYAF]).+,\s*(\S+)\s*matrix[^\]]+?(xS)?\]\s*ktup:\s*(\d+)/) { } 5 1129 1134
elsif (/^Algorithm:\s+(\S+)\s+.*\s*\(([^)]+)\)\s+(\S+)/) { } 4 1125 1129
elsif (/^Parameters:/) { } 4 1121 1125
elsif (/^\s+ktup:\s*(\d+),/) { } 0 1121 1121
elsif (/^(>--)$/ or /^>>(?!>)(.+?)\s+(?:\((\d+)\s*(aa|nt)\))?$/) { } 183 938 1121
elsif (/\d+\s*residues\s*in\s*\d+\s*query\s*sequences/) { } 9 929 938
elsif (/^\s*\d+\s*>>>/) { } 0 929 929
elsif ($self->in_element('hsp')) { } 689 240 929
Condition78%26/33
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/ or /(\S+)\s+finds\s+/ or (/^\#\s+/ and $_ = $self->_readline and /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/ or /(\S+)\s+finds\s+/)
l!l&&r!l&&!r
631161
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/ or /(\S+)\s+finds\s+/
l!l&&r!l&&!r
601164
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/
l!l&&r!l&&!r
601164
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/
l!l&&r!l&&!r
601164
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/
l!l&&r!l&&!r
511164
/^\#\s+/ and $_ = $self->_readline and /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/ or /(\S+)\s+finds\s+/
l!l&&r!l&&!r
301161
/^\#\s+/ and $_ = $self->_readline and /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/
l!l&&r!l&&!r
301161
/^\#\s+/ and $_ = $self->_readline and /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/
l!l&&r!l&&!r
211161
/^\#\s+/ and $_ = $self->_readline and /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/
l!l&&r!l&&!r
201162
/^\#\s+/ and $_ = $self->_readline and /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox
!ll&&!rl&&r
116112
/^\#\s+/ and $_ = $self->_readline
!ll&&!rl&&r
116103
MC/DC25%3/12
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/ or /(\S+)\s+finds\s+/ or (/^\#\s+/ and $_ = $self->_readline and /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox or /(\S+)\s+compares\s+a/ or /(\S+)\s+performs\s+a/ or /(\S+)\s+produces\s/ or /(\S+)\s+finds\s+/)
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox /(\S+)\s+compares\s+a/ /(\S+)\s+performs\s+a/ /(\S+)\s+produces\s/ /(\S+)\s+finds\s+/ /^\#\s+/ $_ = $self->_readline /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/iox /(\S+)\s+compares\s+a/ /(\S+)\s+performs\s+a/ /(\S+)\s+produces\s/ /(\S+)\s+finds\s+/
Truth table23%5/21
A or B or C or D or E or F and G and H or I or J or K or L
A= /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/ioxB= /(\S+)\s+compares\s+a/C= /(\S+)\s+performs\s+a/D= /(\S+)\s+produces\s/E= /(\S+)\s+finds\s+/F= /^\#\s+/G= $_ = $self->_readlineH= /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/ioxI= /(\S+)\s+compares\s+a/J= /(\S+)\s+performs\s+a/K= /(\S+)\s+produces\s/L= /(\S+)\s+finds\s+/
ABCDEFGHIJKLresult
1XXXXXXXXXXX1
01XXXXXXXXXX1
001XXXXXXXXX1
0001XXXXXXXX1
00001XXXXXXX1
00000111XXXX1
000000XX1XXX1
0000010X1XXX1
000001101XXX1
000000XX01XX1
0000010X01XX1
0000011001XX1
000000XX001X1
0000010X001X1
00000110001X1
000000XX00011
0000010X00011
0000011000011
000000XX00000
0000010X00000
0000011000000
225 m/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/oxi
226 || /(\S+)\s+compares\s+a/
227 || /(\S+)\s+performs\s+a/
228 || /(\S+)\s+produces\s/
229 || /(\S+)\s+finds\s+/ # for lalign, but does not work because no "The best scores are:"
230 || ( m/^\#\s+/ # has a command log line
231 && ( $_ = $self->_readline )
232 && /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?sequence/oxi
233 || /(\S+)\s+compares\s+a/
234 || /(\S+)\s+performs\s+a/
235 || /(\S+)\s+produces\s/
236 || /(\S+)\s+finds\s+/ # for lalign, but does not work because no "The best scores are:"
237 )
238 )
239 {
240 9 ▶ if ($seentop) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seentop) 0 9 9
241 0 $self->_pushback($_);
242 0 $self->end_element( { 'Name' => 'FastaOutput' } );
243 0 return $self->end_document();
244 }
245 9 $self->{'_reporttype'} = $1;
246 9 $self->start_element( { 'Name' => 'FastaOutput' } );
247 9 $self->{'_result_count'}++;
248 9 $seentop = 1;
249 #$self->debug( "reporttype is " . $self->{'_reporttype'} . "\n" );
250 $self->element(
251 {
252 'Name' => 'FastaOutput_program',
253 9 'Data' => $self->{'_reporttype'}
254 }
255 );
256 9 my $version;
257 # version 35 version string on same line
258 9 ▶ if (/version/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/version/) { } 1 8 9
259 1 ($version) = (/version\s+(\S+)/);
260 }
261 # earlier versions, it's on the next line
262 else {
263 8 $_ = $self->_readline();
264 8 ($version) = (/version\s+(\S+)/);
265 }
266 9 ▶ $version = '' unless defined $version;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $version 0 9 9
267 9 $self->{'_version'} = $version;
268 9 $self->element(
269 {
270 'Name' => 'FastaOutput_version',
271 'Data' => $version
272 }
273 );
274  
275 9 my ( $last, $leadin, $type, $querylen, $querytype, $querydef );
276  
277 9 ▶ while ( defined( $_ = $self->_readline() ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = $self->_readline)) 48 0 48
278 48 ▶ if (
Branch: 2 branches
BranchTrueFalseTotal
if (/^ ( (?:\s+>) | # fa33 lead-in (?:\s*\d+\s*>>>) # fa34 mlib lead-in ) (.*) /x) { } 7 41 48
elsif (/^\s*vs\s+\S+/o) { } 2 39 41
279 /^ (
280 (?:\s+>) | # fa33 lead-in
281 (?:\s*\d+\s*>>>) # fa34 mlib lead-in
282 )
283 (.*)
284 /x
285 )
286 {
287 7 ( $leadin, $querydef ) = ( $1, $2 );
288 7 ▶ if ( $leadin =~ m/>>>/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($leadin =~ />>>/) { } 5 2 7
289 5 ▶ if ( $querydef =~
Branch: 1 branch
BranchTrueFalseTotal
if ($querydef =~ /^(.*?)\s+(?:\-\s+)?(\d+)\s+(aa|nt).*$/o) 5 0 5
290 /^(.*?)\s+(?:\-\s+)?(\d+)\s+(aa|nt).*$/o )
291 {
292 5 ( $querydef, $querylen, $querytype ) =
293 ( $1, $2, $3 );
294 5 last;
295 }
296 }
297 else {
298 2 ▶ if ( $last =~ /(\S+)[:,]\s*(\d+)\s+(aa|nt)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($last =~ /(\S+)[:,]\s*(\d+)\s+(aa|nt)/) 2 0 2
299 2 ( $querylen, $querytype ) = ( $2, $3 );
300 2 ▶ $querydef ||= $1;
Condition33%1/3
$querydef ||= $1
l!l&&r!l&&!r
200
MC/DC0%0/2
$querydef ||= $1
$querydef $1
Truth table33%1/3
A ||= B
A= $querydefB= $1
ABresult
1X1
011
000
301 2 last;
302 }
303 }
304 }
305 elsif (m/^\s*vs\s+\S+/o) {
306 2 ▶ if ( $last =~ /(\S+)[,:]\s+(\d+)\s+(aa|nt)/o ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($last =~ /(\S+)[,:]\s+(\d+)\s+(aa|nt)/o) 2 0 2
307 2 ( $querydef, $querylen, $querytype ) = ( $1, $2, $3 );
308 2 last;
309 }
310 }
311 39 $last = $_;
312 }
313 9 ▶ if ( $self->{'_reporttype'}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_reporttype"} and $self->{"_reporttype"} eq "FASTA") 7 2 9
Condition66%2/3
$self->{"_reporttype"} and $self->{"_reporttype"} eq "FASTA"
!ll&&!rl&&r
027
MC/DC50%1/2
$self->{"_reporttype"} and $self->{"_reporttype"} eq "FASTA"
$self->{"_reporttype"} $self->{"_reporttype"} eq "FASTA"
Truth table66%2/3
A and B
A= $self->{"_reporttype"}B= $self->{"_reporttype"} eq "FASTA"
ABresult
0X0
100
111
314 && $self->{'_reporttype'} eq 'FASTA' )
315 {
316 7 ▶ if ( $querytype eq 'nt' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($querytype eq 'nt') { } 4 3 7
elsif ($querytype eq 'aa') { } 3 0 3
317 4 $self->{'_reporttype'} = 'FASTN';
318 }
319 elsif ( $querytype eq 'aa' ) {
320 3 $self->{'_reporttype'} = 'FASTP';
321 }
322 }
323 9 my ( $name, $descr ) = $querydef =~ m/^(\S+)\s*(.*?)\s*$/o;
324 9 $self->element(
325 {
326 'Name' => 'FastaOutput_query-def',
327 'Data' => $name
328 }
329 );
330 9 $self->element(
331 {
332 'Name' => 'FastaOutput_querydesc',
333 'Data' => $descr
334 }
335 );
336 9 ▶ if ($querylen) {
Branch: 1 branch
BranchTrueFalseTotal
if ($querylen) { } 9 0 9
337 9 $self->element(
338 {
339 'Name' => 'FastaOutput_query-len',
340 'Data' => $querylen
341 }
342 );
343 }
344 else {
345 0 $self->warn("unable to find and set query length");
346 }
347 9 ▶ if (
Branch: 2 branches
BranchTrueFalseTotal
if ($last =~ /^\s*vs\s+(\S+)/ or $last =~ /^searching\s+(\S+)\s+library/ or $last =~ /^Library:\s+(\S+)\s+/ or defined $_ and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)\s+/ or defined($_ = $self->_readline) and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)/) { } 9 0 9
elsif (/^\s+opt(?:\s+E\(\))?$/o) { } 0 0 0
Condition54%13/24
$last =~ /^\s*vs\s+(\S+)/ or $last =~ /^searching\s+(\S+)\s+library/ or $last =~ /^Library:\s+(\S+)\s+/ or defined $_ and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)\s+/ or defined($_ = $self->_readline) and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)/
l!l&&r!l&&!r
270
$last =~ /^\s*vs\s+(\S+)/ or $last =~ /^searching\s+(\S+)\s+library/ or $last =~ /^Library:\s+(\S+)\s+/ or defined $_ and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)\s+/
l!l&&r!l&&!r
027
$last =~ /^\s*vs\s+(\S+)/ or $last =~ /^searching\s+(\S+)\s+library/ or $last =~ /^Library:\s+(\S+)\s+/
l!l&&r!l&&!r
009
$last =~ /^\s*vs\s+(\S+)/ or $last =~ /^searching\s+(\S+)\s+library/
l!l&&r!l&&!r
009
defined $_ and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)\s+/
!ll&&!rl&&r
072
/^\s*vs\s+(\S+)/ or /^Library:\s+(\S+)\s+/
l!l&&r!l&&!r
207
defined($_ = $self->_readline) and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)/
!ll&&!rl&&r
007
/^\s*vs\s+(\S+)/ or /^Library:\s+(\S+)/
l!l&&r!l&&!r
340
MC/DC0%0/9
$last =~ /^\s*vs\s+(\S+)/ or $last =~ /^searching\s+(\S+)\s+library/ or $last =~ /^Library:\s+(\S+)\s+/ or defined $_ and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)\s+/ or defined($_ = $self->_readline) and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)/
$last =~ /^\s*vs\s+(\S+)/ $last =~ /^searching\s+(\S+)\s+library/ $last =~ /^Library:\s+(\S+)\s+/ defined $_ /^\s*vs\s+(\S+)/ /^Library:\s+(\S+)\s+/ defined($_ = $self->_readline) /^\s*vs\s+(\S+)/ /^Library:\s+(\S+)/
Truth table23%3/13
A or B or C or D and E or F or G and H or I
A= $last =~ /^\s*vs\s+(\S+)/B= $last =~ /^searching\s+(\S+)\s+library/C= $last =~ /^Library:\s+(\S+)\s+/D= defined $_E= /^\s*vs\s+(\S+)/F= /^Library:\s+(\S+)\s+/G= defined($_ = $self->_readline)H= /^\s*vs\s+(\S+)/I= /^Library:\s+(\S+)/
ABCDEFGHIresult
1XXXXXXXX1
01XXXXXXX1
001XXXXXX1
00011XXXX1
000101XXX1
0000XX11X1
0000XX1011
00010011X1
0001001011
0000XX0XX0
0000XX1000
0001000XX0
0001001000
348 $last =~ /^\s*vs\s+(\S+)/
349 || ( $last =~ /^searching\s+(\S+)\s+library/ )
350 || ( $last =~ /^Library:\s+(\S+)\s+/ )
351 || (
352 defined $_
353 && ( /^\s*vs\s+(\S+)/
354 || /^Library:\s+(\S+)\s+/ )
355 )
356 || ( defined( $_ = $self->_readline() )
357 && ( /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)/ ) )
358 )
359 {
360 9 $self->element(
361 {
362 'Name' => 'FastaOutput_db',
363 'Data' => $1
364 }
365 );
366 }
367 elsif (m/^\s+opt(?:\s+E\(\))?$/o) {
368  
369 # histogram ... read over it more rapidly than the larger outer loop:
370 0 ▶ while ( defined( $_ = $self->_readline ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = $self->_readline)) 0 0 0
371 0 ▶ last if m/^>\d+/;
Branch: 1 branch
BranchTrueFalseTotal
if /^>\d+/ 0 0 0
372 }
373 }
374 }
375 elsif (/(\d+)\s+residues\s+in\s+(\d+)\s+(?:library\s+)?sequences/) {
376 9 $self->element(
377 {
378 'Name' => 'FastaOutput_db-let',
379 'Data' => $1
380 }
381 );
382 9 $self->element(
383 {
384 'Name' => 'FastaOutput_db-len',
385 'Data' => $2
386 }
387 );
388 9 $self->element(
389 {
390 'Name' => 'Statistics_db-len',
391 'Data' => $1
392 }
393 );
394 9 $self->element(
395 {
396 'Name' => 'Statistics_db-num',
397 'Data' => $2
398 }
399 );
400 }
401 elsif (/Lambda=\s*(\S+)/) {
402 9 $self->element(
403 {
404 'Name' => 'Statistics_lambda',
405 'Data' => $1
406 }
407 );
408 }
409 elsif (/K=\s*(\S+)/) {
410 0 $self->element(
411 {
412 'Name' => 'Statistics_kappa',
413 'Data' => $1
414 }
415 );
416 }
417 elsif (/^\s*(Smith-Waterman)/) {
418  
419 0 $self->{'_reporttype'} = $1;
420  
421 0 m/\[\s*(\S+)\s+matrix \([^\)]+\)(xS)?\],/;
422  
423 0 $self->element(
424 {
425 'Name' => 'Parameters_matrix',
426 'Data' => $1
427 }
428 );
429 0 ▶ $self->element(
Branch: 1 branch
BranchTrueFalseTotal
defined $2 ? : 0 0 0
430 {
431 'Name' => 'Parameters_filter',
432 'Data' => defined $2 ? 1 : 0,
433 }
434 );
435 0 ▶ if (/\s*gap\-penalty:\s*(\-?\d+)\/(\-?\d+)/) {
Branch: 2 branches
BranchTrueFalseTotal
if (m[\s*gap\-penalty:\s*(\-?\d+)/(\-?\d+)]) { } 0 0 0
elsif (m[\s*open/ext:\s*(\-?\d+)/(\-?\d+)]) { } 0 0 0
436 0 $self->element(
437 {
438 'Name' => 'Parameters_gap-open',
439 'Data' => $1,
440 }
441 );
442  
443 0 $self->element(
444 {
445 'Name' => 'Parameters_gap-ext',
446 'Data' => $2,
447 }
448 );
449 }
450 elsif (/\s*open\/ext:\s*(\-?\d+)\/(\-?\d+)/) {
451 0 $self->element(
452 {
453 'Name' => 'Parameters_gap-open',
454 'Data' => $1,
455 }
456 );
457  
458 0 $self->element(
459 {
460 'Name' => 'Parameters_gap-ext',
461 'Data' => $2,
462 }
463 );
464 }
465  
466 $self->element(
467 {
468 'Name' => 'FastaOutput_program',
469 0 'Data' => $self->{'_reporttype'}
470 }
471 );
472 }
473 elsif (/The best( related| unrelated)? scores are:/) {
474 9 my $rel = $1;
475 9 my @labels = split;
476 @labels = map {
477 9 ▶ if ( $_ =~ m/^E\((\d+)\)$/o )
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^E\((\d+)\)$/o) { } 9 33 42
478 {
479 9 $self->element(
480 { 'Name' => 'Statistics_eff-space', 'Data' => $1 } );
481 9 "evalue";
482 }
483 else {
484 # canonicalize changed column headers
485 33 ▶ if ($_ eq "gapl") {
Branch: 3 branches
BranchTrueFalseTotal
if ($_ eq 'gapl') { } 1 32 33
elsif ($_ eq 'gapq') { } 1 31 32
elsif ($_ eq 'E2()') { } 0 31 31
486 1 $_ = "lgaps";
487 } elsif ($_ eq "gapq") {
488 1 $_ = "qgaps";
489 } elsif ($_ eq "E2()") {
490 0 $_ = "evalue2";
491 }
492  
493 33 ▶ $_;
Branch: 1 branch
BranchTrueFalseTotal
$rel ? : 0 9 9
494 }
495 } @labels[ $rel ? 5 : 4 .. $#labels ];
496  
497 9 ▶ while ( defined( $_ = $self->_readline() )
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = $self->_readline) and not /^\s+$/) 181 9 190
Condition66%2/3
defined($_ = $self->_readline) and not /^\s+$/
!ll&&!rl&&r
09181
MC/DC50%1/2
defined($_ = $self->_readline) and not /^\s+$/
defined($_ = $self->_readline) not /^\s+$/
Truth table66%2/3
A and not(B)
A= defined($_ = $self->_readline)B= not /^\s+$/
ABresult
0X0
100
111
498 && !/^\s+$/ )
499 {
500 181 my @line = split;
501  
502 181 ▶ if ( $line[-1] =~ m/\=/o && $labels[-1] ne 'aln_code' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line[-1] =~ /\=/o and $labels[-1] ne "aln_code") 0 181 181
Condition33%1/3
$line[-1] =~ /\=/o and $labels[-1] ne "aln_code"
!ll&&!rl&&r
18100
MC/DC0%0/2
$line[-1] =~ /\=/o and $labels[-1] ne "aln_code"
$line[-1] =~ /\=/o $labels[-1] ne "aln_code"
Truth table33%1/3
A and B
A= $line[-1] =~ /\=/oB= $labels[-1] ne "aln_code"
ABresult
0X0
100
111
503 # unlabelled alignment hit;
504 0 push @labels, "aln_code";
505 }
506  
507 181 ▶ if ($line[0] eq "+-") {
Branch: 2 branches
BranchTrueFalseTotal
if ($line[0] eq '+-') { } 0 181 181
elsif ($line[0] eq '>>><<<') { } 0 181 181
508 0 $m9HSP = 1;
509 # parse HSP, add to last parsed Hit
510 0 my %hspData;
511  
512 0 my @line = split;
513  
514 0 @hspData{@labels} = splice( @line, @line - @labels );
515 0 $hspData{lframe} = $hit_signifs[-1]->{lframe};
516  
517 0 push @{$hit_signifs[-1]->{HSPs}}, \%hspData;
518  
519 0 next;
520 }
521 elsif ($line[0] eq '>>><<<') {
522 0 last;
523 }
524  
525 181 my (%data, %hspData);
526 181 @data{@labels} = @hspData{@labels} = splice( @line, @line - @labels );
527 181 ▶ if ( $line[-1] =~ m/\[([1-6rf])\]/o ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line[-1] =~ /\[([1-6rf])\]/o) { } 151 30 181
528 151 my $fr = $1;
529 $hspData{lframe} = $data{lframe} = (
530 151 ▶ $fr =~ /\d/o
Branch: 2 branches
BranchTrueFalseTotal
$fr =~ /\d/o ? : 0 151 151
$fr <= 3 ? : 0 0 0
531 0 ▶ ? ( $fr <= 3 ? "+$fr" : "-@{[$fr-3]}" )
Branch: 1 branch
BranchTrueFalseTotal
$fr eq 'f' ? : 86 65 151
532 : ( $fr eq 'f' ? '+1' : '-1' )
533 );
534 151 pop @line;
535 }
536 else {
537 30 $hspData{lframe} = $data{lframe} = '0';
538 }
539  
540 181 ▶ if ( $line[-1] =~ m/^\(?(\d+)\)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line[-1] =~ /^\(?(\d+)\)$/) { } 181 0 181
541 181 $data{hit_len} = $1;
542 181 pop @line;
543 181 ▶ if ( $line[-1] =~ m/^\($/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line[-1] =~ /^\($/) 82 99 181
544 82 pop @line;
545 }
546 }
547 else {
548 0 $data{hit_len} = 0;
549 }
550  
551 # rebuild the first part of the line, preserving spaces:
552 181 ($_) = m/^(\S+(?:\s+\S+){$#line})/;
553  
554 181 my ( $id, $desc ) = split( /\s+/, $_, 2 );
555 181 my @pieces = split( /\|/, $id );
556 181 my $acc = pop @pieces;
557 181 $acc =~ s/\.\d+$//;
558  
559 181 @data{qw(id desc acc)} = ( $id, $desc, $acc );
560 181 $data{HSPs} = [ \%hspData ];
561  
562 181 push @hit_signifs, \%data;
563 }
564 }
565 elsif (
566 /^\s*([T]?FAST[XYAF]).+,\s*(\S+)\s*matrix[^\]]+?(xS)?\]\s*ktup:\s*(\d+)/
567 )
568 {
569  
570 5 $self->element(
571 {
572 'Name' => 'Parameters_matrix',
573 'Data' => $2
574 }
575 );
576 5 ▶ $self->element(
Branch: 1 branch
BranchTrueFalseTotal
defined $3 ? : 0 5 5
577 {
578 'Name' => 'Parameters_filter',
579 'Data' => defined $3 ? 1 : 0,
580 }
581 );
582 5 $self->element(
583 {
584 'Name' => 'Parameters_ktup',
585 'Data' => $4
586 }
587 );
588 $self->{'_reporttype'} = $1
589 5 ▶ if ( $self->{'_reporttype'} !~ /FAST[PN]/i );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_reporttype"} =~ /FAST[PN]/i 1 4 5
590  
591 #
592 # get gap-pen line for FASTA33, which is not on the matrix line
593 #
594 # FASTA (3.36 June 2000) function [optimized, BL50 matrix (15:-5)] ktup: 2
595 # join: 36, opt: 24, gap-pen: -12/ -2, width: 16
596 #
597 5 $_ = $self->_readline();
598 5 ▶ if (/(?:gap\-pen|open\/ext):\s+([\-\+]?\d+)\s*\/\s*([\-\+]?\d+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (m[(?:gap\-pen|open/ext):\s+([\-\+]?\d+)\s*/\s*([\-\+]?\d+)]) 5 0 5
599 5 $self->element(
600 {
601 'Name' => 'Parameters_gap-open',
602 'Data' => $1
603 }
604 );
605 5 $self->element(
606 {
607 'Name' => 'Parameters_gap-ext',
608 'Data' => $2
609 }
610 );
611 }
612  
613 $self->element(
614 {
615 'Name' => 'FastaOutput_program',
616 5 'Data' => $self->{'_reporttype'}
617 }
618 );
619  
620 }
621 elsif (/^Algorithm:\s+(\S+)\s+.*\s*\(([^)]+)\)\s+(\S+)/) {
622 $self->{'_reporttype'} = $1
623 4 ▶ if ( $self->{'_reporttype'} !~ /FAST[PN]/i );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_reporttype"} =~ /FAST[PN]/i 1 3 4
624 }
625 elsif ( /^Parameters:/ ) { # FASTA 35.04/FASTA 36
626 4 m/Parameters:\s+(\S+)\s+matrix\s+\([^\)]+\)(xS)?,?\s/;
627 4 $self->element(
628 {
629 'Name' => 'Parameters_matrix',
630 'Data' => $1
631 }
632 );
633 4 ▶ $self->element(
Branch: 1 branch
BranchTrueFalseTotal
defined $2 ? : 0 4 4
634 {
635 'Name' => 'Parameters_filter',
636 'Data' => defined $2 ? $2 : 0,
637 }
638 );
639 4 ▶ if (/ktup:\s(\d+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/ktup:\s(\d+)/) 3 1 4
640 3 $self->element(
641 {
642 'Name' => 'Parameters_ktup',
643 'Data' => $1
644 }
645 );
646 3 ▶ if (/ktup:\s\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/ktup:\s\d+$/) 3 0 3
647 3 $_ = $self->_readline();
648 }
649  
650 }
651 4 ▶ if (/(?:gap\-pen|open\/ext):\s+([\-\+]?\d+)\s*\/\s*([\-\+]?\d+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (m[(?:gap\-pen|open/ext):\s+([\-\+]?\d+)\s*/\s*([\-\+]?\d+)]) 4 0 4
652 4 $self->element(
653 {
654 'Name' => 'Parameters_gap-open',
655 'Data' => $1
656 }
657 );
658 4 $self->element(
659 {
660 'Name' => 'Parameters_gap-ext',
661 'Data' => $2
662 }
663 );
664 }
665 $self->element(
666 {
667 'Name' => 'FastaOutput_program',
668 4 'Data' => $self->{'_reporttype'}
669 }
670 );
671 }
672 elsif (
673 /^\s+ktup:\s*(\d+),/
674 )
675 {
676 0 $self->element(
677 {
678 'Name' => 'Parameters_ktup',
679 'Data' => $1
680 }
681 );
682 }
683 ▶ elsif (/^(>--)$/ || /^>>(?!>)(.+?)\s+(?:\((\d+)\s*(aa|nt)\))?$/) {
Condition100%3/3
/^(>--)$/ or /^>>(?!>)(.+?)\s+(?:\((\d+)\s*(aa|nt)\))?$/
l!l&&r!l&&!r
2181938
MC/DC100%2/2
/^(>--)$/ or /^>>(?!>)(.+?)\s+(?:\((\d+)\s*(aa|nt)\))?$/
/^(>--)$/ /^>>(?!>)(.+?)\s+(?:\((\d+)\s*(aa|nt)\))?$/
Truth table100%3/3
A or B
A= /^(>--)$/B= /^>>(?!>)(.+?)\s+(?:\((\d+)\s*(aa|nt)\))?$/
ABresult
1X1
011
000
684 183 ▶ if ( $self->in_element('hsp') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("hsp")) 174 9 183
685 174 $self->end_element( { 'Name' => 'Hsp' } );
686 }
687  
688 183 my $firstHSP = 0;
689 183 ▶ if ($1 ne ">--") {
Branch: 1 branch
BranchTrueFalseTotal
if ($1 ne '>--') { } 181 2 183
690 181 $firstHSP = 1;
691  
692 181 my ($hit_id, $len, $alphabet) = ($1, $2, $3);
693 181 ▶ if (!$len || !$alphabet) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($len and $alphabet) 0 181 181
Condition33%1/3
$len and $alphabet
!ll&&!rl&&r
00181
MC/DC0%0/2
$len and $alphabet
$len $alphabet
Truth table33%1/3
A and B
A= $lenB= $alphabet
ABresult
0X0
100
111
694 WRAPPED:
695 0 ▶ while (defined($_ = $self->_readline)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = $self->_readline)) 0 0 0
696 0 ▶ if (/(.*?)\s+\((\d+)\s*(aa|nt)\)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/(.*?)\s+\((\d+)\s*(aa|nt)\)/) 0 0 0
697 0 ($len, $alphabet) = ($2, $3);
698 0 ▶ $hit_id .= $1 ? " ".$1 : '';
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 0 0
699 0 last WRAPPED;
700 }
701 0 ▶ if (/^>>(?!>)/) { # too far, throw
Branch: 1 branch
BranchTrueFalseTotal
if (/^>>(?!>)/) 0 0 0
702 0 $self->throw("Couldn't find length, bailing");
703 }
704 }
705 }
706 181 ▶ if ( $self->in_element('hit') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("hit")) 172 9 181
707 172 $self->end_element( { 'Name' => 'Hit' } );
708 172 ▶ shift @hit_signifs if @hit_signifs;
Branch: 1 branch
BranchTrueFalseTotal
if @hit_signifs 172 0 172
709 }
710  
711 181 $self->start_element( { 'Name' => 'Hit' } );
712 181 $self->element(
713 {
714 'Name' => 'Hit_len',
715 'Data' => $len
716 }
717 );
718 181 my ( $id, $desc ) = split( /\s+/, $hit_id, 2 );
719 181 $self->element(
720 {
721 'Name' => 'Hit_id',
722 'Data' => $id
723 }
724 );
725  
726 #$self->debug("Hit ID is $id\n");
727 181 my @pieces = split( /\|/, $id );
728 181 my $acc = pop @pieces;
729 181 $acc =~ s/\.\d+$//;
730 181 $self->element(
731 {
732 'Name' => 'Hit_accession',
733 'Data' => $acc
734 }
735 );
736 181 $self->element(
737 {
738 'Name' => 'Hit_def',
739 'Data' => $desc
740 }
741 );
742 }
743 else {
744 # push @{$hit_signifs[0]->{HSPs}}, $current_hsp;
745 }
746  
747  
748 183 $_ = $self->_readline();
749 183 my ( $score, $bits, $e, $e2 ) = /Z-score: \s* (\S+) \s*
750 (?: bits: \s* (\S+) \s+ )?
751 (?: E|expect ) \s* \((?:\d+)?\) :? \s*(\S+)
752 (?: \s* E2 \s* \(\) :? \s*(\S+) )?
753 /ox;
754 183 ▶ $bits = $score unless defined $bits;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $bits 0 183 183
755  
756 183 my ($v);
757  
758 183 ▶ if ($firstHSP && !$m9HSP) {
Branch: 1 branch
BranchTrueFalseTotal
if ($firstHSP and not $m9HSP) { } 181 2 183
Condition66%2/3
$firstHSP and not $m9HSP
!ll&&!rl&&r
20181
MC/DC50%1/2
$firstHSP and not $m9HSP
$firstHSP not $m9HSP
Truth table66%2/3
A and not(B)
A= $firstHSPB= not $m9HSP
ABresult
0X0
100
111
759 181 $v = shift @{$hit_signifs[0]->{HSPs}}
760 181 ▶ if (@hit_signifs && @{$hit_signifs[0]->{HSPs}});
Branch: 1 branch
BranchTrueFalseTotal
if @hit_signifs and @{$hit_signifs[0]{"HSPs"};} 181 0 181
Condition33%1/3
@hit_signifs and @{$hit_signifs[0]{"HSPs"};}
!ll&&!rl&&r
00181
MC/DC0%0/2
@hit_signifs and @{$hit_signifs[0]{"HSPs"};}
@hit_signifs @{$hit_signifs[0]{"HSPs"};}
Truth table33%1/3
A and B
A= @hit_signifsB= @{$hit_signifs[0]{"HSPs"};}
ABresult
0X0
100
111
761 181 $current_hsp = $v;
762 }
763 else {
764 2 $v = $current_hsp;
765 }
766  
767 183 ▶ if ( defined $v ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $v) 183 0 183
768 183 @{$v}{qw(evalue evalue2 bits z-sc)} = ( $e, $e2, $bits, $score );
769 }
770  
771 183 ▶ if ($firstHSP) {
Branch: 1 branch
BranchTrueFalseTotal
if ($firstHSP) 181 2 183
772 $self->element(
773 {
774 'Name' => 'Hit_signif',
775 181 ▶ 'Data' => $v ? $v->{evalue} : $e
Branch: 1 branch
BranchTrueFalseTotal
$v ? : 181 0 181
776 }
777 );
778 $self->element(
779 {
780 'Name' => 'Hit_score',
781 181 ▶ 'Data' => $v ? $v->{bits} : $bits
Branch: 1 branch
BranchTrueFalseTotal
$v ? : 181 0 181
782 }
783 );
784 }
785  
786 183 $self->start_element( { 'Name' => 'Hsp' } );
787  
788 $self->element(
789 {
790 'Name' => 'Hsp_score',
791 183 ▶ 'Data' => $v ? $v->{'z-sc'} : $score
Branch: 1 branch
BranchTrueFalseTotal
$v ? : 183 0 183
792 }
793 );
794 $self->element(
795 {
796 'Name' => 'Hsp_evalue',
797 183 ▶ 'Data' => $v ? $v->{evalue} : $e
Branch: 1 branch
BranchTrueFalseTotal
$v ? : 183 0 183
798 }
799 );
800 $self->element(
801 {
802 'Name' => 'Hsp_evalue2',
803 'Data' => $v && exists($v->{evalue2}) ? $v->{evalue2} : $e2
804 }
805 183 ▶ ) if (($v && exists($v->{evalue2})) || defined $e2);
Branch: 2 branches
BranchTrueFalseTotal
if $v and exists $v->{"evalue2"} or defined $e2 183 0 183
$v && exists $v->{'evalue2'} ? : 183 0 183
Condition33%3/9
$v and exists $v->{"evalue2"} or defined $e2
l!l&&r!l&&!r
18300
$v and exists $v->{"evalue2"}
!ll&&!rl&&r
00183
$v and exists $v->{"evalue2"}
!ll&&!rl&&r
00183
MC/DC0%0/3
$v and exists $v->{"evalue2"} or defined $e2
$v exists $v->{"evalue2"} defined $e2
Truth table20%1/5
A and B or C
A= $vB= exists $v->{"evalue2"}C= defined $e2
ABCresult
11X1
0X11
1011
0X00
1000
806  
807 $self->element(
808 {
809 'Name' => 'Hsp_bit-score',
810 183 ▶ 'Data' => $v ? $v->{bits} : $bits
Branch: 1 branch
BranchTrueFalseTotal
$v ? : 183 0 183
811 }
812 );
813 183 $_ = $self->_readline();
814  
815 183 ▶ if (s/global\/.* score:\s*(\d+)\;?//) {
Branch: 1 branch
BranchTrueFalseTotal
if (s[global/.* score:\s*(\d+)\;?][]) 0 183 183
816 0 $self->element(
817 {
818 'Name' => 'Hsp_sw-score',
819 'Data' => $1
820 }
821 );
822 }
823 183 ▶ if (s/Smith-Waterman score:\s*(\d+)\;?//) {
Branch: 1 branch
BranchTrueFalseTotal
if (s/Smith-Waterman score:\s*(\d+)\;?//) 94 89 183
824 94 $self->element(
825 {
826 'Name' => 'Hsp_sw-score',
827 'Data' => $1
828 }
829 );
830 }
831 183 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (/ (\d*\.?\d+)\% \s* identity (?:\s* \(\s*(\S+)\% \s* (?:ungapped|similar) \) )? \s* in \s* (\d+) \s+ (?:aa|nt) \s+ overlap \s* \( (\d+) \- (\d+) : (\d+) \- (\d+) \) /x) 183 0 183
832 / (\d*\.?\d+)\% \s* identity
833 (?:\s* \(\s*(\S+)\% \s* (?:ungapped|similar) \) )?
834 \s* in \s* (\d+) \s+ (?:aa|nt) \s+ overlap \s*
835 \( (\d+) \- (\d+) : (\d+) \- (\d+) \)
836 /x
837 )
838 {
839 183 my ( $identper, $gapper, $len, $querystart, $queryend,
840 $hitstart, $hitend )
841 = ( $1, $2, $3, $4, $5, $6, $7 );
842 183 my $ident = sprintf( "%.0f", ( $identper / 100 ) * $len );
843 183 my $positive = sprintf( "%.0f", ( $gapper / 100 ) * $len );
844  
845 183 $self->element(
846 {
847 'Name' => 'Hsp_identity',
848 'Data' => $ident
849 }
850 );
851 183 $self->element(
852 {
853 'Name' => 'Hsp_positive',
854 'Data' => $positive
855 }
856 );
857 183 $self->element(
858 {
859 'Name' => 'Hsp_align-len',
860 'Data' => $len
861 }
862 );
863  
864 183 $self->element(
865 {
866 'Name' => 'Hsp_query-from',
867 'Data' => $querystart
868 }
869 );
870 183 $self->element(
871 {
872 'Name' => 'Hsp_query-to',
873 'Data' => $queryend
874 }
875 );
876 183 $self->element(
877 {
878 'Name' => 'Hsp_hit-from',
879 'Data' => $hitstart
880 }
881 );
882 183 $self->element(
883 {
884 'Name' => 'Hsp_hit-to',
885 'Data' => $hitend
886 }
887 );
888  
889 }
890  
891 183 ▶ if ($v) {
Branch: 1 branch
BranchTrueFalseTotal
if ($v) { } 183 0 183
892 $self->element(
893 { 'Name' => 'Hsp_querygaps', 'Data' => $v->{qgaps} } )
894 183 ▶ if exists $v->{qgaps};
Branch: 1 branch
BranchTrueFalseTotal
if exists $v->{"qgaps"} 1 182 183
895 $self->element(
896 { 'Name' => 'Hsp_hitgaps', 'Data' => $v->{lgaps} } )
897 183 ▶ if exists $v->{lgaps};
Branch: 1 branch
BranchTrueFalseTotal
if exists $v->{"lgaps"} 1 182 183
898  
899 183 ▶ if ( $self->{'_reporttype'} =~ m/^FAST[NXY]$/o ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_reporttype'} =~ /^FAST[NXY]$/o) { } 150 33 183
900 150 ▶ if ( 8 == scalar grep { exists $v->{$_} }
Branch: 1 branch
BranchTrueFalseTotal
if (8 == scalar grep({exists $v->{$_};} 'an0', 'ax0', 'pn0', 'px0', 'an1', 'ax1', 'pn1', 'px1')) { } 1 149 150
901 qw(an0 ax0 pn0 px0 an1 ax1 pn1 px1) )
902 {
903 1 ▶ if ( $v->{ax0} < $v->{an0} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($v->{'ax0'} < $v->{'an0'}) { } 0 1 1
904 0 $self->element(
905 {
906 'Name' => 'Hsp_query-frame',
907 'Data' =>
908 0 "-@{[(($v->{px0} - $v->{ax0}) % 3) + 1]}"
909 }
910 );
911 }
912 else {
913 1 $self->element(
914 {
915 'Name' => 'Hsp_query-frame',
916 'Data' =>
917 1 "+@{[(($v->{an0} - $v->{pn0}) % 3) + 1]}"
918 }
919 );
920 }
921 1 ▶ if ( $v->{ax1} < $v->{an1} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($v->{'ax1'} < $v->{'an1'}) { } 0 1 1
922 0 $self->element(
923 {
924 'Name' => 'Hsp_hit-frame',
925 'Data' =>
926 0 "-@{[(($v->{px1} - $v->{ax1}) % 3) + 1]}"
927 }
928 );
929 }
930 else {
931 1 $self->element(
932 {
933 'Name' => 'Hsp_hit-frame',
934 'Data' =>
935 1 "+@{[(($v->{an1} - $v->{pn1}) % 3) + 1]}"
936 }
937 );
938 }
939 }
940 else {
941 $self->element(
942 {
943 'Name' => 'Hsp_query-frame',
944 'Data' => $v->{lframe}
945 }
946 149 );
947 149 $self->element(
948 { 'Name' => 'Hsp_hit-frame', 'Data' => 0 } );
949 }
950 }
951 else {
952 33 $self->element(
953 { 'Name' => 'Hsp_query-frame', 'Data' => 0 } );
954 $self->element(
955 33 { 'Name' => 'Hsp_hit-frame', 'Data' => $v->{lframe} } );
956 }
957  
958 }
959 else {
960 0 $self->warn("unable to parse FASTA score line: $_");
961 }
962 }
963 elsif (/\d+\s*residues\s*in\s*\d+\s*query\s*sequences/) {
964 9 ▶ if ( $self->in_element('hsp') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("hsp")) 9 0 9
965 9 $self->end_element( { 'Name' => 'Hsp' } );
966 }
967 9 ▶ if ( $self->in_element('hit') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("hit")) 9 0 9
968 9 $self->end_element( { 'Name' => 'Hit' } );
969 9 ▶ shift @hit_signifs if @hit_signifs;
Branch: 1 branch
BranchTrueFalseTotal
if @hit_signifs 9 0 9
970  
971 }
972  
973 # $_ = $self->_readline();
974 # my ( $liblen,$libsize) = /(\d+)\s+residues\s*in(\d+)\s*library/;
975 # fast forward to the end of the file as there is
976 # nothing else left to do with this file and want to be sure and
977 # reset it
978 9 ▶ while ( defined( $_ = $self->_readline() ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = $self->_readline)) 54 0 54
979 54 ▶ last if (/^Function used was/);
Branch: 1 branch
BranchTrueFalseTotal
if /^Function used was/ 9 45 54
980 45 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)? sequence/iox or /(\S+)\s+compares\s+a/io) 0 45 45
Condition33%1/3
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)? sequence/iox or /(\S+)\s+compares\s+a/io
l!l&&r!l&&!r
0045
MC/DC0%0/2
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)? sequence/iox or /(\S+)\s+compares\s+a/io
/(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)? sequence/iox /(\S+)\s+compares\s+a/io
Truth table33%1/3
A or B
A= /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)? sequence/ioxB= /(\S+)\s+compares\s+a/io
ABresult
1X1
011
000
981 /(\S+)\s+searches\s+a\s+(protein\s+or\s+DNA\s+)?
982 sequence/oxi || /(\S+)\s+compares\s+a/oi
983 )
984 {
985 0 $self->_pushback($_);
986 }
987 }
988  
989 9 ▶ $self->_processHits(@hit_signifs) if @hit_signifs;
Branch: 1 branch
BranchTrueFalseTotal
if @hit_signifs 0 9 9
990  
991 9 $self->end_element( { 'Name' => 'FastaOutput' } );
992 9 return $self->end_document();
993 }
994 elsif (/^\s*\d+\s*>>>/) {
995 0 ▶ if ( $self->within_element('FastaOutput') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->within_element('FastaOutput')) { } 0 0 0
996 0 ▶ if ( $self->in_element('hsp') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("hsp")) 0 0 0
997 0 $self->end_element( { 'Name' => 'Hsp' } );
998 }
999 0 ▶ if ( $self->in_element('hit') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("hit")) 0 0 0
1000 0 $self->end_element( { 'Name' => 'Hit' } );
1001 0 ▶ shift @hit_signifs if @hit_signifs;
Branch: 1 branch
BranchTrueFalseTotal
if @hit_signifs 0 0 0
1002  
1003 }
1004  
1005 0 ▶ $self->_processHits(@hit_signifs) if (@hit_signifs);
Branch: 1 branch
BranchTrueFalseTotal
if @hit_signifs 0 0 0
1006  
1007 0 $self->end_element( { 'Name' => 'FastaOutput' } );
1008 0 $self->_pushback($_);
1009 0 return $self->end_document();
1010 }
1011 else {
1012 0 $self->start_element( { 'Name' => 'FastaOutput' } );
1013 0 $self->{'_result_count'}++;
1014 0 $seentop = 1;
1015 $self->element(
1016 {
1017 'Name' => 'FastaOutput_program',
1018 0 'Data' => $self->{'_reporttype'}
1019 }
1020 );
1021 $self->element(
1022 {
1023 'Name' => 'FastaOutput_version',
1024 0 'Data' => $self->{'_version'}
1025 }
1026 );
1027  
1028 0 my ( $type, $querylen, $querytype, $querydef );
1029  
1030 0 ▶ if (/^\s*\d+\s*>>>(.*)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*\d+\s*>>>(.*)/) 0 0 0
1031 0 $querydef = $1;
1032 0 ▶ if ( $querydef =~ /^(.*?)\s+(?:\-\s+)?(\d+)\s+(aa|nt).*$/o )
Branch: 1 branch
BranchTrueFalseTotal
if ($querydef =~ /^(.*?)\s+(?:\-\s+)?(\d+)\s+(aa|nt).*$/o) 0 0 0
1033 {
1034 0 ( $querydef, $querylen, $querytype ) = ( $1, $2, $3 );
1035 }
1036 }
1037  
1038 0 ▶ if ( $self->{'_reporttype'}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_reporttype"} and $self->{"_reporttype"} eq "FASTA") 0 0 0
Condition0%0/3
$self->{"_reporttype"} and $self->{"_reporttype"} eq "FASTA"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"_reporttype"} and $self->{"_reporttype"} eq "FASTA"
$self->{"_reporttype"} $self->{"_reporttype"} eq "FASTA"
Truth table0%0/3
A and B
A= $self->{"_reporttype"}B= $self->{"_reporttype"} eq "FASTA"
ABresult
0X0
100
111
1039 && $self->{'_reporttype'} eq 'FASTA' )
1040 {
1041 0 ▶ if ( $querytype eq 'nt' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($querytype eq 'nt') { } 0 0 0
elsif ($querytype eq 'aa') { } 0 0 0
1042 0 $self->{'_reporttype'} = 'FASTN';
1043 }
1044 elsif ( $querytype eq 'aa' ) {
1045 0 $self->{'_reporttype'} = 'FASTP';
1046 }
1047 }
1048 0 my ( $name, $descr ) =
1049 ( $querydef =~ m/^(\S+)(?:\s+(.*))?\s*$/o );
1050 0 $self->element(
1051 {
1052 'Name' => 'FastaOutput_query-def',
1053 'Data' => $name
1054 }
1055 );
1056 0 $self->element(
1057 {
1058 'Name' => 'FastaOutput_querydesc',
1059 'Data' => $descr
1060 }
1061 );
1062 0 ▶ if ($querylen) {
Branch: 1 branch
BranchTrueFalseTotal
if ($querylen) { } 0 0 0
1063 0 $self->element(
1064 {
1065 'Name' => 'FastaOutput_query-len',
1066 'Data' => $querylen
1067 }
1068 );
1069 }
1070 else {
1071 0 $self->warn("unable to find and set query length");
1072 }
1073 0 ▶ if ( defined( $_ = $self->_readline() )
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = $self->_readline) and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)/) 0 0 0
Condition0%0/6
defined($_ = $self->_readline) and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)/
!ll&&!rl&&r
000
/^\s*vs\s+(\S+)/ or /^Library:\s+(\S+)/
l!l&&r!l&&!r
000
MC/DC0%0/3
defined($_ = $self->_readline) and /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)/
defined($_ = $self->_readline) /^\s*vs\s+(\S+)/ /^Library:\s+(\S+)/
Truth table0%0/4
A and B or C
A= defined($_ = $self->_readline)B= /^\s*vs\s+(\S+)/C= /^Library:\s+(\S+)/
ABCresult
0XX0
1000
11X1
1011
1074 && ( /^\s*vs\s+(\S+)/ || /^Library:\s+(\S+)/ ) )
1075 {
1076 0 $self->element(
1077 {
1078 'Name' => 'FastaOutput_db',
1079 'Data' => $1
1080 }
1081 );
1082 }
1083  
1084 }
1085 }
1086 elsif ( $self->in_element('hsp') ) {
1087 689 my @data = ( [], [], [] );
1088 689 my $count = 0;
1089 689 my $len = $self->idlength + 1;
1090 689 my ($seq1_id);
1091 689 ▶ while ( defined($_) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) 4268 0 4268
1092 4268 chomp;
1093 #$self->debug("$count $_\n");
1094 4268 ▶ if (/residues in \d+\s+query\s+sequences/o) {
Branch: 4 branches
BranchTrueFalseTotal
if (/residues in \d+\s+query\s+sequences/o) { } 9 4259 4268
elsif (m[^>>>(\*\*\*|///|<<<)]o) { } 0 4259 4259
elsif (/^>>/o) { } 0 4259 4259
elsif (/^\s*\d+\s*>>>/o) { } 0 4259 4259
1095 9 $self->_pushback($_);
1096 9 last;
1097 }
1098 elsif (/^>>>(\*\*\*|\/\/\/|<<<)/o) {
1099 0 $self->end_element( { Name => "Hsp" } );
1100 0 last;
1101 }
1102 elsif (/^>>/o) {
1103 0 $self->_pushback($_);
1104 0 last;
1105 }
1106 elsif (/^\s*\d+\s*>>>/o) {
1107 0 $self->_pushback($_);
1108 0 last;
1109 }
1110 4259 ▶ if ( $count == 0 ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($count == 0) { } 883 3376 4259
elsif ($count == 1 or $count == 3) { } 1352 2024 3376
elsif ($count == 2) { } 680 1344 2024
1111 883 ▶ if (/^(\S+)\s+/) {
Branch: 3 branches
BranchTrueFalseTotal
if (/^(\S+)\s+/) { } 0 883 883
elsif (/^\s+\d+/ or /^\s+$/) { } 680 203 883
elsif (length $_ == 0) { } 203 0 203
1112 0 $self->_pushback($_);
1113 0 $count = 2;
1114 }
1115 ▶ elsif ( /^\s+\d+/ || /^\s+$/ ) {
Condition100%3/3
/^\s+\d+/ or /^\s+$/
l!l&&r!l&&!r
6764203
MC/DC100%2/2
/^\s+\d+/ or /^\s+$/
/^\s+\d+/ /^\s+$/
Truth table100%3/3
A or B
A= /^\s+\d+/B= /^\s+$/
ABresult
1X1
011
000
1116  
1117 # do nothing, this is really a 0 line
1118 }
1119 elsif ( length($_) == 0 ) {
1120 203 $count = -1;
1121 }
1122 else {
1123 0 $self->_pushback($_);
1124 0 $count = 0;
1125 }
1126 }
1127 ▶ elsif ( $count == 1 || $count == 3 ) {
Condition100%3/3
$count == 1 or $count == 3
l!l&&r!l&&!r
6806722024
MC/DC100%2/2
$count == 1 or $count == 3
$count == 1 $count == 3
Truth table100%3/3
A or B
A= $count == 1B= $count == 3
ABresult
1X1
011
000
1128 1352 ▶ if (/^(\S+)\s+/) {
Branch: 4 branches
BranchTrueFalseTotal
if (/^(\S+)\s+/) { } 1352 0 1352
elsif (/^\s+(\d+)/) { } 0 0 0
elsif (/^\s+$/ or length $_ == 0) { } 0 0 0
elsif (/\s+\S+fasta3\d\s+/) { } 0 0 0
1129 1352 ▶ $len = CORE::length($1) if $len < CORE::length($1);
Branch: 1 branch
BranchTrueFalseTotal
if $len < length $1 0 1352 1352
1130 1352 s/\s+$//; # trim trailing spaces,we don't want them
1131 1352 push @{ $data[ $count - 1 ] }, substr( $_, $len );
1132 }
1133 elsif (/^\s+(\d+)/) {
1134 0 $count = -1;
1135 0 $self->_pushback($_);
1136 }
1137 ▶ elsif ( /^\s+$/ || length($_) == 0 ) {
Condition0%0/3
/^\s+$/ or length $_ == 0
l!l&&r!l&&!r
000
MC/DC0%0/2
/^\s+$/ or length $_ == 0
/^\s+$/ length $_ == 0
Truth table0%0/3
A or B
A= /^\s+$/B= length $_ == 0
ABresult
1X1
011
000
1138 0 $count = 5;
1139  
1140 # going to skip these
1141 }
1142 elsif ( /\s+\S+fasta3\d\s+/) {
1143 # this is something that looks like a path but contains
1144 # the fasta3x executable string, such as:
1145 # /usr/local/fasta3/bin/fasta35 -n -U -Q -H -A -E 2.0 -C 19 -m 0 -m 9i test.fa ../other_mirs.fa -O test.fasta35
1146 0 last;
1147 }
1148 else {
1149 0 $self->throw(
1150 "Unrecognized alignment line ($count) '$_'");
1151 }
1152 }
1153 elsif ( $count == 2 ) {
1154 680 ▶ if (/^\s+\d+\s+/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s+\d+\s+/) { } 0 680 680
1155 0 ▶ $self->warn("$_\n") if $self->verbose > 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose > 0 0 0 0
1156  
1157 # we are on a Subject part of the alignment
1158 # but we THOUGHT we were on the Query
1159 # move that last line to the proper place
1160 0 push @{ $data[2] }, pop @{ $data[0] };
1161 0 $count = 4;
1162 }
1163 else {
1164  
1165 # toss the first IDLENGTH characters of the line
1166 680 ▶ if ( length($_) >= $len ) {
Branch: 2 branches
BranchTrueFalseTotal
if (length $_ >= $len) { } 672 8 680
elsif (/^$/) { } 8 0 8
1167 672 push @{ $data[ $count - 1 ] }, substr( $_, $len );
1168 }
1169 elsif (/^$/) { # fix issue #255
1170 8 $count = 5;
1171 }
1172 }
1173 }
1174 4259 ▶ last if ( $count++ >= 5 );
Branch: 1 branch
BranchTrueFalseTotal
if $count++ >= 5 680 3579 4259
1175 3579 $_ = $self->_readline();
1176 }
1177 689 ▶ if ( @{ $data[0] } || @{ $data[2] } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$data[0];} or @{$data[2];}) 680 9 689
Condition66%2/3
@{$data[0];} or @{$data[2];}
l!l&&r!l&&!r
68009
MC/DC50%1/2
@{$data[0];} or @{$data[2];}
@{$data[0];} @{$data[2];}
Truth table66%2/3
A or B
A= @{$data[0];}B= @{$data[2];}
ABresult
1X1
011
000
1178 $self->characters(
1179 {
1180 'Name' => 'Hsp_qseq',
1181 680 'Data' => join( '', @{ $data[0] } )
1182 }
1183 );
1184 $self->characters(
1185 {
1186 'Name' => 'Hsp_midline',
1187 680 'Data' => join( '', @{ $data[1] } )
1188 }
1189 );
1190 $self->characters(
1191 {
1192 'Name' => 'Hsp_hseq',
1193 680 'Data' => join( '', @{ $data[2] } )
1194 }
1195 );
1196 }
1197 }
1198 else {
1199 240 ▶ if ( !$seentop ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($seentop) 1 239 240
1200 1 $self->debug($_);
1201 #$self->warn("unrecognized FASTA Family report file!");
1202 #return;
1203 }
1204 }
1205 }
1206 4 ▶ if ( $self->in_element('result') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("result")) 0 4 4
1207 0 ▶ if ( $self->in_element('hsp') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("hsp")) 0 0 0
1208 0 $self->end_element( { 'Name' => 'Hsp' } );
1209 }
1210 0 ▶ if ( $self->in_element('hit') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("hit")) 0 0 0
1211 0 $self->end_element( { 'Name' => 'Hit' } );
1212 0 ▶ shift @hit_signifs if @hit_signifs;
Branch: 1 branch
BranchTrueFalseTotal
if @hit_signifs 0 0 0
1213 }
1214 0 $self->end_element( { 'Name' => 'FastaOutput' } );
1215 }
1216 4 return $self->end_document();
1217 }
1218  
1219 =head2 start_element
1220  
1221 Title : start_element
1222 Usage : $eventgenerator->start_element
1223 Function: Handles a start element event
1224 Returns : none
1225 Args : hashref with at least 2 keys 'Data' and 'Name'
1226  
1227  
1228 =cut
1229  
1230 4644 ▶sub start_element {
Subroutine start_element: called CC=4 SCAR=13.9
Pod documented
1231 4644 my ( $self, $data ) = @_;
1232  
1233 # we currently don't care about attributes
1234 4644 my $nm = $data->{'Name'};
1235 4644 ▶ if ( my $type = $MODEMAP{$nm} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $type = $Bio::SearchIO::fasta::MODEMAP{$nm}) 373 4271 4644
1236 373 $self->_mode($type);
1237 373 ▶ if ( my $handler = $self->_will_handle($type) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $handler = $self->_will_handle($type)) 373 0 373
1238 373 my $func = sprintf( "start_%s", lc $type );
1239 373 $handler->$func( $data->{'Attributes'} );
1240 }
1241 373 unshift @{ $self->{'_elements'} }, $type;
1242 }
1243 4644 ▶ if ( $nm eq 'FastaOutput' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nm eq "FastaOutput") 9 4635 4644
1244 9 $self->{'_values'} = {};
1245 9 $self->{'_result'} = undef;
1246 9 $self->{'_mode'} = '';
1247 }
1248  
1249 }
1250  
1251 =head2 end_element
1252  
1253 Title : start_element
1254 Usage : $eventgenerator->end_element
1255 Function: Handles an end element event
1256 Returns : none
1257 Args : hashref with at least 2 keys 'Data' and 'Name'
1258  
1259  
1260 =cut
1261  
1262 4644 ▶sub end_element {
Subroutine end_element: called CC=8 SCAR=20.8
Pod documented
1263 4644 my ( $self, $data ) = @_;
1264 4644 my $nm = $data->{'Name'};
1265 4644 my $rc;
1266  
1267 # Hsp are sort of weird, in that they end when another
1268 # object begins so have to detect this in end_element for now
1269 4644 ▶ if ( $nm eq 'Hsp' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nm eq "Hsp") 183 4461 4644
1270 183 foreach (qw(Hsp_qseq Hsp_midline Hsp_hseq)) {
1271 $self->element(
1272 {
1273 'Name' => $_,
1274 549 'Data' => $self->{'_last_hspdata'}->{$_}
1275 }
1276 );
1277 }
1278 183 $self->{'_last_hspdata'} = {};
1279 }
1280  
1281 4644 ▶ if ( my $type = $MODEMAP{$nm} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $type = $Bio::SearchIO::fasta::MODEMAP{$nm}) { } 373 4271 4644
elsif ($Bio::SearchIO::fasta::MAPPING{$nm}) { } 4271 0 4271
1282 373 ▶ if ( my $handler = $self->_will_handle($type) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $handler = $self->_will_handle($type)) 373 0 373
1283 373 my $func = sprintf( "end_%s", lc $type );
1284 373 $rc = $handler->$func( $self->{'_reporttype'}, $self->{'_values'} );
1285 }
1286 373 shift @{ $self->{'_elements'} };
1287  
1288 }
1289 elsif ( $MAPPING{$nm} ) {
1290 4271 ▶ if ( ref( $MAPPING{$nm} ) =~ /hash/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($Bio::SearchIO::fasta::MAPPING{$nm}) =~ /hash/i) { } 80 4191 4271
1291 80 my $key = ( keys %{ $MAPPING{$nm} } )[0];
1292 $self->{'_values'}->{$key}->{ $MAPPING{$nm}->{$key} } =
1293 80 $self->{'_last_data'};
1294 }
1295 else {
1296 4191 $self->{'_values'}->{ $MAPPING{$nm} } = $self->{'_last_data'};
1297 }
1298 }
1299 else {
1300 0 $self->warn("unknown nm $nm, ignoring\n");
1301 }
1302 4644 $self->{'_last_data'} = ''; # remove read data if we are at
1303 # end of an element
1304 4644 ▶ $self->{'_result'} = $rc if ( $nm eq 'FastaOutput' );
Branch: 1 branch
BranchTrueFalseTotal
if $nm eq "FastaOutput" 9 4635 4644
1305 4644 return $rc;
1306  
1307 }
1308  
1309 =head2 element
1310  
1311 Title : element
1312 Usage : $eventhandler->element({'Name' => $name, 'Data' => $str});
1313 Function: Convience method that calls start_element, characters, end_element
1314 Returns : none
1315 Args : Hash ref with the keys 'Name' and 'Data'
1316  
1317  
1318 =cut
1319  
1320 4271 ▶sub element {
Subroutine element: called CC=1 SCAR=0.0
Pod documented
1321 4271 my ( $self, $data ) = @_;
1322 4271 $self->start_element($data);
1323 4271 $self->characters($data);
1324 4271 $self->end_element($data);
1325 }
1326  
1327 =head2 characters
1328  
1329 Title : characters
1330 Usage : $eventgenerator->characters($str)
1331 Function: Send a character events
1332 Returns : none
1333 Args : string
1334  
1335  
1336 =cut
1337  
1338 6311 ▶sub characters {
Subroutine characters: called CC=6 SCAR=17.9
Pod documented
1339 6311 my ( $self, $data ) = @_;
1340  
1341 6311 ▶ return unless ( defined $data->{'Data'} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data->{"Data"} 186 6125 6311
1342 6125 ▶ if ( $data->{'Data'} =~ /^\s+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{"Data"} =~ /^\s+$/) 65 6060 6125
1343 65 ▶ return unless $data->{'Name'} =~ /Hsp\_(midline|qseq|hseq)/;
Branch: 1 branch
BranchTrueFalseTotal
unless $data->{"Name"} =~ /Hsp\_(midline|qseq|hseq)/ 0 65 65
1344 }
1345  
1346 6125 ▶ if ( $self->in_element('hsp')
Branch: 1 branch
BranchTrueFalseTotal
if ($self->in_element("hsp") and $data->{"Name"} =~ /Hsp\_(qseq|hseq|midline)/) 2589 3536 6125
Condition100%3/3
$self->in_element("hsp") and $data->{"Name"} =~ /Hsp\_(qseq|hseq|midline)/
!ll&&!rl&&r
124422922589
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)/
ABresult
0X0
100
111
1347 && $data->{'Name'} =~ /Hsp\_(qseq|hseq|midline)/ )
1348 {
1349  
1350 2589 $self->{'_last_hspdata'}->{ $data->{'Name'} } .= $data->{'Data'};
1351 }
1352  
1353 6125 $self->{'_last_data'} = $data->{'Data'};
1354 }
1355  
1356 =head2 _mode
1357  
1358 Title : _mode
1359 Usage : $obj->_mode($newval)
1360 Function:
1361 Example :
1362 Returns : value of _mode
1363 Args : newvalue (optional)
1364  
1365  
1366 =cut
1367  
1368 373 ▶sub _mode {
Subroutine _mode: called CC=2 SCAR=7.0
1369 373 my ( $self, $value ) = @_;
1370 373 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 373 0 373
1371 373 $self->{'_mode'} = $value;
1372 }
1373 373 return $self->{'_mode'};
1374 }
1375  
1376 =head2 within_element
1377  
1378 Title : within_element
1379 Usage : if( $eventgenerator->within_element($element) ) {}
1380 Function: Test if we are within a particular element
1381 This is different than 'in' because within can be tested
1382 for a whole block.
1383 Returns : boolean
1384 Args : string element name
1385  
1386  
1387 =cut
1388  
1389 0 ▶sub within_element {
Subroutine within_element: not called CC=7 SCAR=40.3
Pod documented
1390 0 my ( $self, $name ) = @_;
1391 return 0
1392 if (!defined $name && !defined $self->{'_elements'}
1393 0 ▶ || scalar @{ $self->{'_elements'} } == 0 );
Branch: 1 branch
BranchTrueFalseTotal
if not defined $name || defined $self->{"_elements"} or scalar @{$self->{"_elements"};} == 0 0 0 0
Condition0%0/6
not defined $name || defined $self->{"_elements"} or scalar @{$self->{"_elements"};} == 0
l!l&&r!l&&!r
000
defined $name || defined $self->{'_elements'}
l!l&&r!l&&!r
000
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
ABCresult
00X1
1X11
0111
1X00
0100
1394 0 foreach ( @{ $self->{'_elements'} } ) {
1395 0 ▶ if ( $_ eq $name || $_ eq $MODEMAP{$name} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ eq $name or $_ eq $Bio::SearchIO::fasta::MODEMAP{$name}) 0 0 0
Condition0%0/3
$_ eq $name or $_ eq $Bio::SearchIO::fasta::MODEMAP{$name}
l!l&&r!l&&!r
000
MC/DC0%0/2
$_ eq $name or $_ eq $Bio::SearchIO::fasta::MODEMAP{$name}
$_ eq $name $_ eq $Bio::SearchIO::fasta::MODEMAP{$name}
Truth table0%0/3
A or B
A= $_ eq $nameB= $_ eq $Bio::SearchIO::fasta::MODEMAP{$name}
ABresult
1X1
011
000
1396 0 return 1;
1397 }
1398 }
1399 0 return 0;
1400 }
1401  
1402 =head2 in_element
1403  
1404 Title : in_element
1405 Usage : if( $eventgenerator->in_element($element) ) {}
1406 Function: Test if we are in a particular element
1407 This is different than 'in' because within can be tested
1408 for a whole block.
1409 Returns : boolean
1410 Args : string element name
1411  
1412  
1413 =cut
1414  
1415 8633 ▶sub in_element {
Subroutine in_element: called CC=4 SCAR=14.6
Pod documented
1416 8633 my ( $self, $name ) = @_;
1417 8633 ▶ return 0 if !defined $self->{'_elements'}->[0];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_elements"}[0] 16 8617 8633
1418 return (
1419 $self->{'_elements'}->[0] eq $name
1420 || ( exists $MODEMAP{$name}
1421 8617 ▶ && $self->{'_elements'}->[0] eq $MODEMAP{$name} )
Condition50%3/6
$self->{'_elements'}[0] eq $name || exists $Bio::SearchIO::fasta::MODEMAP{$name} && $self->{'_elements'}[0] eq $Bio::SearchIO::fasta::MODEMAP{$name}
l!l&&r!l&&!r
680601811
exists $Bio::SearchIO::fasta::MODEMAP{$name} and $self->{"_elements"}[0] eq $Bio::SearchIO::fasta::MODEMAP{$name}
!ll&&!rl&&r
181100
MC/DC33%1/3
$self->{'_elements'}[0] eq $name || exists $Bio::SearchIO::fasta::MODEMAP{$name} && $self->{'_elements'}[0] eq $Bio::SearchIO::fasta::MODEMAP{$name}
$self->{'_elements'}[0] eq $name exists $Bio::SearchIO::fasta::MODEMAP{$name} $self->{"_elements"}[0] eq $Bio::SearchIO::fasta::MODEMAP{$name}
Truth table50%2/4
A || B and C
A= $self->{'_elements'}[0] eq $nameB= exists $Bio::SearchIO::fasta::MODEMAP{$name}C= $self->{"_elements"}[0] eq $Bio::SearchIO::fasta::MODEMAP{$name}
ABCresult
1XX1
0111
00X0
0100
1422 );
1423 }
1424  
1425 =head2 start_document
1426  
1427 Title : start_document
1428 Usage : $eventgenerator->start_document
1429 Function: Handles a start document event
1430 Returns : none
1431 Args : none
1432  
1433  
1434 =cut
1435  
1436 13 ▶sub start_document {
Subroutine start_document: called CC=1 SCAR=0.0
Pod documented
1437 13 my ($self) = @_;
1438 13 $self->{'_lasttype'} = '';
1439 13 $self->{'_values'} = {};
1440 13 $self->{'_result'} = undef;
1441 13 $self->{'_mode'} = '';
1442 13 $self->{'_elements'} = [];
1443 }
1444  
1445 =head2 end_document
1446  
1447 Title : end_document
1448 Usage : $eventgenerator->end_document
1449 Function: Handles an end document event
1450 Returns : Bio::Search::Result::ResultI object
1451 Args : none
1452  
1453  
1454 =cut
1455  
1456 13 ▶sub end_document {
Subroutine end_document: called CC=1 SCAR=0.0
Pod documented
1457 13 my ( $self, @args ) = @_;
1458 13 return $self->{'_result'};
1459 }
1460  
1461 =head2 idlength
1462  
1463 Title : idlength
1464 Usage : $obj->idlength($newval)
1465 Function: Internal storage of the length of the ID desc
1466 in the HSP alignment blocks. Defaults to
1467 $IDLENGTH class variable value
1468 Returns : value of idlength
1469 Args : newvalue (optional)
1470  
1471  
1472 =cut
1473  
1474 698 ▶sub idlength {
Subroutine idlength: called CC=3 SCAR=11.3
Pod documented
1475 698 my ( $self, $value ) = @_;
1476 698 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 9 689 698
1477 9 $self->{'_idlength'} = $value;
1478 }
1479 698 ▶ return $self->{'_idlength'} || $IDLENGTH;
Condition33%1/3
$self->{'_idlength'} || $Bio::SearchIO::fasta::IDLENGTH
l!l&&r!l&&!r
69800
MC/DC0%0/2
$self->{'_idlength'} || $Bio::SearchIO::fasta::IDLENGTH
$self->{'_idlength'} $Bio::SearchIO::fasta::IDLENGTH
Truth table33%1/3
A || B
A= $self->{'_idlength'}B= $Bio::SearchIO::fasta::IDLENGTH
ABresult
1X1
011
000
1480 }
1481  
1482 =head2 result_count
1483  
1484 Title : result_count
1485 Usage : my $count = $searchio->result_count
1486 Function: Returns the number of results we have processed
1487 Returns : integer
1488 Args : none
1489  
1490 =cut
1491  
1492 0 ▶sub result_count {
Subroutine result_count: not called CC=1 SCAR=6.9
Pod documented
1493 0 my $self = shift;
1494 0 return $self->{'_result_count'};
1495 }
1496  
1497 9 ▶sub attach_EventHandler {
Subroutine attach_EventHandler: called CC=1 SCAR=0.0
Pod documented
1498 9 my ( $self, $handler ) = @_;
1499  
1500 9 $self->SUPER::attach_EventHandler($handler);
1501  
1502 # Optimization: caching the EventHandler since it is used a lot
1503 # during the parse.
1504  
1505 9 $self->{'_handler_cache'} = $handler;
1506 9 return;
1507 }
1508  
1509 =head2 _will_handle
1510  
1511 Title : _will_handle
1512 Usage : Private method. For internal use only.
1513 if( $self->_will_handle($type) ) { ... }
1514 Function: Provides an optimized way to check whether or not an element of a
1515 given type is to be handled.
1516 Returns : Reference to EventHandler object if the element type is to be handled.
1517 undef if the element type is not to be handled.
1518 Args : string containing type of element.
1519  
1520 Optimizations:
1521  
1522 =over 2
1523  
1524 =item 1
1525  
1526 Using the cached pointer to the EventHandler to minimize repeated
1527 lookups.
1528  
1529 =item 2
1530  
1531 Caching the will_handle status for each type that is encountered so
1532 that it only need be checked by calling
1533 handler-E<gt>will_handle($type) once.
1534  
1535 =back
1536  
1537 This does not lead to a major savings by itself (only 5-10%). In
1538 combination with other optimizations, or for large parse jobs, the
1539 savings good be significant.
1540  
1541 To test against the unoptimized version, remove the parentheses from
1542 around the third term in the ternary " ? : " operator and add two
1543 calls to $self-E<gt>_eventHandler().
1544  
1545 =cut
1546  
1547 746 ▶sub _will_handle {
Subroutine _will_handle: called CC=3 SCAR=11.0
1548 746 my ( $self, $type ) = @_;
1549 746 my $handler = $self->{'_handler_cache'};
1550 my $will_handle =
1551 defined( $self->{'_will_handle_cache'}->{$type} )
1552 ? $self->{'_will_handle_cache'}->{$type}
1553 746 ▶ : ( $self->{'_will_handle_cache'}->{$type} =
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_will_handle_cache'}{$type} ? : 719 27 746
1554 $handler->will_handle($type) );
1555  
1556 746 ▶ return $will_handle ? $handler : undef;
Branch: 1 branch
BranchTrueFalseTotal
$will_handle ? : 746 0 746
1557 }
1558  
1559 =head2 _processHits
1560  
1561 Title : _processHits
1562 Usage : Private method. For internal use only.
1563 Function: Process/report any hits/hsps we saw in the top table, not in alignments.
1564 Returns : nothing.
1565 Args : array of hits to process.
1566  
1567 =cut
1568  
1569 0 ▶sub _processHits {
Subroutine _processHits: not called CC=34 SCAR=70.8
1570  
1571 0 my ($self, @hit_signifs) = @_;
1572  
1573 # process remaining best hits
1574 0 for my $hit (@hit_signifs) {
1575  
1576 # Hsp_score Hsp_evalue Hsp_bit-score
1577 # Hsp_sw-score Hsp_gaps Hsp_identity Hsp_positive
1578 # Hsp_align-len Hsp_query-from Hsp_query-to
1579 # Hsp_hit-from Hsp_hit-to Hsp_qseq Hsp_midline
1580  
1581 0 $self->start_element( { 'Name' => 'Hit' } );
1582 $self->element(
1583 {
1584 'Name' => 'Hit_len',
1585 'Data' => $hit->{hit_len}
1586 }
1587 0 ▶ ) if exists $hit->{hit_len};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hit->{"hit_len"} 0 0 0
1588 $self->element(
1589 {
1590 'Name' => 'Hit_id',
1591 'Data' => $hit->{id}
1592 }
1593 0 ▶ ) if exists $hit->{id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hit->{"id"} 0 0 0
1594 $self->element(
1595 {
1596 'Name' => 'Hit_accession',
1597 'Data' => $hit->{acc}
1598 }
1599 0 ▶ ) if exists $hit->{acc};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hit->{"acc"} 0 0 0
1600 $self->element(
1601 {
1602 'Name' => 'Hit_def',
1603 'Data' => $hit->{desc}
1604 }
1605 0 ▶ ) if exists $hit->{desc};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hit->{"desc"} 0 0 0
1606 $self->element(
1607 {
1608 'Name' => 'Hit_signif',
1609 'Data' => $hit->{evalue}
1610 }
1611 0 ▶ ) if exists $hit->{evalue};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hit->{"evalue"} 0 0 0
1612 $self->element(
1613 {
1614 'Name' => 'Hit_score',
1615 'Data' => $hit->{bits}
1616 }
1617 0 ▶ ) if exists $hit->{bits};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hit->{"bits"} 0 0 0
1618  
1619 0 for my $hsp (@{$hit->{HSPs}}) {
1620  
1621 0 $self->start_element( { 'Name' => 'Hsp' } );
1622 $self->element({'Name' => 'Hsp_score', 'Data' => $hsp->{'z-sc'}})
1623 0 ▶ if exists $hsp->{'z-sc'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"z-sc"} 0 0 0
1624 $self->element({'Name' => 'Hsp_evalue', 'Data' => $hsp->{evalue} } )
1625 0 ▶ if exists $hsp->{evalue};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"evalue"} 0 0 0
1626 $self->element({'Name' => 'Hsp_evalue2', 'Data' => $hsp->{evalue2} } )
1627 0 ▶ if exists $hsp->{evalue2};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"evalue2"} 0 0 0
1628  
1629 $self->element({'Name' => 'Hsp_bit-score', 'Data' => $hsp->{bits} } )
1630 0 ▶ if exists $hsp->{bits};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"bits"} 0 0 0
1631 $self->element({'Name' => 'Hsp_sw-score', 'Data' => $hsp->{'n-w'} } )
1632 0 ▶ if exists $hsp->{'n-w'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"n-w"} 0 0 0
1633 $self->element({'Name' => 'Hsp_sw-score', 'Data' => $hsp->{sw} } )
1634 0 ▶ if exists $hsp->{sw};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"sw"} 0 0 0
1635 $self->element({'Name' => 'Hsp_gaps', 'Data' => $hsp->{'%_gid'} } )
1636 0 ▶ if exists $hsp->{'%_gid'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"%_gid"} 0 0 0
1637 $self->element({
1638 'Name' => 'Hsp_identity',
1639 'Data' =>
1640 sprintf( "%.0f", $hsp->{'%_id'} * $hsp->{alen} )
1641 0 ▶ }) if ( exists $hsp->{'%_id'} && exists $hsp->{alen} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"%_id"} and exists $hsp->{"alen"} 0 0 0
Condition0%0/3
exists $hsp->{"%_id"} and exists $hsp->{"alen"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $hsp->{"%_id"} and exists $hsp->{"alen"}
exists $hsp->{"%_id"} exists $hsp->{"alen"}
Truth table0%0/3
A and B
A= exists $hsp->{"%_id"}B= exists $hsp->{"alen"}
ABresult
0X0
100
111
1642  
1643 0 ▶ if ( exists $hsp->{'%_gid'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hsp->{'%_gid'}) { } 0 0 0
1644 $self->element(
1645 {
1646 'Name' => 'Hsp_positive',
1647 'Data' =>
1648 sprintf( "%.0f", $hsp->{'%_gid'} * $hsp->{alen} )
1649 }
1650 0 ▶ ) if exists $hsp->{'%_gid'} && exists $hsp->{alen};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"%_gid"} and exists $hsp->{"alen"} 0 0 0
Condition0%0/3
exists $hsp->{"%_gid"} and exists $hsp->{"alen"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $hsp->{"%_gid"} and exists $hsp->{"alen"}
exists $hsp->{"%_gid"} exists $hsp->{"alen"}
Truth table0%0/3
A and B
A= exists $hsp->{"%_gid"}B= exists $hsp->{"alen"}
ABresult
0X0
100
111
1651 } else {
1652 $self->element(
1653 {
1654 'Name' => 'Hsp_positive',
1655 'Data' =>
1656 sprintf( "%.0f", $hsp->{'%_id'} * $hsp->{alen} )
1657 }
1658 0 ▶ ) if ( exists $hsp->{'%_id'} && exists $hsp->{alen} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"%_id"} and exists $hsp->{"alen"} 0 0 0
Condition0%0/3
exists $hsp->{"%_id"} and exists $hsp->{"alen"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $hsp->{"%_id"} and exists $hsp->{"alen"}
exists $hsp->{"%_id"} exists $hsp->{"alen"}
Truth table0%0/3
A and B
A= exists $hsp->{"%_id"}B= exists $hsp->{"alen"}
ABresult
0X0
100
111
1659 }
1660  
1661 $self->element(
1662 {
1663 'Name' => 'Hsp_align-len', 'Data' => $hsp->{alen} } )
1664 0 ▶ if exists $hsp->{alen};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"alen"} 0 0 0
1665 $self->element(
1666 {
1667 'Name' => 'Hsp_query-from', 'Data' => $hsp->{an0} } )
1668 0 ▶ if exists $hsp->{an0};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"an0"} 0 0 0
1669 $self->element(
1670 {
1671 'Name' => 'Hsp_query-to', 'Data' => $hsp->{ax0} } )
1672 0 ▶ if exists $hsp->{ax0};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"ax0"} 0 0 0
1673 $self->element(
1674 {
1675 'Name' => 'Hsp_hit-from', 'Data' => $hsp->{an1} } )
1676 0 ▶ if exists $hsp->{an1};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"an1"} 0 0 0
1677 $self->element(
1678 {
1679 'Name' => 'Hsp_hit-to', 'Data' => $hsp->{ax1} } )
1680 0 ▶ if exists $hsp->{ax1};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"ax1"} 0 0 0
1681  
1682 $self->element(
1683 {
1684 'Name' => 'Hsp_querygaps', 'Data' => $hsp->{qgaps} } )
1685 0 ▶ if exists $hsp->{qgaps};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"qgaps"} 0 0 0
1686 $self->element(
1687 {
1688 'Name' => 'Hsp_hitgaps', 'Data' => $hsp->{lgaps} } )
1689 0 ▶ if exists $hsp->{lgaps};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hsp->{"lgaps"} 0 0 0
1690  
1691 0 ▶ if ( $self->{'_reporttype'} =~ m/^FAST[NXY]$/o ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_reporttype'} =~ /^FAST[NXY]$/o) { } 0 0 0
1692 0 ▶ if ( 8 == scalar grep { exists $hsp->{$_} }
Branch: 1 branch
BranchTrueFalseTotal
if (8 == scalar grep({exists $hsp->{$_};} 'an0', 'ax0', 'pn0', 'px0', 'an1', 'ax1', 'pn1', 'px1')) { } 0 0 0
1693 qw(an0 ax0 pn0 px0 an1 ax1 pn1 px1) ) {
1694 0 ▶ if ( $hsp->{ax0} < $hsp->{an0} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hsp->{'ax0'} < $hsp->{'an0'}) { } 0 0 0
1695 0 $self->element(
1696 {
1697 'Name' => 'Hsp_query-frame',
1698 'Data' =>
1699 0 "-@{[(($hsp->{px0} - $hsp->{ax0}) % 3) + 1]}"
1700 }
1701 );
1702 } else {
1703 0 $self->element(
1704 {
1705 'Name' => 'Hsp_query-frame',
1706 'Data' =>
1707 0 "+@{[(($hsp->{an0} - $hsp->{pn0}) % 3) + 1]}"
1708 }
1709 );
1710 }
1711 0 ▶ if ( $hsp->{ax1} < $hsp->{an1} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hsp->{'ax1'} < $hsp->{'an1'}) { } 0 0 0
1712 0 $self->element(
1713 {
1714 'Name' => 'Hsp_hit-frame',
1715 'Data' =>
1716 0 "-@{[(($hsp->{px1} - $hsp->{ax1}) % 3) + 1]}"
1717 }
1718 );
1719 } else {
1720 0 $self->element(
1721 {
1722 'Name' => 'Hsp_hit-frame',
1723 'Data' =>
1724 0 "+@{[(($hsp->{an1} - $hsp->{pn1}) % 3) + 1]}"
1725 }
1726 );
1727 }
1728 } else {
1729 $self->element(
1730 {
1731 'Name' => 'Hsp_query-frame',
1732 'Data' => $hsp->{lframe}
1733 }
1734 0 );
1735 0 $self->element(
1736 {
1737 'Name' => 'Hsp_hit-frame', 'Data' => 0 } );
1738 }
1739 } else {
1740 0 $self->element(
1741 {
1742 'Name' => 'Hsp_query-frame', 'Data' => 0 } );
1743 $self->element(
1744 {
1745 'Name' => 'Hsp_hit-frame',
1746 'Data' => $hsp->{lframe}
1747 }
1748 0 );
1749 }
1750  
1751 0 $self->end_element( { 'Name' => 'Hsp' } );
1752 }
1753  
1754 0 $self->end_element( { 'Name' => 'Hit' } );
1755  
1756 }
1757 }
1758  
1759  
1760  
1761 2 1;
1762  
↑ Summary Bio/Search/SearchUtils.pm »