Bio/Tools/Fgenesh.pm

filter: Statementstmt 81.2% 139 / 171 Branchbran 61.9% 52 / 84 Conditioncond 41.6% 10 / 24 MC/DCmcdc 26.6% 4 / 15 Subroutinesub 81.2% 13 / 16 Podpod 100% 3 / 3 totaltotal 70.6% 221 / 313 CC 51 SCAR 27.4
CC
51
Cov
72%
next_prediction
24.0
_read_fasta_seq
20.8
_parse_predictions
18.6
CRAP 15.4
« Bio/Location/Fuzzy.pm ↑ Summary Bio/SeqIO/seqxml.pm »
1 #
2 # BioPerl module for Bio::Tools::Fgenesh
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Christopher Dwan (chris@dwan.org)
7 #
8 # Copied, lock stock & barrel from Genscan.pm
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::Tools::Fgenesh - parse results of one Fgenesh run
17  
18 =head1 SYNOPSIS
19  
20 use Bio::Tools::Fgenesh;
21  
22 $fgenesh = Bio::Tools::Fgenesh->new(-file => 'result.fgenesh');
23 # filehandle:
24 $fgenesh = Bio::Tools::Fgenesh->new( -fh => \*INPUT );
25  
26 # parse the results
27 # note: this class is-a Bio::Tools::AnalysisResult which implements
28 # Bio::SeqAnalysisParserI, i.e., $fgensh->next_feature() is the same
29 while($gene = $fgenesh->next_prediction()) {
30 # $gene is an instance of Bio::Tools::Prediction::Gene, which inherits
31 # off Bio::SeqFeature::Gene::Transcript.
32 #
33 # $gene->exons() returns an array of
34 # Bio::Tools::Prediction::Exon objects
35 # all exons:
36 @exon_arr = $gene->exons();
37  
38 # initial exons only
39 @init_exons = $gene->exons('Initial');
40 # internal exons only
41 @intrl_exons = $gene->exons('Internal');
42 # terminal exons only
43 @term_exons = $gene->exons('Terminal');
44 # singleton exons:
45 ($single_exon) = $gene->exons();
46 }
47  
48 # essential if you gave a filename at initialization (otherwise the file
49 # will stay open)
50 $fgenesh->close();
51  
52 =head1 DESCRIPTION
53  
54 The Fgenesh module provides a parser for Fgenesh (version 2) gene structure
55 prediction output. It parses one gene prediction into a
56 Bio::SeqFeature::Gene::Transcript- derived object.
57  
58 This module also implements the L<Bio::SeqAnalysisParserI> interface, and thus
59 can be used wherever such an object fits.
60  
61 =head1 FEEDBACK
62  
63 =head2 Mailing Lists
64  
65 User feedback is an integral part of the evolution of this and other
66 Bioperl modules. Send your comments and suggestions preferably to one
67 of the Bioperl mailing lists. Your participation is much appreciated.
68  
69 bioperl-l@bioperl.org - General discussion
70 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
71  
72 =head2 Support
73  
74 Please direct usage questions or support issues to the mailing list:
75  
76 I<bioperl-l@bioperl.org>
77  
78 rather than to the module maintainer directly. Many experienced and
79 reponsive experts will be able look at the problem and quickly
80 address it. Please include a thorough description of the problem
81 with code and data examples if at all possible.
82  
83 =head2 Reporting Bugs
84  
85 Report bugs to the Bioperl bug tracking system to help us keep track
86 the bugs and their resolution. Bug reports can be submitted via the
87 web:
88  
89 https://github.com/bioperl/bioperl-live/issues
90  
91 =head1 AUTHOR - Chris Dwan
92  
93 Email chris-at-dwan.org
94  
95 =head1 APPENDIX
96  
97 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
98  
99 =cut
100  
101  
102 # Let the code begin...
103  
104  
105 package Bio::Tools::Fgenesh;
106 2 $Bio::Tools::Fgenesh::VERSION = '1.7.8';
107 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
108 2 ▶use Symbol;
Subroutine BEGIN: called CC=1 SCAR=0.0
109  
110 2 ▶use Bio::Root::Root;
Subroutine BEGIN: called CC=1 SCAR=0.0
111 2 ▶use Bio::Tools::Prediction::Gene;
Subroutine BEGIN: called CC=1 SCAR=0.0
112 2 ▶use Bio::Tools::Prediction::Exon;
Subroutine BEGIN: called CC=1 SCAR=0.0
113  
114 2 ▶use base qw(Bio::Tools::AnalysisResult);
Subroutine BEGIN: called CC=1 SCAR=0.0
115  
116 2 my %ExonTags = ('CDSf' => 'Initial',
117 'CDSi' => 'Internal',
118 'CDSl' => 'Terminal',
119 'CDSo' => 'Singleton');
120
121 1 ▶sub _initialize_state {
Subroutine _initialize_state: called CC=1 SCAR=0.0
122 1 my ($self,@args) = @_;
123
124 # first call the inherited method!
125 1 $self->SUPER::_initialize_state(@args);
126  
127 # our private state variables
128 1 $self->{'_preds_parsed'} = 0;
129 1 $self->{'_has_cds'} = 0;
130 # array of pre-parsed predictions
131 1 $self->{'_preds'} = [];
132 # seq stack
133 1 $self->{'_seqstack'} = [];
134 }
135  
136 =head2 analysis_method
137  
138 Usage : $genscan->analysis_method();
139 Purpose : Inherited method. Overridden to ensure that the name matches
140 /genscan/i.
141 Returns : String
142 Argument : n/a
143  
144 =cut
145  
146 #-------------
147 0 ▶sub analysis_method {
Subroutine analysis_method: not called CC=3 SCAR=24.8
Pod documented
148 #-------------
149 0 my ($self, $method) = @_;
150 0 ▶ if($method && ($method !~ /fgenesh/i)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($method and not $method =~ /fgenesh/i) 0 0 0
Condition0%0/3
$method and not $method =~ /fgenesh/i
!ll&&!rl&&r
000
MC/DC0%0/2
$method and not $method =~ /fgenesh/i
$method not $method =~ /fgenesh/i
Truth table0%0/3
A and not(B)
A= $methodB= not $method =~ /fgenesh/i
ABresult
0X0
100
111
151 0 $self->throw("method $method not supported in " . ref($self));
152 }
153 0 return $self->SUPER::analysis_method($method);
154 }
155  
156 =head2 next_feature
157  
158 Title : next_feature
159 Usage : while($gene = $fgenesh->next_feature()) {
160 # do something
161 }
162 Function: Returns the next gene structure prediction of the Fgenesh result
163 file. Call this method repeatedly until FALSE is returned.
164  
165 The returned object is actually a SeqFeatureI implementing object.
166 This method is required for classes implementing the
167 SeqAnalysisParserI interface, and is merely an alias for
168 next_prediction() at present.
169  
170 Example :
171 Returns : A Bio::Tools::Prediction::Gene object.
172 Args :
173  
174 =cut
175  
176 0 ▶sub next_feature {
Subroutine next_feature: not called CC=1 SCAR=6.9
Pod documented
177 0 my ($self,@args) = @_;
178 # even though next_prediction doesn't expect any args (and this method
179 # does neither), we pass on args in order to be prepared if this changes
180 # ever
181 0 return $self->next_prediction(@args);
182 }
183  
184 =head2 next_prediction
185  
186 Title : next_prediction
187 Usage : while($gene = $fgenesh->next_prediction()) { ... }
188 Function: Returns the next gene structure prediction of the Genscan result
189 file. Call this method repeatedly until FALSE is returned.
190 Example :
191 Returns : A Bio::Tools::Prediction::Gene object.
192 Args :
193  
194 =cut
195  
196 5 ▶sub next_prediction {
Subroutine next_prediction: called CC=12 SCAR=31.8
Pod documented
197 5 my ($self) = @_;
198 5 my $gene;
199  
200 # if the prediction section hasn't been parsed yet, we do this now
201 5 ▶ $self->_parse_predictions() unless $self->_predictions_parsed();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_predictions_parsed 1 4 5
202  
203 # get next gene structure
204 5 $gene = $self->_prediction();
205  
206 5 ▶ if($gene) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gene) 4 1 5
207 # fill in predicted protein, and if available the predicted CDS
208 #
209  
210 # use the seq stack if there's a seq on it
211 4 my $seqobj = pop(@{$self->{'_seqstack'}});
212 4 my ($id, $seq);
213 4 ▶ unless ($seqobj) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($seqobj) 4 0 4
214 4 ($id, $seq) = $self->_read_fasta_seq();
215 4 my $alphabet;
216 0 ▶ if (($id =~ /mrna/) || ($id =~ /cds/)) { $alphabet = 'dna'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($id =~ /mrna/ or $id =~ /cds/) { } 0 4 4
Condition33%1/3
$id =~ /mrna/ or $id =~ /cds/
l!l&&r!l&&!r
004
MC/DC0%0/2
$id =~ /mrna/ or $id =~ /cds/
$id =~ /mrna/ $id =~ /cds/
Truth table33%1/3
A or B
A= $id =~ /mrna/B= $id =~ /cds/
ABresult
1X1
011
000
217 4 else { $alphabet = 'protein'; }
218 4 $seqobj = Bio::PrimarySeq->new('-seq' => $seq,
219 '-display_id' => $id,
220 '-alphabet' => $alphabet);
221 }
222 4 ▶ if ($seqobj) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seqobj) 4 0 4
223  
224 # check that prediction number matches the prediction number
225 # indicated in the sequence id (there may be incomplete gene
226 # predictions that contain only signals with no associated protein
227 # prediction.
228  
229 4 $gene->primary_tag() =~ /[^0-9]([0-9]+)$/;
230 4 my $prednr = $1;
231 4 ▶ if ($id !~ /_predicted_(\w+)_$prednr/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $id =~ /_predicted_(\w+)_$prednr/) { } 0 4 4
232 # this is not our sequence, so push back for next prediction
233 0 push(@{$self->{'_seqstack'}}, $seqobj);
234 } else {
235 4 ▶ if ($1 eq "protein") {
Branch: 2 branches
BranchTrueFalseTotal
if ($1 eq 'protein') { } 4 0 4
elsif ($1 eq 'mrna' or $1 eq 'cds') { } 0 0 0
236 4 $gene->predicted_protein($seqobj);
237 ▶ } elsif (($1 eq "mrna") || ($1 eq "cds")) {
Condition0%0/3
$1 eq "mrna" or $1 eq "cds"
l!l&&r!l&&!r
000
MC/DC0%0/2
$1 eq "mrna" or $1 eq "cds"
$1 eq "mrna" $1 eq "cds"
Truth table0%0/3
A or B
A= $1 eq "mrna"B= $1 eq "cds"
ABresult
1X1
011
000
238 0 $self->_has_cds(1);
239 0 $gene->predicted_cds($seqobj);
240
241 # Have to go back in and get the protein...
242 0 ($id, $seq) = $self->_read_fasta_seq();
243 0 ▶ if ($id =~ /_cds_/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id =~ /_cds_/) 0 0 0
244 0 ($id, $seq) = $self->_read_fasta_seq();
245 }
246
247 0 $seqobj = Bio::PrimarySeq->new('-seq' => $seq,
248 '-display_id' => $id,
249 '-alphabet' => "protein");
250 0 $gene->predicted_protein($seqobj);
251 }
252 }
253 }
254 }
255  
256 5 return $gene;
257 }
258  
259 =head2 _parse_predictions
260  
261 Title : _parse_predictions()
262 Usage : $obj->_parse_predictions()
263 Function: Parses the prediction section. Automatically called by
264 next_prediction() if not yet done.
265 Example :
266 Returns :
267  
268 =cut
269  
270 1 ▶sub _parse_predictions {
Subroutine _parse_predictions: called CC=18 SCAR=29.2
271 1 my ($self) = @_;
272 1 my $gene;
273 my $seqname;
274  
275 1 ▶ while(defined($_ = $self->_readline())) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = $self->_readline)) 41 0 41
276  
277 41 ▶ if(/^\s*(\d+)\s+([+\-])/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*(\d+)\s+([+\-])/) 27 14 41
278 27 my $line = $_;
279  
280 # exon or signal
281 27 my $prednr = $1;
282 27 ▶ my $strand = ($2 eq '+') ? 1 : -1;
Branch: 1 branch
BranchTrueFalseTotal
$2 eq '+' ? : 6 21 27
283  
284 27 ▶ if(! defined($gene)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $gene) 4 23 27
285 4 $gene = Bio::Tools::Prediction::Gene->new(
286 '-primary' => "GenePrediction$prednr",
287 '-source' => 'Fgenesh');
288 }
289 # split into fields
290 27 chomp();
291 27 my @flds = split(/\s+/, ' ' . $line);
292 ## NB - the above adds leading whitespace before the gene
293 ## number in case there was none (as quick patch to code
294 ## below which expects it but it is not present after 999
295 ## predictions!) This allows >999 predictions to be parsed.
296  
297 # create the feature object depending on the type of signal
298 27 my $predobj;
299 27 my $is_exon = grep {$line =~ $_} keys(%ExonTags);
300 27 my ($start, $end);
301 27 ▶ if($is_exon) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_exon) { } 19 8 27
302 19 $predobj = Bio::Tools::Prediction::Exon->new();
303 19 $predobj->score($flds[8]);
304 19 $start = $flds[5];
305 19 $end = $flds[7];
306 } else {
307 # PolyA site, or TSS
308 8 $predobj = Bio::SeqFeature::Generic->new();
309 8 $predobj->score($flds[5]);
310 8 $start = $flds[4];
311 8 $end = $flds[4];
312 }
313 # set common fields
314 27 $predobj->source_tag('Fgenesh');
315 27 $predobj->strand($strand);
316  
317 # Following tactical commenting-out made by
318 # malcolm.cook@stowers-institute.org since coordinate reversal is
319 # apparently vestigial copy/paste detritus from Genscan.pm origins of
320 # this module and this is NOT needed for fgenesh (at least in v
321 # 2.1.4).
322  
323 # if($predobj->strand() == 1) {
324 27 $predobj->start($start);
325 27 $predobj->end($end);
326 # } else {
327 # $predobj->end($start);
328 # $predobj->start($end);
329 # }
330  
331 # print STDERR "start $start end $end\n";
332 # add to gene structure (should be done only when start and end
333 # are set, in order to allow for proper expansion of the range)
334 27 ▶ if($is_exon) {
Branch: 3 branches
BranchTrueFalseTotal
if ($is_exon) { } 19 8 27
elsif ($flds[3] eq 'PolA') { } 4 4 8
elsif ($flds[3] eq 'TSS') { } 4 0 4
335 # first, set fields unique to exons
336 19 $predobj->primary_tag($ExonTags{$flds[4]} . 'Exon');
337 19 $predobj->is_coding(1);
338 19 my $cod_offset;
339 19 ▶ if($predobj->strand() == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($predobj->strand == 1) { } 4 15 19
340 4 $cod_offset = ($flds[9] - $predobj->start()) % 3;
341 # Possible values are -2, -1, 0, 1, 2. -1 and -2 correspond
342 # to offsets 2 and 1, resp. Offset 3 is the same as 0.
343 4 ▶ $cod_offset += 3 if($cod_offset < 1);
Branch: 1 branch
BranchTrueFalseTotal
if $cod_offset < 1 3 1 4
344 } else {
345 # On the reverse strand the Genscan frame also refers to
346 # the first base of the first complete codon, but viewed
347 # from forward, which is the third base viewed from
348 # reverse.
349 15 $cod_offset = ($flds[11] - $predobj->end()) % 3;
350 # Possible values are -2, -1, 0, 1, 2. Due to the reverse
351 # situation, {2,-1} and {1,-2} correspond to offsets
352 # 1 and 2, resp. Offset 3 is the same as 0.
353 15 ▶ $cod_offset -= 3 if($cod_offset >= 0);
Branch: 1 branch
BranchTrueFalseTotal
if $cod_offset >= 0 15 0 15
354 15 $cod_offset = -$cod_offset;
355 }
356 # Offsets 2 and 1 correspond to frame 1 and 2 (frame of exon
357 # is the frame of the first base relative to the exon, or the
358 # number of bases the first codon is missing).
359 19 $predobj->frame(3 - $cod_offset);
360 # print STDERR " frame is " . $predobj->frame() . "\n";
361 # then add to gene structure object
362 19 $gene->add_exon($predobj, $ExonTags{$flds[1]});
363 } elsif($flds[3] eq 'PolA') {
364 4 $predobj->primary_tag("PolyAsite");
365 4 $gene->poly_A_site($predobj);
366 } elsif($flds[3] eq 'TSS') {
367 4 $predobj->primary_tag("Promoter"); # (hey! a TSS is NOT a promoter... what's going on here?...
368 4 $gene->add_promoter($predobj);
369 #I'd like to do this (for now):
370 #$predobj->primary_tag("TSS"); #this is not the right model, but, it IS a feature at least.
371 #but the followg errs out
372 #$gene->add_SeqFeature($predobj); #err: MSG: start is undefined when bounds at Bio::SeqFeature::Generic::add_SeqFeature 671 check since gene has no start yet
373 }
374 else {
375 0 $self->throw("unrecognized prediction line: " . $line);
376 }
377 27 next;
378 }
379  
380 14 ▶ if(/^\s*$/ && defined($gene)) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*$/ and defined $gene) 4 10 14
Condition100%3/3
/^\s*$/ and defined $gene
!ll&&!rl&&r
914
MC/DC100%2/2
/^\s*$/ and defined $gene
/^\s*$/ defined $gene
Truth table100%3/3
A and B
A= /^\s*$/B= defined $gene
ABresult
0X0
100
111
381 # current gene is completed
382 4 $gene->seq_id($seqname);
383 4 $self->_add_prediction($gene);
384 4 $gene = undef;
385 4 next;
386 }
387  
388 10 ▶ if(/^(FGENESH)\s+([\d\.]+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^(FGENESH)\s+([\d\.]+)/) 0 10 10
389 0 $self->analysis_method($1);
390 0 $self->analysis_method_version($2);
391 0 ▶ if (/\s(\S+)\sgenomic DNA/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\s(\S+)\sgenomic DNA/) 0 0 0
392 0 $self->analysis_subject($1);
393 }
394 0 next;
395 }
396  
397 10 ▶ if(/^\s*Seq name:\s+(\S+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*Seq name:\s+(\S+)/) 1 9 10
398 1 $seqname = $1;
399 1 next;
400 }
401
402 9 ▶ /^Predicted protein/ && do {
Branch: 1 branch
BranchTrueFalseTotal
/^Predicted protein/ and do { $self->_pushback($_); last } 1 8 9
403 # section of predicted sequences
404 1 $self->_pushback($_);
405 1 last;
406 };
407 }
408  
409 1 $self->_predictions_parsed(1);
410 }
411  
412 =head2 _prediction
413  
414 Title : _prediction()
415 Usage : $gene = $obj->_prediction()
416 Function: internal
417 Example :
418 Returns :
419  
420 =cut
421  
422 5 ▶sub _prediction {
Subroutine _prediction: called CC=3 SCAR=11.0
423 5 my ($self) = @_;
424  
425 5 ▶ return unless(exists($self->{'_preds'}) && @{$self->{'_preds'}});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"_preds"} and @{$self->{"_preds"};} 1 4 5
Condition66%2/3
exists $self->{"_preds"} and @{$self->{"_preds"};}
!ll&&!rl&&r
014
MC/DC50%1/2
exists $self->{"_preds"} and @{$self->{"_preds"};}
exists $self->{"_preds"} @{$self->{"_preds"};}
Truth table66%2/3
A and B
A= exists $self->{"_preds"}B= @{$self->{"_preds"};}
ABresult
0X0
100
111
426 4 return shift(@{$self->{'_preds'}});
427 }
428  
429 =head2 _add_prediction
430  
431 Title : _add_prediction()
432 Usage : $obj->_add_prediction($gene)
433 Function: internal
434 Example :
435 Returns :
436  
437 =cut
438  
439 4 ▶sub _add_prediction {
Subroutine _add_prediction: called CC=2 SCAR=7.4
440 4 my ($self, $gene) = @_;
441  
442 4 ▶ if(! exists($self->{'_preds'})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"_preds"}) 0 4 4
443 0 $self->{'_preds'} = [];
444 }
445 4 push(@{$self->{'_preds'}}, $gene);
446 }
447  
448 =head2 _predictions_parsed
449  
450 Title : _predictions_parsed
451 Usage : $obj->_predictions_parsed
452 Function: internal
453 Example :
454 Returns : TRUE or FALSE
455  
456 =cut
457  
458 6 ▶sub _predictions_parsed {
Subroutine _predictions_parsed: called CC=3 SCAR=11.3
459 6 my ($self, $val) = @_;
460  
461 6 ▶ $self->{'_preds_parsed'} = $val if $val;
Branch: 1 branch
BranchTrueFalseTotal
if $val 1 5 6
462 6 ▶ if(! exists($self->{'_preds_parsed'})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"_preds_parsed"}) 0 6 6
463 0 $self->{'_preds_parsed'} = 0;
464 }
465 6 return $self->{'_preds_parsed'};
466 }
467  
468 =head2 _has_cds
469  
470 Title : _has_cds()
471 Usage : $obj->_has_cds()
472 Function: Whether or not the result contains the predicted CDSs, too.
473 Example :
474 Returns : TRUE or FALSE
475  
476 =cut
477  
478 0 ▶sub _has_cds {
Subroutine _has_cds: not called CC=3 SCAR=24.8
479 0 my ($self, $val) = @_;
480  
481 0 ▶ $self->{'_has_cds'} = $val if $val;
Branch: 1 branch
BranchTrueFalseTotal
if $val 0 0 0
482 0 ▶ if(! exists($self->{'_has_cds'})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"_has_cds"}) 0 0 0
483 0 $self->{'_has_cds'} = 0;
484 }
485 0 return $self->{'_has_cds'};
486 }
487  
488 =head2 _read_fasta_seq
489  
490 Title : _read_fasta_seq()
491 Usage : ($id,$seqstr) = $obj->_read_fasta_seq();
492 Function: Simple but specialised FASTA format sequence reader. Uses
493 $self->_readline() to retrieve input, and is able to strip off
494 the traling description lines.
495 Example :
496 Returns : An array of two elements: fasta_id & sequence
497  
498 =cut
499  
500 4 ▶sub _read_fasta_seq {
Subroutine _read_fasta_seq: called CC=14 SCAR=30.4
501 4 my ($self) = @_;
502 4 my ($id, $seq);
503 #local $/ = ">";
504
505 4 my $entry = $self->_readline();
506 # print " ^^ $entry\n";
507 4 ▶ return unless ($entry);
Branch: 1 branch
BranchTrueFalseTotal
unless $entry 0 4 4
508 4 ▶ $entry = $self->_readline() if ($entry =~ /^Predicted protein/);
Branch: 1 branch
BranchTrueFalseTotal
if $entry =~ /^Predicted protein/ 1 3 4
509 # print " ^^ $entry\n";
510  
511 # Pick up the header / id.
512 4 ▶ if ($entry =~ /^>FGENESH:/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($entry =~ /^>FGENESH:/) 4 0 4
513 4 ▶ if ($entry =~ /^>FGENESH:\s+(\d+)/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($entry =~ /^>FGENESH:\s+(\d+)/) { } 4 0 4
elsif ($entry =~ /^>FGENESH:\[mRNA\]\s*(\d+)/) { } 0 0 0
elsif ($entry =~ /^>FGENESH:\[exon\]\s+Gene:\s*(\d+)/) { } 0 0 0
514 # print STDERR " this is a predicted gene\n";
515 4 $id = "_predicted_protein_" . $1;
516 } elsif ($entry =~ /^>FGENESH:\[mRNA\]\s*(\d+)/) {
517 # print STDERR " this is an mRNA\n";
518 0 $id = "_predicted_mrna_" . $1;
519 } elsif ($entry =~ /^>FGENESH:\[exon\]\s+Gene:\s*(\d+)/) {
520 0 $id = "_predicted_cds_" . $1;
521 }
522 4 $seq = "";
523 4 $entry = $self->_readline();
524 }
525  
526 4 my $done = 0;
527 4 ▶ while (!$done) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($done) 19 0 19
528 # print "*** $entry\n";
529 19 ▶ if (($entry =~ /^>FGENESH:\[exon\]/) && ($id =~ /^_predicted_cds_/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($entry =~ /^>FGENESH:\[exon\]/ and $id =~ /^_predicted_cds_/) { } 0 19 19
Condition33%1/3
$entry =~ /^>FGENESH:\[exon\]/ and $id =~ /^_predicted_cds_/
!ll&&!rl&&r
1900
MC/DC0%0/2
$entry =~ /^>FGENESH:\[exon\]/ and $id =~ /^_predicted_cds_/
$entry =~ /^>FGENESH:\[exon\]/ $id =~ /^_predicted_cds_/
Truth table33%1/3
A and B
A= $entry =~ /^>FGENESH:\[exon\]/B= $id =~ /^_predicted_cds_/
ABresult
0X0
100
111
530 # print STDERR " -- informed about an exon header...\n";
531 0 $entry = $self->_readline();
532 } else {
533 19 $seq .= $entry;
534 # print STDERR " Added $entry\n";
535 }
536  
537 19 ▶ last unless $entry = $self->_readline();
Branch: 1 branch
BranchTrueFalseTotal
unless $entry = $self->_readline 1 18 19
538 18 ▶ if (($entry =~ /^>/) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($entry =~ /^>/ and not $entry =~ /^>FGENESH:\[exon\]/ && $id =~ /^_predicted_cds_/) 3 15 18
Condition50%3/6
$entry =~ /^>/ and not $entry =~ /^>FGENESH:\[exon\]/ && $id =~ /^_predicted_cds_/
!ll&&!rl&&r
1503
$entry =~ /^>FGENESH:\[exon\]/ && $id =~ /^_predicted_cds_/
!ll&&!rl&&r
300
MC/DC33%1/3
$entry =~ /^>/ and not $entry =~ /^>FGENESH:\[exon\]/ && $id =~ /^_predicted_cds_/
$entry =~ /^>/ $entry =~ /^>FGENESH:\[exon\]/ $id =~ /^_predicted_cds_/
Truth table50%2/4
A and not(B && C)
A= $entry =~ /^>/B= $entry =~ /^>FGENESH:\[exon\]/C= $id =~ /^_predicted_cds_/
ABCresult
0XX0
1110
10X1
1101
539 (!(($entry =~ /^>FGENESH:\[exon\]/) && ($id =~ /^_predicted_cds_/)))) {
540 3 $self->_pushback($entry); last;
541 }
542 }
543  
544 # id and sequence
545 4 $seq =~ s/\s//g; # Remove whitespace
546 4 return ($id, $seq);
547 }
548  
549 2 1;
« Bio/Location/Fuzzy.pm ↑ Summary Bio/SeqIO/seqxml.pm »