Bio/SeqIO/tigr.pm

filter: Statementstmt 4.7% 32 / 669 Branchbran 0.0% 0 / 320 Conditioncond 0.0% 0 / 36 MC/DCmcdc 0.0% 0 / 23 Subroutinesub 22.7% 10 / 44 Podpod 100% 2 / 2 totaltotal 4.0% 44 / 1094 CC 176 SCAR 50.4
CC
176
Cov
3%
_process_gene_info
506.0
__ANON__
342.0
_process_model
342.0
CRAP 155.0
« Bio/Ontology/InterProTerm.pm ↑ Summary Bio/SeqIO/genbank.pm »
1 # BioPerl module for Bio::SeqIO::tigr
2 #
3 # Please direct questions and support issues to <bioperl-l@bioperl.org>
4 #
5 # Cared for by Josh Lauricha (laurichj@bioinfo.ucr.edu)
6 #
7 # Copyright Josh Lauricha
8 #
9 # You may distribute this module under the same terms as perl itself
10  
11 # POD documentation - main docs before the code
12  
13 =head1 NAME
14  
15 Bio::SeqIO::tigr - TIGR XML sequence input/output stream
16  
17 =head1 SYNOPSIS
18  
19 Do not use this module directly. Use it via the Bio::SeqIO class.
20  
21 =head1 DESCRIPTION
22  
23 This object can transform Bio::Seq objects to and from efa flat
24 file databases.
25  
26 =head1 FEEDBACK
27  
28 =head2 Mailing Lists
29  
30 User feedback is an integral part of the evolution of this and other
31 Bioperl modules. Send your comments and suggestions preferably to one
32 of the Bioperl mailing lists. Your participation is much appreciated.
33  
34 bioperl-l@bioperl.org - General discussion
35 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
36  
37 =head2 Support
38  
39 Please direct usage questions or support issues to the mailing list:
40  
41 I<bioperl-l@bioperl.org>
42  
43 rather than to the module maintainer directly. Many experienced and
44 reponsive experts will be able look at the problem and quickly
45 address it. Please include a thorough description of the problem
46 with code and data examples if at all possible.
47  
48 =head2 Reporting Bugs
49  
50 Report bugs to the Bioperl bug tracking system to help us keep track
51 the bugs and their resolution.
52 Bug reports can be submitted via the web:
53  
54 https://github.com/bioperl/bioperl-live/issues
55  
56 =head1 AUTHORS - Josh Lauricha
57  
58 Email: laurichj@bioinfo.ucr.edu
59  
60  
61 =head1 APPENDIX
62  
63 The rest of the documentation details each of the object
64 methods. Internal methods are usually preceded with a _
65  
66 =cut
67  
68 # TODO:
69 # - Clean up code
70 # - Find and fix bugs ;)
71  
72 # Let the code begin...
73 package Bio::SeqIO::tigr;
74 2 $Bio::SeqIO::tigr::VERSION = '1.7.8';
75 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
76  
77 2 ▶use Bio::Seq::RichSeq;
Subroutine BEGIN: called CC=1 SCAR=0.0
78 2 ▶use Bio::Species;
Subroutine BEGIN: called CC=1 SCAR=0.0
79 2 ▶use Bio::Annotation::Comment;
Subroutine BEGIN: called CC=1 SCAR=0.0
80 2 ▶use Bio::SeqFeature::Generic;
Subroutine BEGIN: called CC=1 SCAR=0.0
81 2 ▶use Bio::Seq::SeqFactory;
Subroutine BEGIN: called CC=1 SCAR=0.0
82 2 ▶use Bio::Seq::RichSeq;
Subroutine BEGIN: called CC=1 SCAR=0.0
83 2 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
84 2 ▶use Error qw/:try/;
Subroutine BEGIN: called CC=1 SCAR=0.0
85  
86 2 ▶use base qw(Bio::SeqIO);
Subroutine BEGIN: called CC=1 SCAR=0.0
87  
88 sub _initialize
89 0 ▶{
Subroutine _initialize: not called CC=1 SCAR=6.9
90 0 my($self, @args) = @_;
91  
92 0 $self->SUPER::_initialize(@args);
93 0 $self->sequence_factory(Bio::Seq::SeqFactory->new(
94 -type => 'Bio::Seq::RichSeq')
95 );
96  
97 # Parse the document
98 0 $self->_process();
99 }
100  
101 =head2 next_seq
102  
103 Title : next_seq
104 Usage : $seq = $stream->next_seq()
105 Function: returns the next sequence in the stream
106 Returns : Bio::Seq object
107 Args : NONE
108  
109 =cut
110  
111 sub next_seq()
112 0 ▶{
Subroutine next_seq: not called CC=11 SCAR=48.8
Pod documented
113 0 my ($self) = @_;
114
115 # Check for any more sequences
116 0 ▶ return if !defined($self->{_sequences}) or scalar(@{$self->{_sequences}}) < 1;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $self->{"_sequences"} or scalar @{$self->{"_sequences"};} < 1 0 0 0
Condition0%0/3
not defined $self->{"_sequences"} or scalar @{$self->{"_sequences"};} < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $self->{"_sequences"} or scalar @{$self->{"_sequences"};} < 1
not defined $self->{"_sequences"} scalar @{$self->{"_sequences"};} < 1
Truth table0%0/3
not(A) or B
A= not defined $self->{"_sequences"}B= scalar @{$self->{"_sequences"};} < 1
ABresult
1X1
011
000
117  
118 # get the next sequence
119 0 my $seq = shift(@{ $self->{_sequences} } );
120  
121 # Get the 5' and 3' ends
122 0 my ($source) = grep { $_->primary_tag() eq 'source' } $seq->get_SeqFeatures();
123 0 my ($end5) = $source->get_tag_values('end5');
124 0 my ($end3) = $source->get_tag_values('end3');
125  
126 # Sort the 5' and 3':
127 0 ▶ my ($start, $end) = ( $end5 < $end3 ? ( $end5, $end3 ) : ( $end3, $end5 ) );
Branch: 1 branch
BranchTrueFalseTotal
$end5 < $end3 ? : 0 0 0
128  
129 # make the start a perl index
130 0 $start -= 1;
131  
132 # Figure out the length
133 0 my $length = $end - $start;
134  
135 # check to make sure $start >= 0 and $end <= length(assembly_seq)
136 0 ▶ if($start < 0) {
Branch: 3 branches
BranchTrueFalseTotal
if ($start < 0) { } 0 0 0
elsif ($end > length $self->{'_assembly'}{'seq'}) { } 0 0 0
elsif ($start >= $end) { } 0 0 0
137 0 throw Bio::Root::OutOfRange("the sequence start is $start < 0");
138 } elsif($end > length($self->{_assembly}->{seq})) {
139 0 throw Bio::Root::OutOfRange("the sequence end is $end < " . length($self->{_assembly}->{seq}));
140 } elsif($start >= $end) {
141 0 throw Bio::Root::OutOfRange("the sequence start is after end $start >= $end");
142 }
143  
144 # Get and set the real sequence
145 0 $seq->seq(substr($self->{_assembly}->{seq}, $start, $length));
146  
147 0 ▶ if( $end5 > $end3 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($end5 > $end3) 0 0 0
148 # Reverse complement the sequence
149 0 $seq->seq( $seq->primary_seq()->revcom()->seq() );
150 }
151  
152 # add the translation to each CDS
153 0 foreach my $feat ($seq->get_SeqFeatures()) {
154 0 ▶ next if $feat->primary_tag() ne "CDS";
Branch: 1 branch
BranchTrueFalseTotal
if $feat->primary_tag ne "CDS" 0 0 0
155  
156 # Check for an invalid protein
157 0 ▶ try {
Subroutine __ANON__: not called CC=1 SCAR=6.9
158 # Get the subsq
159 0 my $cds = Bio::PrimarySeq->new(
160 -strand => 1,
161 -id => $seq->accession_number(),
162 -seq => $seq->subseq($feat->location())
163 );
164  
165 # Translate it
166 0 my $trans = $cds->translate(undef, undef, undef, undef, 1, 1)->seq();
167  
168 # Add the tag
169 0 $feat->add_tag_value(translation => $trans);
170 0 ▶ } catch Bio::Root::Exception with {
Subroutine __ANON__: not called CC=2 SCAR=17.9
171 0 ▶ print STDERR 'TIGR strikes again, the CDS is not a valid protein: ', $seq->accession_number(), "\n"
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose > 0 0 0 0
172 if $self->verbose() > 0;
173 0 };
174 }
175  
176 # Set the display id to the accession number if there
177 # is no display id
178 0 ▶ $seq->display_id( $seq->accession_number() ) unless $seq->display_id();
Branch: 1 branch
BranchTrueFalseTotal
unless $seq->display_id 0 0 0
179
180 0 return $seq;
181 }
182  
183 sub _process
184 0 ▶{
Subroutine _process: not called CC=8 SCAR=42.8
185 0 my($self) = @_;
186 0 my $line;
187 0 my $tu = undef;
188  
189 0 $line = $self->_readline();
190 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
defined $line and do { do { if ($line =~ /<\?xml\s+version\s+=\s+"\d+\.\d+"\?>/o) { (); } elsif ($line =~ /<!DOCTYPE (\w+) SYSTEM "[\w\.]+">/o) { $self->throw("DOCTYPE of $1, not TIGR!") if $1 ne "TIGR"; } elsif ($line =~ /<TIGR>/o) { $self->_pushback($line); $self->_process_tigr; } elsif ($line =~ /<ASSEMBLY.*?>/o) { $self->_pushback($line); $self->_process_assembly; } elsif ($line =~ m[</TIGR>]o) { $self->{"eof"} = 1; return; } else { $self->throw("Unknown or Invalid process directive:", join("", $line =~ /^\s*(<[^>]+>)/o)); } ; $line = $self->_readline } } 0 0 0
191 0 ▶ if($line =~ /<\?xml\s+version\s+=\s+"\d+\.\d+"\?>/o) {
Branch: 5 branches
BranchTrueFalseTotal
if ($line =~ /<\?xml\s+version\s+=\s+"\d+\.\d+"\?>/o) { } 0 0 0
elsif ($line =~ /<!DOCTYPE (\w+) SYSTEM "[\w\.]+">/o) { } 0 0 0
elsif ($line =~ /<TIGR>/o) { } 0 0 0
elsif ($line =~ /<ASSEMBLY.*?>/o) { } 0 0 0
elsif ($line =~ m[</TIGR>]o) { } 0 0 0
192 # do nothing
193 } elsif ($line =~ /<!DOCTYPE (\w+) SYSTEM "[\w\.]+">/o) {
194 0 ▶ $self->throw("DOCTYPE of $1, not TIGR!")
Branch: 1 branch
BranchTrueFalseTotal
if $1 ne "TIGR" 0 0 0
195 if $1 ne "TIGR" ;
196 } elsif ($line =~ /<TIGR>/o) {
197 0 $self->_pushback($line);
198 0 $self->_process_tigr();
199 } elsif ($line =~ /<ASSEMBLY.*?>/o) {
200 0 $self->_pushback($line);
201 0 $self->_process_assembly();
202 } elsif ($line =~ /<\/TIGR>/o) {
203 0 $self->{'eof'} = 1;
204 0 return;
205 } else {
206 0 $self->throw("Unknown or Invalid process directive:",
207 join('', ($line =~ /^\s*(<[^>]+>)/o)));
208 }
209 0 $line = $self->_readline();
210 } while( defined( $line ) );
211 }
212  
213 sub _process_tigr
214 0 ▶{
Subroutine _process_tigr: not called CC=4 SCAR=30.0
215 0 my($self) = @_;
216 0 my $line;
217  
218 0 $line = $self->_readline();
219 0 ▶ if($line !~ /<TIGR>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<TIGR>/o) 0 0 0
220 0 $self->throw("Bio::SeqIO::tigr::_process_tigr called but no ",
221 "<TIGR> found in stream");
222 }
223  
224 0 $line = $self->_readline();
225 0 ▶ if($line =~ /<PSEUDOCHROMOSOME>/o) {
Branch: 2 branches
BranchTrueFalseTotal
if ($line =~ /<PSEUDOCHROMOSOME>/o) { } 0 0 0
elsif ($line =~ /<ASSEMBLY.*?>/o) { } 0 0 0
226 0 $self->_pushback($line);
227 0 $self->_process_pseudochromosome();
228 } elsif ($line =~ /<ASSEMBLY.*?>/o) {
229 0 $self->_pushback($line);
230 0 $self->_process_assembly();
231 }
232 }
233  
234 sub _process_pseudochromosome
235 0 ▶{
Subroutine _process_pseudochromosome: not called CC=5 SCAR=34.0
236 0 my($self) = @_;
237 0 my $line;
238  
239 0 $line = $self->_readline();
240 0 ▶ return if $line !~ /<PSEUDOCHROMOSOME>/o;
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /<PSEUDOCHROMOSOME>/o 0 0 0
241  
242 0 $line = $self->_readline();
243  
244 0 ▶ if($line =~ /<SCAFFOLD>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<SCAFFOLD>/o) { } 0 0 0
245 0 $self->_pushback($line);
246 0 $self->_process_scaffold();
247 0 $line = $self->_readline();
248 } else {
249 0 $self->warn( "No Scaffold found in <PSUEDOCHROMOSOME> this " .
250 "is a violation of the TIGR dtd, but we ignore " .
251 "it so we are ignoring the error\n"
252 );
253 }
254  
255 0 ▶ if($line =~ /<ASSEMBLY.*>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<ASSEMBLY.*>/o) { } 0 0 0
256 0 $self->_pushback($line);
257 0 $self->_process_assembly();
258 0 $line = $self->_readline();
259 } else {
260 0 $self->throw("Missing required ASSEMBLY in <PSEUDOCHROMOSOME>");
261 }
262  
263 0 ▶ if($line =~ /<\/PSEUDOCHROMOSOME>/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</PSEUDOCHROMOSOME>]) 0 0 0
264 0 return;
265 }
266  
267 0 $self->throw("Reached end of _process_pseudochromosome");
268 }
269  
270 sub _process_assembly
271 0 ▶{
Subroutine _process_assembly: not called CC=11 SCAR=48.8
272 0 my($self) = @_;
273 0 my $line;
274  
275 0 $line = $self->_readline();
276 0 ▶ if($line !~ /<ASSEMBLY([^>]*)>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<ASSEMBLY([^>]*)>/o) 0 0 0
277 0 $self->throw("Bio::SeqIO::tigr::_process_assembly called ",
278 "but no <ASSEMBLY> found in stream");
279 }
280  
281 0 my %attribs = ($1 =~ /(\w+)\s*=\s+"(.*?)"/og);
282 0 $self->{_assembly}->{date} = $attribs{CURRENT_DATE};
283 0 $self->{_assembly}->{db} = $attribs{DATABASE};
284 0 $self->{_assembly}->{chromosome} = $attribs{CHROMOSOME};
285  
286 0 $line = $self->_readline();
287 0 my($attr, $val);
288 0 ▶ if(($attr, $val) = ($line =~ /<ASMBL_ID([^>]*)>([^<]*)<\/ASMBL_ID>/o)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $line =~ m[<ASMBL_ID([^>]*)>([^<]*)</ASMBL_ID>]o) { } 0 0 0
289 0 %attribs = ($attr =~ /(\w+)\s*=\s+"(.*?)"/og);
290 0 $self->{_assembly}->{clone_name} = $attribs{CLONE_NAME};
291 0 $self->{_assembly}->{clone} = $val;
292 0 $line = $self->_readtag();
293 } else {
294 0 $self->throw("Required <ASMBL_ID> missing");
295 }
296  
297 0 ▶ if($line =~ /<COORDSET>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<COORDSET>/o) { } 0 0 0
298 0 $self->_pushback($line);
299 0 my $cs = $self->_process_coordset();
300  
301 0 $self->{_assembly}->{end5} = $cs->{end5};
302 0 $self->{_assembly}->{end3} = $cs->{end3};
303  
304 0 $line = $self->_readline();
305 } else {
306 0 $self->throw("Required <COORDSET> missing");
307 }
308  
309 0 ▶ if($line =~ /<HEADER>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<HEADER>/o) { } 0 0 0
310 0 $self->_pushback($line);
311 0 $self->_process_header();
312 0 $line = $self->_readline();
313 } else {
314 0 $self->throw("Required <HEADER> missing");
315 }
316  
317 0 ▶ if($line =~ /<TILING_PATH>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<TILING_PATH>/o) 0 0 0
318 0 $self->_pushback($line);
319 0 $self->_process_tiling_path();
320 0 $line = $self->_readline();
321 }
322  
323 0 ▶ if($line =~ /<GENE_LIST>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<GENE_LIST>/o) { } 0 0 0
324 0 $self->_pushback($line);
325 0 $self->_process_gene_list();
326 0 $line = $self->_readline();
327 } else {
328 0 $self->throw("Required <GENE_LIST> missing");
329 }
330  
331 0 ▶ if($line =~ /<MISC_INFO>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<MISC_INFO>/o) 0 0 0
332 0 $self->_pushback($line);
333 0 $self->_process_misc_info();
334 0 $line = $self->_readline();
335 }
336  
337 0 ▶ if($line =~ /<REPEAT_LIST>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<REPEAT_LIST>/o) 0 0 0
338 0 $self->_pushback($line);
339 0 $self->_process_repeat_list();
340 0 $line = $self->_readline();
341 }
342  
343 0 ▶ if($line =~ /<ASSEMBLY_SEQUENCE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<ASSEMBLY_SEQUENCE>/o) { } 0 0 0
344 0 $self->_pushback($line);
345 0 $self->_process_assembly_seq();
346 0 $line = $self->_readline();
347 } else {
348 0 $self->throw("Required <ASSEMBLY_SEQUENCE> missing");
349 }
350  
351 0 ▶ if($line =~ /<\/ASSEMBLY>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</ASSEMBLY>]o) 0 0 0
352 0 return;
353 }
354 0 $self->throw("Reached the end of <ASSEMBLY>");
355 }
356  
357 sub _process_assembly_seq()
358 0 ▶{
Subroutine _process_assembly_seq: not called CC=6 SCAR=37.4
359 0 my ($self) = @_;
360 0 my $line;
361
362 0 $line = $self->_readline();
363 0 ▶ if($line !~ /<ASSEMBLY_SEQUENCE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<ASSEMBLY_SEQUENCE>/o) 0 0 0
364 0 $self->throw("Bio::SeqIO::tigr::_process_assembly_seq called ".
365 "with no <ASSEMBLY_SEQUENCE> in the stream");
366 }
367  
368 # Protect against lots of smaller lines
369 0 my @chunks;
370  
371 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$line and do { do { $line = $self->_readline; last unless $line; my $seq; if (($seq) = $line =~ /^\s*(\w+)\s*$/o) { push @chunks, $seq; } elsif (($seq) = $line =~ m[^\s*(\w+)</ASSEMBLY_SEQUENCE>\s*$]o) { push @chunks, $seq; $self->{"_assembly"}{"seq"} = join("", @chunks); return; } } } 0 0 0
372 0 $line = $self->_readline();
373 0 ▶ last unless $line;
Branch: 1 branch
BranchTrueFalseTotal
unless $line 0 0 0
374  
375 0 my $seq;
376 0 ▶ if (($seq) = ($line =~ /^\s*(\w+)\s*$/o)) {
Branch: 2 branches
BranchTrueFalseTotal
if (($seq) = $line =~ /^\s*(\w+)\s*$/o) { } 0 0 0
elsif (($seq) = $line =~ m[^\s*(\w+)</ASSEMBLY_SEQUENCE>\s*$]o) { } 0 0 0
377 0 push(@chunks, $seq);
378 } elsif( ($seq) = ( $line =~ /^\s*(\w+)<\/ASSEMBLY_SEQUENCE>\s*$/o) ) {
379 0 push(@chunks, $seq);
380 0 $self->{_assembly}->{seq} = join('', @chunks);
381 0 return;
382 }
383 } while( $line );
384  
385 0 $self->throw("Reached end of _proces_assembly");
386 }
387  
388 sub _process_coordset($)
389 0 ▶{
Subroutine _process_coordset: not called CC=4 SCAR=30.0
390 0 my ($self) = @_;
391 0 my $line;
392 my $h;
393  
394 0 $line = $self->_readline();
395 0 ▶ if($line =~ /<COORDSET>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<COORDSET>/o) { } 0 0 0
396 0 $self->_pushback($line);
397 0 $line = $self->_readtag();
398 0 ($h->{end5}, $h->{end3}) = ($line =~ /<COORDSET>\s*<END5>\s*(\d+)\s*<\/END5>\s*<END3>\s*(\d+)\s*<\/END3>/os);
399 0 ▶ if(!defined($h->{end5}) or !defined($h->{end3})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $h->{"end5"} and defined $h->{"end3"}) 0 0 0
Condition0%0/3
defined $h->{"end5"} and defined $h->{"end3"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $h->{"end5"} and defined $h->{"end3"}
defined $h->{"end5"} defined $h->{"end3"}
Truth table0%0/3
A and B
A= defined $h->{"end5"}B= defined $h->{"end3"}
ABresult
0X0
100
111
400 0 $self->throw("Invalid <COORDSET>: $line");
401 }
402 0 return $h;
403 } else {
404 0 $self->throw("Bio::SeqIO::tigr::_process_coordset() called ",
405 "but no <COORDSET> found in stream");
406 }
407 }
408  
409 sub _process_header
410 0 ▶{
Subroutine _process_header: not called CC=15 SCAR=54.8
411 0 my ($self) = @_;
412 0 my $line = $self->_readline();
413  
414 0 ▶ if($line !~ /<HEADER>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<HEADER>/o) 0 0 0
415 0 $self->throw("Bio::SeqIO::tigr::_process_header called ",
416 "but no <HEADER> found in stream");
417 }
418  
419 0 $line = $self->_readtag();
420 0 ▶ if($line =~ /<CLONE_NAME>([^>]+)<\/CLONE_NAME>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<CLONE_NAME>([^>]+)</CLONE_NAME>]o) { } 0 0 0
421 0 $self->{_assembly}->{clone_name} = $1;
422 0 $line = $self->_readtag();
423 } else {
424 0 $self->throw("Required <CLONE_NAME> missing");
425 }
426  
427 0 ▶ if($line =~ /<SEQ_LAST_TOUCHED>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<SEQ_LAST_TOUCHED>/o) { } 0 0 0
428 # Ignored for now
429 0 $line = $self->_readtag();
430 } else {
431 0 $self->throw("Reqired <SEQ_LAST_TOUCHED> missing");
432 }
433  
434 0 ▶ if($line =~ /<GB_ACCESSION>([^<]*)<\/GB_ACCESSION>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<GB_ACCESSION>([^<]*)</GB_ACCESSION>]o) { } 0 0 0
435 0 $self->{_assembly}->{gb} = $1;
436 0 $line = $self->_readtag();
437 } else {
438 0 $self->throw("Required <GB_ACCESSION> missing");
439 }
440  
441 0 ▶ if($line =~ /<ORGANISM>\s*(.+)\s*<\/ORGANISM>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<ORGANISM>\s*(.+)\s*</ORGANISM>]o) { } 0 0 0
442 0 my( $genus, $species, @ss ) = split(/\s+/o, $1);
443 0 $self->{_assembly}->{species} = Bio::Species->new();
444 0 $self->{_assembly}->{species}->genus($genus);
445 0 $self->{_assembly}->{species}->species($species);
446 0 ▶ $self->{_assembly}->{species}->sub_species(join(' ', @ss)) if scalar(@ss) > 0;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @ss > 0 0 0 0
447  
448 0 $line = $self->_readtag();
449 } else {
450 0 $self->throw("Required <ORGANISM> missing");
451 }
452  
453 0 ▶ if($line =~ /<LINEAGE>([^<]*)<\/LINEAGE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<LINEAGE>([^<]*)</LINEAGE>]o) { } 0 0 0
454 $self->{_assembly}->{species}->classification(
455 0 $self->{_assembly}->{species}->species(),
456 reverse(split(/\s*;\s*/o, $1))
457 );
458 0 $line = $self->_readtag();
459 } else {
460 0 $self->throw("Required <LINEAGE> missing");
461 }
462  
463 0 ▶ if($line =~ /<SEQ_GROUP>([^<]*)<\/SEQ_GROUP>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<SEQ_GROUP>([^<]*)</SEQ_GROUP>]o) { } 0 0 0
464 # ingnored
465 0 $line = $self->_readtag();
466 } else {
467 0 $self->throw("Required <SEQ_GROUP> missing");
468 }
469  
470 0 ▶ while($line =~ /<KEYWORDS>[^<]*<\/KEYWORDS>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<KEYWORDS>[^<]*</KEYWORDS>]o) 0 0 0
471 0 push(@{$self->{_assembly}->{keywords}}, $1);
472 0 $line = $self->_readtag();
473 }
474  
475 0 ▶ while($line =~ /<GB_DESCRIPTION>([^<]+)<\/GB_DESCRIPTION>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<GB_DESCRIPTION>([^<]+)</GB_DESCRIPTION>]o) 0 0 0
476 0 push(@{$self->{_assembly}->{gb_desc}},$1);
477 0 $line = $self->_readtag();
478 }
479  
480 0 ▶ while($line =~ /<GB_COMMENT>([^<]+)<\/GB_COMMENT>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<GB_COMMENT>([^<]+)</GB_COMMENT>]o) 0 0 0
481 0 push(@{$self->{_assembly}->{gb_comment}}, $1);
482 0 $line = $self->_readtag();
483 }
484  
485 0 ▶ if(my %h = ($line =~ /<AUTHOR_LIST(?:\s*(\w+)\s*=\s*"([^"]+)"\s*)*>/o)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(%h) = $line =~ /<AUTHOR_LIST(?:\s*(\w+)\s*=\s*"([^"]+)"\s*)*>/o) { } 0 0 0
486 #$header->{'AUTHOR_LIST'}=$h{'CONTACT'};
487 # Ignored
488 0 ▶ while($line !~ /<\/AUTHOR_LIST>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ m[</AUTHOR_LIST>]o) 0 0 0
489 0 $self->_readtag();
490 }
491 0 $line = $self->_readline();
492 } else {
493 0 $self->throw("Required <AUTHOR_LIST> missing");
494 }
495  
496 0 ▶ if($line =~ /<\/HEADER>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</HEADER>]o) 0 0 0
497 0 return;
498 }
499  
500 0 $self->throw("Reached end of header\n");
501 }
502  
503 sub _process_gene_list
504 0 ▶{
Subroutine _process_gene_list: not called CC=5 SCAR=34.0
505 0 my($self) = @_;
506 0 my $line;
507  
508 0 $line = $self->_readline();
509 0 ▶ if($line !~ /<GENE_LIST>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<GENE_LIST>/o) 0 0 0
510 0 $self->throw("Bio::SeqIO::tigr::_process_gene_list called ",
511 "but no <GENE_LIST> in the stream");
512 }
513  
514 0 $line = $self->_readline();
515 0 ▶ if($line =~ /<PROTEIN_CODING>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<PROTEIN_CODING>/o) { } 0 0 0
516 0 $self->_pushback($line);
517 0 $self->_process_protein_coding();
518 0 $line = $self->_readline();
519 } else {
520 0 $self->throw("Required <PROTEIN_CODING> missing");
521 }
522  
523 0 ▶ if($line =~ /<RNA_GENES>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<RNA_GENES>/o) { } 0 0 0
524 0 $self->_pushback($line);
525 0 $self->_process_rna_genes();
526 0 $line = $self->_readline();
527 } else {
528 0 $self->throw("Required <RNA_GENES> missing");
529 }
530  
531 0 ▶ if($line =~ /<\/GENE_LIST>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</GENE_LIST>]o) 0 0 0
532 0 return;
533 }
534  
535 0 $self->throw("Reached end of _process_gene_list");
536 }
537  
538 sub _process_protein_coding
539 0 ▶{
Subroutine _process_protein_coding: not called CC=7 SCAR=40.3
540 0 my ($self) = @_;
541 0 my $line = $self->_readline();
542  
543 0 ▶ if($line !~ /<PROTEIN_CODING>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<PROTEIN_CODING>/o) 0 0 0
544 0 $self->throw("Bio::SeqIO::tigr::_process_protein_coding called"
545 . "but no <GENE_LIST> in the stream");
546 }
547  
548 0 $line = $self->_readline();
549 0 ▶ while($line and $line =~ /<TU>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line and $line =~ /<TU>/o) 0 0 0
Condition0%0/3
$line and $line =~ /<TU>/o
!ll&&!rl&&r
000
MC/DC0%0/2
$line and $line =~ /<TU>/o
$line $line =~ /<TU>/o
Truth table0%0/3
A and B
A= $lineB= $line =~ /<TU>/o
ABresult
0X0
100
111
550 0 $self->_pushback($line);
551 0 $self->_process_tu();
552 0 $line = $self->_readline();
553 }
554  
555 # Sort the sequences
556 0 @{$self->{_sequences}} = sort {
557 0 my($one, $two) = ( $a, $b );
558 0 ($one) = grep { $_->primary_tag() eq 'source' } $one->get_SeqFeatures();
559 0 ($two) = grep { $_->primary_tag() eq 'source' } $two->get_SeqFeatures();
560 0 ▶ return 0 unless defined $one and defined $two;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $one and defined $two 0 0 0
Condition0%0/3
defined $one and defined $two
!ll&&!rl&&r
000
MC/DC0%0/2
defined $one and defined $two
defined $one defined $two
Truth table0%0/3
A and B
A= defined $oneB= defined $two
ABresult
0X0
100
111
561 0 ($one) = sort { $a <=> $b } $one->get_tagset_values(qw/end5 end3/);
562 0 ($two) = sort { $a <=> $b } $two->get_tagset_values(qw/end5 end3/);
563 0 return $one <=> $two;
564 0 } @{$self->{_sequences}};
565  
566 0 ▶ if($line =~ /<\/PROTEIN_CODING>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</PROTEIN_CODING>]o) 0 0 0
567 0 return;
568 }
569  
570 0 $self->throw("Reached end of _process_protein_coding");
571 }
572  
573  
574 sub _process_rna_genes
575 0 ▶{
Subroutine _process_rna_genes: not called CC=3 SCAR=24.8
576 0 my ($self) = @_;
577 0 my $line = $self->_readline();
578  
579 0 ▶ if($line =~ /<RNA_GENES>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<RNA_GENES>/o) { } 0 0 0
580 0 ▶ while($line !~ /<\/RNA_GENES>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $line =~ m[</RNA_GENES>]o) 0 0 0
581 0 $line = $self->_readline();
582 }
583 } else {
584 0 $self->throw("Bio::SeqIO::tigr::_process_rna_genes called ",
585 "but no <RNA_GENES> in the stream");
586 }
587 }
588  
589 sub _process_misc_info
590 0 ▶{
Subroutine _process_misc_info: not called CC=3 SCAR=24.8
591 0 my ($self) = @_;
592 0 my $line = $self->_readline();
593  
594 0 ▶ if($line =~ /<MISC_INFO>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<MISC_INFO>/o) { } 0 0 0
595 0 ▶ while($line !~ /<\/MISC_INFO>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $line =~ m[</MISC_INFO>]o) 0 0 0
596 0 $line = $self->_readline();
597 }
598 } else {
599 0 $self->throw("Bio::SeqIO::tigr::_process_misc_info called ",
600 "but no <MISC_INFO> in the stream");
601 }
602 }
603  
604 sub _process_repeat_list
605 0 ▶{
Subroutine _process_repeat_list: not called CC=3 SCAR=24.8
606 0 my ($self) = @_;
607 0 my $line = $self->_readline();
608  
609 0 ▶ if($line =~ /<REPEAT_LIST>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<REPEAT_LIST>/o) { } 0 0 0
610 0 ▶ while($line !~ /<\/REPEAT_LIST>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $line =~ m[</REPEAT_LIST>]o) 0 0 0
611 0 $line = $self->_readline();
612 }
613 } else {
614 0 $self->throw("Bio::SeqIO::tigr::_process_repeat_list called ",
615 "but no <MISC_INFO> in the stream");
616 }
617 }
618  
619 sub _process_tiling_path
620 0 ▶{
Subroutine _process_tiling_path: not called CC=3 SCAR=24.8
621 0 my($self) = @_;
622 0 my $line = $self->_readline();
623  
624  
625 0 ▶ if($line =~ /<TILING_PATH>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<TILING_PATH>/o) { } 0 0 0
626 0 ▶ while($line !~ /<\/TILING_PATH>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $line =~ m[</TILING_PATH>]o) 0 0 0
627 0 $line = $self->_readline();
628 }
629 } else {
630 0 $self->throw("Bio::SeqIO::tigr::_process_repeat_list called ",
631 "but no <MISC_INFO> in the stream");
632 }
633 }
634  
635 sub _process_scaffold
636 0 ▶{
Subroutine _process_scaffold: not called CC=4 SCAR=30.0
637 0 my ($self) = @_;
638 0 my $line;
639  
640 # for now we just skip them
641 0 $line = $self->_readline();
642 0 ▶ return if $line !~ /<SCAFFOLD>/o;
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /<SCAFFOLD>/o 0 0 0
643 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
defined $line and not $line =~ m[</SCAFFOLD>]o and do { do { $line = $self->_readline } } 0 0 0
Condition0%0/3
defined $line and not $line =~ m[</SCAFFOLD>]o
!ll&&!rl&&r
000
MC/DC0%0/2
defined $line and not $line =~ m[</SCAFFOLD>]o
defined $line not $line =~ m[</SCAFFOLD>]o
Truth table0%0/3
A and not(B)
A= defined $lineB= not $line =~ m[</SCAFFOLD>]o
ABresult
0X0
100
111
644 0 $line = $self->_readline();
645 } while(defined($line) && $line !~ /<\/SCAFFOLD>/o);
646 }
647  
648 sub _process_tu
649 0 ▶{
Subroutine _process_tu: not called CC=1 SCAR=6.9
650 0 my($self) = @_;
651 0 my $line = $self->_readline();
652  
653 0 ▶ try {
Subroutine __ANON__: not called CC=18 SCAR=58.3
654 0 my $tu = Bio::Seq::RichSeq->new(-strand => 1);
655 0 $tu->species( $self->{_assembly}->{species} );
656  
657 # Add the source tag, so we can add the GO annotations to it
658 0 $tu->add_SeqFeature(Bio::SeqFeature::Generic->new(-source_tag => 'TIGR', -primary_tag => 'source'));
659
660 0 ▶ if($line !~ /<TU>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<TU>/o) 0 0 0
661 0 $self->throw("Process_tu called when no <TU> tag");
662 }
663  
664 0 $line = $self->_readtag();
665 0 ▶ if ($line =~ /<FEAT_NAME>([\w\.]+)<\/FEAT_NAME>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<FEAT_NAME>([\w\.]+)</FEAT_NAME>]o) { } 0 0 0
666 0 $tu->accession_number($1);
667 0 $tu->add_secondary_accession($1);
668 0 $line = $self->_readtag();
669 } else {
670 0 $self->throw("Invalid Feat_Name");
671 }
672  
673 0 ▶ while($line =~ /<GENE_SYNONYM>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<GENE_SYNONYM>/o) 0 0 0
674 # ignore
675 0 $line = $self->_readtag();
676 }
677
678 0 ▶ while($line =~ /<CHROMO_LINK>\s*([\w\.]+)\s*<\/CHROMO_LINK>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<CHROMO_LINK>\s*([\w\.]+)\s*</CHROMO_LINK>]o) 0 0 0
679 0 $tu->add_secondary_accession($1);
680 0 $line = $self->_readtag();
681 }
682  
683 0 ▶ if ($line =~ /<DATE>([^>]*)<\/DATE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<DATE>([^>]*)</DATE>]o) { } 0 0 0
684 0 ▶ $tu->add_date($1) if $1 and $1 !~ /^\s*$/o;
Branch: 1 branch
BranchTrueFalseTotal
if $1 and not $1 =~ /^\s*$/o 0 0 0
Condition0%0/3
$1 and not $1 =~ /^\s*$/o
!ll&&!rl&&r
000
MC/DC0%0/2
$1 and not $1 =~ /^\s*$/o
$1 not $1 =~ /^\s*$/o
Truth table0%0/3
A and not(B)
A= $1B= not $1 =~ /^\s*$/o
ABresult
0X0
100
111
685 0 $line = $self->_readline();
686 } else {
687 #$self->throw("Invalid Date: $line");
688 }
689  
690 0 ▶ if ($line =~ /<GENE_INFO>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<GENE_INFO>/o) { } 0 0 0
691 0 $self->_pushback($line);
692 0 $self->_process_gene_info($tu);
693 0 $line = $self->_readline();
694 } else {
695 0 $self->throw("Invalid Gene_Info");
696 }
697  
698 0 my $source;
699 my $end5;
700 0 my $end3;
701 0 ▶ if($line =~ /<COORDSET>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<COORDSET>/o) { } 0 0 0
702 0 $self->_pushback($line);
703 0 my $cs = $self->_process_coordset();
704
705 0 $end5 = $cs->{end5};
706 0 $end3 = $cs->{end3};
707  
708 0 my $length = $end3 - $end5;
709 0 my $strand = $length <=> 0;
710 0 $length = $length * $strand;
711 0 $length++; # Correct for starting at 1, not 0
712  
713 # Add X filler sequence
714 0 $tu->seq('X' x $length);
715  
716 # Get the source tag:
717 0 my($source) = grep { $_->primary_tag() eq 'source' } $tu->get_SeqFeatures();
718  
719 # Set the start and end values
720 0 $source->start(1);
721 0 $source->end($length);
722 0 $source->strand(1);
723  
724 # Add a bunch of tags to it
725 0 $source->add_tag_value(clone => $self->{_assembly}->{clone});
726 0 $source->add_tag_value(clone_name => $self->{_assembly}->{clone_name});
727 0 $source->add_tag_value(end5 => $end5);
728 0 $source->add_tag_value(end3 => $end3);
729 0 $source->add_tag_value(chromosome => $self->{_assembly}->{chromosome});
730 0 ▶ $source->add_tag_value(strand => ( $strand == 1 ? 'positive' : 'negative' ));
Branch: 1 branch
BranchTrueFalseTotal
$strand == 1 ? : 0 0 0
731  
732 0 $line = $self->_readline();
733 } else {
734 0 $self->throw("Invalid Coordset");
735 }
736  
737 0 ▶ if($line =~ /<MODEL[^>]*>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<MODEL[^>]*>/o) { } 0 0 0
738 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$line =~ /<MODEL[^>]*>/o and do { do { $self->_pushback($line); $self->_process_model($tu, $end5, $end3); $line = $self->_readline } } 0 0 0
739 0 $self->_pushback($line);
740 0 $self->_process_model($tu, $end5, $end3);
741 0 $line = $self->_readline();
742 } while($line =~ /<MODEL[^>]*>/o);
743 0 $self->_pushback($line);
744 0 $line = $self->_readtag();
745 } else {
746 0 $self->throw("Expected <MODEL> not found");
747 }
748
749 0 ▶ if($line =~ /<TRANSCRIPT_SEQUENCE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<TRANSCRIPT_SEQUENCE>/o) 0 0 0
750 0 my @chunks;
751 0 $line = $self->_readline();
752 0 ▶ while ($line =~ /^\s*([ACGT]+)\s*$/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^\s*([ACGT]+)\s*$/o) 0 0 0
753 0 push( @chunks, $1 );
754 0 $line = $self->_readline();
755 }
756 # $line = $self->_readline();
757 }
758
759 0 ▶ if($line =~ /<GENE_EVIDENCE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<GENE_EVIDENCE>/o) 0 0 0
760 0 $line = $self->_readtag();
761 }
762
763 0 ▶ while($line =~ /<URL[^>]*>[^<]*<\/URL>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<URL[^>]*>[^<]*</URL>]o) 0 0 0
764 0 $line = $self->_readtag();
765 }
766
767 0 ▶ if($line =~ /<\/TU>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</TU>]o) { } 0 0 0
768 0 push(@{$self->{_sequences}}, $tu);
769 0 return;
770 } else {
771 0 $self->throw("Expected </TU> not found: $line");
772 }
773 0 ▶ } catch Bio::Root::OutOfRange with {
Subroutine __ANON__: not called CC=2 SCAR=17.9
774 0 my $E = shift;
775 0 $self->warn(sprintf("One sub location of a sequence is invalid near line $.\: %s", $E->text()));
776 0 ▶ $line = $self->_readline() until $line =~ /<\/TU>/o;
Branch: 1 branch
BranchTrueFalseTotal
$line =~ m[</TU>]o or do { $line = $self->_readline } 0 0 0
777 0 return;
778 0 };
779 }
780  
781 sub _process_gene_info
782 0 ▶{
Subroutine _process_gene_info: not called CC=22 SCAR=62.3
783 0 my($self, $tu) = @_;
784 0 my $line = $self->_readline();
785  
786 0 ▶ $self->throw("Invalid Gene Info: $line") if $line !~ /<GENE_INFO>/o;
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /<GENE_INFO>/o 0 0 0
787 0 $line = $self->_readline();
788  
789 0 ▶ if($line =~ /<LOCUS>\s*([\w\.]+)\s*<\/LOCUS>/o) {
Branch: 2 branches
BranchTrueFalseTotal
if ($line =~ m[<LOCUS>\s*([\w\.]+)\s*</LOCUS>]o) { } 0 0 0
elsif ($line =~ m[<LOCUS>.*</LOCUS>]o) { } 0 0 0
790 0 $tu->accession_number($1);
791 0 $tu->add_secondary_accession($1);
792 0 $line = $self->_readline();
793 } elsif( $line =~ /<LOCUS>.*<\/LOCUS>/o) {
794 # We should throw an error, but TIGR doesn't alwasy play
795 # nice with adhering to their dtd
796 0 $line = $self->_readtag();
797 } else {
798 #$self->throw("Invalid Locus: $line");
799 }
800  
801 0 ▶ if($line =~ /<ALT_LOCUS>\s*([\w\.]+)\s*<\/ALT_LOCUS>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<ALT_LOCUS>\s*([\w\.]+)\s*</ALT_LOCUS>]o) 0 0 0
802 0 $tu->accession_number($1);
803 0 $tu->add_secondary_accession($1);
804 0 $line = $self->_readline();
805 }
806  
807 0 ▶ if($line =~ /<PUB_LOCUS>\s*([\w\.]+)\s*<\/PUB_LOCUS>/o) {
Branch: 2 branches
BranchTrueFalseTotal
if ($line =~ m[<PUB_LOCUS>\s*([\w\.]+)\s*</PUB_LOCUS>]o) { } 0 0 0
elsif ($line =~ m[<PUB_LOCUS>.*</PUB_LOCUS>]o) { } 0 0 0
808 0 $tu->accession_number($1);
809 0 $tu->add_secondary_accession($1);
810 0 $line = $self->_readtag();
811 } elsif( $line =~ /<PUB_LOCUS>.*<\/PUB_LOCUS>/o) {
812 0 $line = $self->_readtag();
813 # $self->throw("Invalid Pub_Locus");
814 }
815  
816 0 ▶ if($line =~ /<GENE_NAME.*>.*<\/GENE_NAME>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<GENE_NAME.*>.*</GENE_NAME>]o) 0 0 0
817 # Skip the GENE_NAME
818 0 $line = $self->_readtag();
819 }
820  
821 0 ▶ if(my($attr, $value) = ($line =~ /<COM_NAME([^>]*)>([^>]+)<\/COM_NAME>/o)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $line =~ m[<COM_NAME([^>]*)>([^>]+)</COM_NAME>]o) { } 0 0 0
822 #%attribs = ($attr =~ /(\w+)\s*=\s+"(.*?)"/og);
823 #$geneinfo->{'CURATED'} = $attribs{CURATED};
824 #$geneinfo->{IS_PRIMARY} = $attribs{IS_PRIMARY}
825 # TODO: add a tag on sources for curated
826 0 $tu->desc($value);
827 0 $line = $self->_readtag();
828 } else {
829 0 $self->throw("invalid com_name: $line");
830 }
831  
832 0 ▶ while($line =~ /<COMMENT>([^<]+)<\/COMMENT>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<COMMENT>([^<]+)</COMMENT>]o) 0 0 0
833 0 my $comment = Bio::Annotation::Comment->new(
834 -text => $1
835 );
836 0 $tu->annotation()->add_Annotation('comment', $comment);
837 0 $line = $self->_readtag();
838 }
839  
840 0 ▶ while($line =~ /<PUB_COMMENT>([^<]+)<\/PUB_COMMENT>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<PUB_COMMENT>([^<]+)</PUB_COMMENT>]o) 0 0 0
841 0 my $comment = Bio::Annotation::Comment->new(
842 -text => $1
843 );
844 0 $tu->annotation()->add_Annotation('comment', $comment);
845 0 $line = $self->_readtag();
846 }
847  
848 0 ▶ if($line =~ /<EC_NUM>([\w\-\\\.]+)<\/EC_NUM>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<EC_NUM>([\w\-\\\.]+)</EC_NUM>]o) 0 0 0
849 #$geneinfo->{'EC_NUM'} = $1;
850 0 $line = $self->_readtag();
851 }
852  
853 0 ▶ if($line =~ /<GENE_SYM>\s*([^<]+)\s*<\/GENE_SYM>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<GENE_SYM>\s*([^<]+)\s*</GENE_SYM>]o) 0 0 0
854 #$tu->add_secondary_accession($1);
855 0 $line = $self->_readtag();
856 }
857  
858 0 ▶ if($line =~ /<IS_PSEUDOGENE>([^>]+)<\/IS_PSEUDOGENE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<IS_PSEUDOGENE>([^>]+)</IS_PSEUDOGENE>]o) { } 0 0 0
859 #$geneinfo->{'IS_PSEUDOGENE'} = $1;
860 0 $line = $self->_readtag();
861 } else {
862 0 $self->throw("invalid is_pseudogene: $line");
863 }
864  
865 0 ▶ if($line =~ /<FUNCT_ANNOT_EVIDENCE/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<FUNCT_ANNOT_EVIDENCE/o) 0 0 0
866 0 $line = $self->_readtag();
867 }
868  
869 0 ▶ if($line =~ /<DATE>([^>]+)<\/DATE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<DATE>([^>]+)</DATE>]o) 0 0 0
870 #$geneinfo->{'DATE'} = $1;
871 0 $line = $self->_readtag();
872 }
873  
874 0 ▶ while($line =~ /<GENE_ONTOLOGY>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<GENE_ONTOLOGY>/o) 0 0 0
875 # Get the source tag
876 0 my($source) = grep { $_->primary_tag() eq 'source' } $tu->get_SeqFeatures();
877  
878 0 my @ids = ( $line =~ /(<GO_ID.*?<\/GO_ID>)/gso);
879 0 foreach my $go (@ids) {
880 0 my($assignment) = ($go =~ /<GO_ID\s+ASSIGNMENT\s+=\s+"GO:(\d+)">/os);
881 0 my($term) = ($go =~ /<GO_TERM>([^<]+)<\/GO_TERM>/os);
882 0 my($type) = ($go =~ /<GO_TYPE>([^<]+)<\/GO_TYPE>/os);
883 # TODO: Add GO annotation
884 0 ▶ if(defined $type and defined $assignment and defined $term) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $type and defined $assignment and defined $term) 0 0 0
Condition0%0/6
defined $type and defined $assignment and defined $term
!ll&&!rl&&r
000
defined $type and defined $assignment
!ll&&!rl&&r
000
MC/DC0%0/3
defined $type and defined $assignment and defined $term
defined $type defined $assignment defined $term
Truth table0%0/4
A and B and C
A= defined $typeB= defined $assignmentC= defined $term
ABCresult
0XX0
10X0
1100
1111
885 # Add the GO Annotation
886 0 $source->add_tag_value(
887 GO => "ID: $assignment; Type: $type; $term"
888 );
889 }
890 }
891 0 $line = $self->_readtag();
892 }
893
894 0 ▶ if($line =~ /<\/GENE_INFO/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</GENE_INFO]o) 0 0 0
895 0 return;
896 }
897  
898 0 $self->throw("unexpected end of gene_info");
899 }
900  
901 sub _build_location
902 0 ▶{
Subroutine _build_location: not called CC=4 SCAR=30.0
903 0 my($self, $end5, $end3, $length, $cs) = @_;
904
905 # Find the start and end of the location
906 # relative to the sequence.
907 0 my $start = abs( $end5 - $cs->{end5} ) + 1;
908 0 my $end = abs( $end5 - $cs->{end3} ) + 1;
909  
910 # Do some bounds checking:
911 0 ▶ if( $start < 1 ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($start < 1) { } 0 0 0
elsif ($end > $length) { } 0 0 0
elsif ($start > $end) { } 0 0 0
912 0 throw Bio::Root::OutOfRange(
913 -text => "locations' start( $start) must be >= 1"
914 );
915 } elsif( $end > $length ) {
916 0 throw Bio::Root::OutOfRange(
917 -text => "locations' end( $end ) must be <= length( $length )"
918 );
919 } elsif( $start > $end ) {
920 0 throw Bio::Root::OutOfRange(
921 -text => "locations' start ( $start ) must be < end ( $end ) $end5, $end3, $cs->{end5}, $cs->{end3}"
922 );
923 }
924  
925 0 return Bio::Location::Simple->new( -start => $start, -end => $end, -strand => 1 );
926 }
927  
928 sub _process_model
929 0 ▶{
Subroutine _process_model: not called CC=18 SCAR=58.3
930 0 my($self, $tu, $end5, $end3) = @_;
931 0 my $line;
932 0 my( $source ) = grep { $_->primary_tag() eq 'source' } $tu->get_SeqFeatures();
933 0 my $model = Bio::SeqFeature::Generic->new(
934 -source_tag => 'TIGR',
935 -primary_tag => 'MODEL',
936 );
937  
938 0 $line = $self->_readline();
939 0 ▶ if($line !~ /<MODEL ([^>]+)>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<MODEL ([^>]+)>/o) 0 0 0
940 0 $self->throw("Invalid Model: $line")
941 }
942 0 my %attribs = ($1 =~ /(\w+)\s*=\s*"([^"]*)"/og);
943 #$model->{'CURATED'} = $attribs{'CURATED'};
944 # TODO: Add tag to model
945 0 $line = $self->_readline();
946  
947 0 ▶ if($line =~ /<FEAT_NAME>\s*([\w\.]+)\s*<\/FEAT_NAME>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<FEAT_NAME>\s*([\w\.]+)\s*</FEAT_NAME>]o) { } 0 0 0
948 0 $model->add_tag_value( feat_name => $1 );
949 0 $tu->add_secondary_accession($1);
950 0 $line = $self->_readline();
951 } else {
952 0 $self->throw("Invalid Feature Name: $line");
953 }
954  
955 0 ▶ if($line =~ /<PUB_LOCUS>\s*([\w\.]+)\s*<\/PUB_LOCUS>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<PUB_LOCUS>\s*([\w\.]+)\s*</PUB_LOCUS>]o) { } 0 0 0
956 0 $model->add_tag_value( pub_locus => $1 );
957 0 $tu->add_secondary_accession($1);
958 0 $line = $self->_readline();
959 } else {
960 # $self->throw("Invalid Pub_Locus: $line");
961 }
962  
963 0 ▶ if($line =~ /<CDNA_SUPPORT>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<CDNA_SUPPORT>/o) 0 0 0
964 0 $self->_pushback($line);
965 0 $self->_process_cdna_support( $model );
966 0 $line = $self->_readline();
967 }
968  
969 0 ▶ while($line =~ /<CHROMO_LINK>([^>]+)<\/CHROMO_LINK>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<CHROMO_LINK>([^>]+)</CHROMO_LINK>]o) 0 0 0
970 0 $model->add_tag_value( chromo_link => $1 );
971 0 $line = $self->_readline();
972 }
973  
974 0 ▶ if($line =~ /<DATE>([^>]+)<\/DATE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<DATE>([^>]+)</DATE>]o) { } 0 0 0
975 0 $line = $self->_readline();
976 } else {
977 0 $self->throw("Invalid Date: $line");
978 }
979  
980 0 ▶ if($line =~ /<COORDSET>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<COORDSET>/o) { } 0 0 0
981 0 $self->_pushback($line);
982 0 my $cs = $self->_process_coordset();
983 0 my $loc = $self->_build_location($end5, $end3, $tu->length(), $cs);
984
985 0 $model->start( $loc->start() );
986 0 $model->end( $loc->end() );
987 0 $line = $self->_readline();
988 } else {
989 0 $self->throw("Invalid Coordset: $line");
990 }
991  
992 0 my $exon = Bio::SeqFeature::Generic->new(
993 -source_tag => 'TIGR',
994 -primary_tag => 'EXON',
995 -location => Bio::Location::Split->new(),
996 -tags => [ locus => $tu->accession_number() ],
997 );
998 0 $exon->add_tag_value( model => $model->get_tag_values('feat_name') );
999  
1000 0 my $cds = Bio::SeqFeature::Generic->new(
1001 -source_tag => 'TIGR',
1002 -primary_tag => 'CDS',
1003 -location => Bio::Location::Split->new(),
1004 -tags => [ locus => $tu->accession_number() ],
1005 );
1006 0 $cds->add_tag_value( model => $model->get_tag_values('feat_name') );
1007 0 my $utr = [];
1008  
1009 0 ▶ if($line =~ /<EXON>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<EXON>/o) { } 0 0 0
1010 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$line =~ /<EXON>/o and do { do { $self->_pushback($line); $self->_process_exon($tu, $exon, $cds, $utr, $end5, $end3); $line = $self->_readline } } 0 0 0
1011 0 $self->_pushback($line);
1012 0 $self->_process_exon( $tu, $exon, $cds, $utr, $end5, $end3 );
1013 0 $line = $self->_readline();
1014 } while($line =~ /<EXON>/o);
1015 } else {
1016 0 $self->throw("Required <EXON> missing");
1017 }
1018
1019 0 ▶ until($line =~ /<\/MODEL>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ m[</MODEL>]o) 0 0 0
1020 0 $line = $self->_readline();
1021 }
1022  
1023  
1024 $_->add_tag_value( model => $model->get_tag_values('feat_name') )
1025 0 foreach @$utr;
1026  
1027 # Add the model, EXONs, CDS, and UTRs
1028 0 ▶ $tu->add_SeqFeature($model) if $model and $model->start() >= 1;
Branch: 1 branch
BranchTrueFalseTotal
if $model and $model->start >= 1 0 0 0
Condition0%0/3
$model and $model->start >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$model and $model->start >= 1
$model $model->start >= 1
Truth table0%0/3
A and B
A= $modelB= $model->start >= 1
ABresult
0X0
100
111
1029 0 ▶ $tu->add_SeqFeature($exon) if $exon and scalar($exon->location()->each_Location()) >= 1;
Branch: 1 branch
BranchTrueFalseTotal
if $exon and scalar $exon->location->each_Location >= 1 0 0 0
Condition0%0/3
$exon and scalar $exon->location->each_Location >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$exon and scalar $exon->location->each_Location >= 1
$exon scalar $exon->location->each_Location >= 1
Truth table0%0/3
A and B
A= $exonB= scalar $exon->location->each_Location >= 1
ABresult
0X0
100
111
1030 0 ▶ $tu->add_SeqFeature($cds) if $cds and scalar($cds->location()->each_Location()) >= 1;
Branch: 1 branch
BranchTrueFalseTotal
if $cds and scalar $cds->location->each_Location >= 1 0 0 0
Condition0%0/3
$cds and scalar $cds->location->each_Location >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$cds and scalar $cds->location->each_Location >= 1
$cds scalar $cds->location->each_Location >= 1
Truth table0%0/3
A and B
A= $cdsB= scalar $cds->location->each_Location >= 1
ABresult
0X0
100
111
1031 0 $tu->add_SeqFeature(@$utr);
1032  
1033 0 return;
1034 }
1035  
1036 sub _process_cdna_support
1037 0 ▶{
Subroutine _process_cdna_support: not called CC=4 SCAR=30.0
1038 0 my($self, $model) = @_;
1039 0 my $line = $self->_readline();
1040  
1041 0 ▶ if($line !~ /<CDNA_SUPPORT>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<CDNA_SUPPORT>/o) 0 0 0
1042 0 $self->throw("Bio::SeqIO::tigr::_process_cdna_support called ",
1043 "but no <CDNA_SUPPORT> in the stream");
1044 }
1045  
1046 0 $line = $self->_readline();
1047  
1048 0 ▶ while( $line =~ /<ACCESSION([^>]+)>(.*)<\/ACCESSION>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<ACCESSION([^>]+)>(.*)</ACCESSION>]o) 0 0 0
1049 # Save the text
1050 0 my $desc = $2;
1051
1052 # Get the element's attributes
1053 0 my %attribs = ($1 =~ /(\w+)\s*=\s*"([^"]*)"/og);
1054  
1055 # Add the tag to the model
1056 0 $model->add_tag_value(
1057 cdna_support => "DBXRef: $attribs{DBXREF}; $desc"
1058 );
1059  
1060 0 $line = $self->_readline();
1061 }
1062  
1063 0 ▶ if( $line =~ /<\/CDNA_SUPPORT>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</CDNA_SUPPORT>]o) 0 0 0
1064 0 return;
1065 }
1066 0 $self->throw("reached end of _process_cdna_support");
1067 }
1068  
1069  
1070 sub _process_exon
1071 0 ▶{
Subroutine _process_exon: not called CC=8 SCAR=42.8
1072 0 my($self, $tu, $exon, $cds, $utr, $end5, $end3 ) = @_;
1073 0 my $line = $self->_readline();
1074  
1075 0 ▶ if($line !~ /<EXON>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<EXON>/o) 0 0 0
1076 0 $self->throw("Bio::SeqIO::tigr::_process_exon called ",
1077 "but no <EXON> in the stream");
1078 }
1079  
1080 0 $line = $self->_readtag();
1081 0 ▶ if($line =~ /<FEAT_NAME>([^<]+)<\/FEAT_NAME>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<FEAT_NAME>([^<]+)</FEAT_NAME>]o) { } 0 0 0
1082 # Ignore
1083 0 $line = $self->_readtag();
1084 } else {
1085 0 $self->throw("Required <FEAT_NAME> missing");
1086 }
1087  
1088 0 ▶ if($line =~ /<DATE>([^<]+)<\/DATE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<DATE>([^<]+)</DATE>]o) { } 0 0 0
1089 # Ignore
1090 0 $line = $self->_readtag();
1091 } else {
1092 0 $self->throw("Required <DATE> missing");
1093 }
1094  
1095 0 ▶ if($line =~ /<COORDSET>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<COORDSET>/o) { } 0 0 0
1096 0 $self->_pushback($line);
1097 0 my $cs = $self->_process_coordset();
1098 0 my $loc = $self->_build_location($end5, $end3, $tu->length(), $cs);
1099 0 $exon->location()->add_sub_Location($loc);
1100 0 $line = $self->_readline();
1101 } else {
1102 0 $self->throw("Required <COORDSET> missing");
1103 }
1104  
1105 0 ▶ if($line =~ /<CDS>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<CDS>/o) 0 0 0
1106 0 $self->_pushback($line);
1107 0 $self->_process_cds($tu, $end5, $end3, $cds);
1108 0 $line = $self->_readline();
1109 }
1110  
1111 0 ▶ if($line =~ /<UTRS>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<UTRS>/o) 0 0 0
1112 0 $self->_pushback($line);
1113 0 $self->_process_utrs($tu, $end5, $end3, $utr);
1114 0 $line = $self->_readline();
1115 }
1116  
1117 0 ▶ if($line =~ /<\/EXON>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</EXON>]o) 0 0 0
1118 0 return;
1119 }
1120  
1121 0 $self->throw("Reached End of Bio::SeqIO::tigr::_process_exon");
1122 }
1123  
1124 sub _process_cds
1125 0 ▶{
Subroutine _process_cds: not called CC=6 SCAR=37.4
1126 0 my($self, $tu, $end5, $end3, $cds) = @_;
1127 0 my $line = $self->_readline();
1128  
1129 0 ▶ if($line !~ /<CDS>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<CDS>/o) 0 0 0
1130 0 $self->throw("Bio::SeqIO::tigr::_process_cda_support called ",
1131 "but no <CDS> in the stream");
1132 }
1133
1134 0 $line = $self->_readtag();
1135 0 ▶ if($line =~ /<FEAT_NAME>([^<]+)<\/FEAT_NAME>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<FEAT_NAME>([^<]+)</FEAT_NAME>]o) { } 0 0 0
1136 #$cds->{'FEAT_NAME'} = $1;
1137 0 $line = $self->_readtag();
1138 } else {
1139 0 $self->throw("Required <FEAT_NAME> missing");
1140 }
1141  
1142 0 ▶ if($line =~ /<DATE>([^<]+)<\/DATE>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[<DATE>([^<]+)</DATE>]o) { } 0 0 0
1143 #$cds->{'DATE'} = $1;
1144 0 $line = $self->_readtag();
1145 } else {
1146 0 $self->throw("Required <DATE> missing");
1147 }
1148  
1149 0 ▶ if($line =~ /<COORDSET>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<COORDSET>/o) { } 0 0 0
1150 0 $self->_pushback($line);
1151 0 my $cs = $self->_process_coordset();
1152 0 my $loc = $self->_build_location($end5, $end3, $tu->length(), $cs);
1153 0 $cds->location()->add_sub_Location($loc);
1154 0 $line = $self->_readline();
1155 } else {
1156 0 $self->throw("Required <COORDSET> missing");
1157 }
1158  
1159 0 ▶ if($line =~ /<\/CDS>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</CDS>]o) 0 0 0
1160 0 return;
1161 }
1162  
1163 0 $self->throw("Reached onf of Bio::SeqIO::tigr::_process_cds");
1164 }
1165  
1166 sub _process_utrs
1167 0 ▶{
Subroutine _process_utrs: not called CC=7 SCAR=40.3
1168 0 my($self, $tu, $end5, $end3, $utrs) = @_;
1169 0 my $line = $self->_readline();
1170  
1171 0 ▶ if($line !~ /<UTRS/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<UTRS/o) 0 0 0
1172 0 $self->throw("Bio::SeqIO::tigr::_process_utrs called but no ",
1173 "<UTRS> found in stream");
1174 }
1175  
1176 0 $line = $self->_readline();
1177 0 ▶ while($line !~ /<\/UTRS>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ m[</UTRS>]o) 0 0 0
1178 0 $self->_pushback($line);
1179 0 ▶ if($line =~ /<LEFT_UTR>/o) {
Branch: 3 branches
BranchTrueFalseTotal
if ($line =~ /<LEFT_UTR>/o) { } 0 0 0
elsif ($line =~ /<RIGHT_UTR>/o) { } 0 0 0
elsif ($line =~ /<EXTENDED_UTR>/o) { } 0 0 0
1180 0 $self->_process_left_utr($tu, $end5, $end3, $utrs);
1181 } elsif ($line =~ /<RIGHT_UTR>/o) {
1182 0 $self->_process_right_utr($tu, $end5, $end3, $utrs);
1183 } elsif ($line =~ /<EXTENDED_UTR>/o) {
1184 0 $self->_process_ext_utr($tu, $end5, $end3, $utrs);
1185 } else {
1186 0 $self->throw("Unexpected tag");
1187 }
1188
1189 0 $line = $self->_readline();
1190 }
1191  
1192 0 ▶ if($line =~ /<\/UTRS>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</UTRS>]o) 0 0 0
1193 0 return $utrs;
1194 }
1195 0 $self->throw("Reached end of Bio::SeqIO::tigr::_process_utrs");
1196 }
1197  
1198 sub _process_left_utr
1199 0 ▶{
Subroutine _process_left_utr: not called CC=4 SCAR=30.0
1200 0 my($self, $tu, $end5, $end3, $utrs) = @_;
1201 0 my $line = $self->_readline();
1202 0 my $coordset;
1203  
1204 0 ▶ if($line !~ /<LEFT_UTR>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<LEFT_UTR>/o) 0 0 0
1205 0 $self->throw("Bio::SeqIO::tigr::_process_left_utr called but ",
1206 "no <LEFT_UTR> found in stream");
1207 }
1208  
1209 0 $line = $self->_readtag();
1210 0 ▶ if($line =~ /<COORDSET>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<COORDSET>/o) { } 0 0 0
1211 0 $self->_pushback($line);
1212 0 my $cs = $self->_process_coordset();
1213 0 my $loc = $self->_build_location($end5, $end3, $tu->length(), $cs);
1214  
1215 0 push(@$utrs, Bio::SeqFeature::Generic->new(
1216 -source_tag => 'TIGR',
1217 -primary_tag => 'LEFT_UTR',
1218 -strand => 1,
1219 -start => $loc->start(),
1220 -end => $loc->end()
1221 ));
1222  
1223 0 $line = $self->_readline();
1224 } else {
1225 0 $self->throw("Required <COORDSET> missing");
1226 }
1227  
1228 0 ▶ if($line =~ /<\/LEFT_UTR>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</LEFT_UTR>]o) 0 0 0
1229 0 return;
1230 }
1231 0 $self->throw("Reached end of Bio::SeqIO::tigr::_process_left_utr");
1232 }
1233  
1234 sub _process_right_utr
1235 0 ▶{
Subroutine _process_right_utr: not called CC=4 SCAR=30.0
1236 0 my($self, $tu, $end5, $end3, $utrs) = @_;
1237 0 my $line = $self->_readline();
1238 0 my $coordset;
1239  
1240 0 ▶ if($line !~ /<RIGHT_UTR>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<RIGHT_UTR>/o) 0 0 0
1241 0 $self->throw("Bio::SeqIO::tigr::_process_right_utr called but ",
1242 "no <RIGHT_UTR> found in stream");
1243 }
1244  
1245 0 $line = $self->_readtag();
1246 0 ▶ if($line =~ /<COORDSET>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<COORDSET>/o) { } 0 0 0
1247 0 $self->_pushback($line);
1248 0 $coordset = $self->_process_coordset();
1249 0 $self->_pushback($line);
1250 0 my $cs = $self->_process_coordset();
1251 0 my $loc = $self->_build_location($end5, $end3, $tu->length(), $cs);
1252  
1253 0 push(@$utrs, Bio::SeqFeature::Generic->new(
1254 -source_tag => 'TIGR',
1255 -primary_tag => 'RIGHT_UTR',
1256 -strand => 1,
1257 -start => $loc->start(),
1258 -end => $loc->end()
1259 ));
1260  
1261 0 $line = $self->_readline();
1262 } else {
1263 0 $self->throw("Required <COORDSET> missing");
1264 }
1265  
1266 0 ▶ if($line =~ /<\/RIGHT_UTR>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</RIGHT_UTR>]o) 0 0 0
1267 0 return $coordset;
1268 }
1269 0 $self->throw("Reached end of Bio::SeqIO::tigr::_process_right_utr");
1270 }
1271  
1272 sub _process_ext_utr
1273 0 ▶{
Subroutine _process_ext_utr: not called CC=4 SCAR=30.0
1274 0 my($self, $tu, $end5, $end3, $utrs) = @_;
1275 0 my $line = $self->_readline();
1276 0 my $coordset;
1277  
1278 0 ▶ if($line !~ /<EXTENDED_UTR>/o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /<EXTENDED_UTR>/o) 0 0 0
1279 0 $self->throw("Bio::SeqIO::tigr::_process_ext_utr called but ",
1280 "no <EXTENDED_UTR> found in stream");
1281 }
1282  
1283 0 $line = $self->_readtag();
1284 0 ▶ if($line =~ /<COORDSET>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /<COORDSET>/o) { } 0 0 0
1285 0 $self->_pushback($line);
1286 0 my $cs = $self->_process_coordset();
1287 0 my $loc = $self->_build_location($end5, $end3, $tu->length(), $cs);
1288  
1289 0 push(@$utrs, Bio::SeqFeature::Generic->new(
1290 -source_tag => 'TIGR',
1291 -primary_tag => 'EXTENDED_UTR',
1292 -strand => 1,
1293 -start => $loc->start(),
1294 -end => $loc->end()
1295 ));
1296  
1297 0 $line = $self->_readline();
1298 } else {
1299 0 $self->throw("Required <COORDSET> missing");
1300 }
1301  
1302 0 ▶ if($line =~ /<\/EXTENDED_UTR>/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</EXTENDED_UTR>]o) 0 0 0
1303 0 return $coordset;
1304 }
1305 0 $self->throw("Reached end of Bio::SeqIO::tigr::_process_ext_utr");
1306 }
1307  
1308 sub _readtag
1309 0 ▶{
Subroutine _readtag: not called CC=7 SCAR=40.3
1310 0 my($self) = @_;
1311 0 my $line = $self->_readline();
1312 0 chomp($line);
1313  
1314 0 my $tag;
1315 0 ▶ if(($tag) = ($line =~ /^[^<]*<\/(\w+)/o)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($tag) = $line =~ m[^[^<]*</(\w+)]o) 0 0 0
1316 0 ▶ $self->_pushback($1) if $line =~ /<\/$tag>(.+)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ m[</$tag>(.+)$] 0 0 0
1317 0 return "</$tag>";
1318 }
1319
1320 0 ▶ until(($tag) = ($line =~ /<(\w+)[^>]*>/o)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (($tag) = $line =~ /<(\w+)[^>]*>/o) 0 0 0
1321 0 $line = $self->_readline();
1322 0 chomp $line;
1323 }
1324  
1325 0 ▶ until($line =~ /<\/$tag>/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ m[</$tag>]) 0 0 0
1326 0 $line .= $self->_readline();
1327 }
1328  
1329 0 ▶ if(my ($val) = ($line =~ /(<$tag.*>.*?<\/$tag>)/s)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($val) = $line =~ m[(<$tag.*>.*?</$tag>)]s) 0 0 0
1330 0 ▶ if($line =~ /<\/$tag>\s*(\w+[\s\w]*?)\s*$/s) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[</$tag>\s*(\w+[\s\w]*?)\s*$]s) 0 0 0
1331 0 $self->_pushback($1)
1332 }
1333 0 return $val;
1334 }
1335 0 $self->throw("summerror");
1336 }
1337  
1338 sub _readline
1339 0 ▶{
Subroutine _readline: not called CC=3 SCAR=24.8
1340 0 my($self) = @_;
1341 0 my $line;
1342 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
defined $line and $line =~ /^\s*$/o and do { do { $line = $self->SUPER::_readline } } 0 0 0
Condition0%0/3
defined $line and $line =~ /^\s*$/o
!ll&&!rl&&r
000
MC/DC0%0/2
defined $line and $line =~ /^\s*$/o
defined $line $line =~ /^\s*$/o
Truth table0%0/3
A and B
A= defined $lineB= $line =~ /^\s*$/o
ABresult
0X0
100
111
1343 0 $line = $self->SUPER::_readline();
1344 } while(defined($line) and $line =~ /^\s*$/o);
1345  
1346 0 return $line;
1347 }
1348  
1349 sub throw
1350 0 ▶{
Subroutine throw: not called CC=1 SCAR=6.9
Pod documented
1351 0 my($self, @s) = @_;
1352 0 my $string = "[$.]" . join('', @s);
1353 0 $self->SUPER::throw($string);
1354 }
1355  
1356 2 1;
« Bio/Ontology/InterProTerm.pm ↑ Summary Bio/SeqIO/genbank.pm »