lib/Bio/ToolBox/SeqFeature.pm

filter: Statementstmt 68.6% 221 / 322 Branchbran 51.3% 115 / 224 Conditioncond 47.4% 66 / 139 MC/DCmcdc 26.6% 20 / 75 Subroutinesub 76.3% 29 / 38 Podpod 100% 32 / 32 totaltotal 58.1% 483 / 830 CC 174 SCAR 35.0
CC
174
Cov
59%
subtract
90.0
new
69.9
intersection
56.0
CRAP 33.2
« lib/Bio/ToolBox/Parser/ucsc.pm ↑ Summary lib/Bio/ToolBox/Parser.pm »
1 package Bio::ToolBox::SeqFeature;
2  
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Carp qw(carp cluck croak confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 SEQID => 0,
8 START => 1,
9 STOP => 2,
10 STRND => 3,
11 NAME => 4,
12 ID => 5,
13 TYPE => 6,
14 SRC => 7,
15 SCORE => 8,
16 PHASE => 9,
17 ATTRB => 10,
18 SUBF => 11,
19 2 };
20  
21 2 our $VERSION = '2.03';
22  
23 #### Aliases ####
24 # to maintain compatibility with Bio::SeqFeature::Lite and Bio::SeqFeatureI we
25 # put in plenty of aliases to some of the methods
26 2 *stop = \&end;
27 2 *name = \&display_name;
28 2 *id = \&primary_id;
29 2 *method = \&primary_tag;
30 2 *source = \&source_tag;
31 2 *add_segment = \&add_SeqFeature;
32 2 *get_all_SeqFeatures = *segments = \&get_SeqFeatures;
33 2 *each_tag_value = \&get_tag_values;
34 2 *get_all_tags = \&all_tags;
35 2 *gff3_string = \&gff_string;
36  
37 # avoid once warning errors
38 2 *stop if 0;
39 2 *name if 0;
40 2 *id if 0;
41 2 *method if 0;
42 2 *source if 0;
43 2 *add_segment if 0;
44 2 *get_all_SeqFeatures if 0;
45 2 *segments if 0;
46 2 *each_tag_value if 0;
47 2 *get_all_tags if 0;
48 2 *gff3_string if 0;
49  
50 #### METHODS ####
51 1696 ▶sub new {
Subroutine new: called CC=39 SCAR=42.5
Pod documented
52 1696 my $class = shift;
53 1696 ▶ if ( ref $class ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $class) 761 935 1696
54 761 $class = ref $class;
55 }
56 1696 my %args = @_;
57 1696 my $self = bless [], $class;
58  
59 # bless ourselves early to take advantage of some methods
60 # but otherwise do what we can simply and quickly
61  
62 # primary options
63 $self->[SEQID] =
64 $args{-seq_id}
65 || $args{-seqid}
66 || $args{'-ref'}
67 || $args{chrom}
68 1696 ▶ || undef;
Condition36%4/11
$args{'-seq_id'} || $args{'-seqid'} || $args{'-ref'} || $args{'chrom'} || undef
l!l
16960
$args{"-seq_id"} or $args{"-seqid"} or $args{"-ref"} or $args{"chrom"}
l!l&&r!l&&!r
169600
$args{"-seq_id"} or $args{"-seqid"} or $args{"-ref"}
l!l&&r!l&&!r
169600
$args{"-seq_id"} or $args{"-seqid"}
l!l&&r!l&&!r
169600
MC/DC0%0/4
$args{'-seq_id'} || $args{'-seqid'} || $args{'-ref'} || $args{'chrom'} || undef
$args{"-seq_id"} $args{"-seqid"} $args{"-ref"} $args{"chrom"}
Truth table20%1/5
A or B or C or D
A= $args{"-seq_id"}B= $args{"-seqid"}C= $args{"-ref"}D= $args{"chrom"}
ABCDresult
1XXX1
01XX1
001X1
00011
00000
69 1696 ▶ $self->[START] = int $args{-start} || undef;
Condition50%1/2
int $args{'-start'} || undef
l!l
16960
MC/DC0%0/1
int $args{'-start'} || undef
int $args{'-start'}
Truth table50%1/2
A
A= int $args{'-start'}
Aresult
11
00
70 1696 ▶ $self->[STOP] = int $args{-end} || $args{-stop} || undef;
Condition40%2/5
int $args{'-end'} || $args{'-stop'} || undef
l!l
16960
int $args{"-end"} or $args{"-stop"}
l!l&&r!l&&!r
169600
MC/DC0%0/2
int $args{'-end'} || $args{'-stop'} || undef
int $args{"-end"} $args{"-stop"}
Truth table33%1/3
A or B
A= int $args{"-end"}B= $args{"-stop"}
ABresult
1X1
011
000
71 1696 ▶ $self->[NAME] = $args{-display_name} || $args{-name} || undef;
Condition100%5/5
$args{'-display_name'} || $args{'-name'} || undef
l!l
958738
$args{"-display_name"} or $args{"-name"}
l!l&&r!l&&!r
92434738
MC/DC100%2/2
$args{'-display_name'} || $args{'-name'} || undef
$args{"-display_name"} $args{"-name"}
Truth table100%3/3
A or B
A= $args{"-display_name"}B= $args{"-name"}
ABresult
1X1
011
000
72 1696 ▶ $self->[ID] = $args{-primary_id} || $args{-id} || undef;
Condition100%5/5
$args{'-primary_id'} || $args{'-id'} || undef
l!l
838858
$args{"-primary_id"} or $args{"-id"}
l!l&&r!l&&!r
8371858
MC/DC100%2/2
$args{'-primary_id'} || $args{'-id'} || undef
$args{"-primary_id"} $args{"-id"}
Truth table100%3/3
A or B
A= $args{"-primary_id"}B= $args{"-id"}
ABresult
1X1
011
000
73 1696 ▶ if ( exists $args{-strand} and defined $args{-strand} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"-strand"} and defined $args{"-strand"}) 1696 0 1696
Condition33%1/3
exists $args{"-strand"} and defined $args{"-strand"}
!ll&&!rl&&r
001696
MC/DC0%0/2
exists $args{"-strand"} and defined $args{"-strand"}
exists $args{"-strand"} defined $args{"-strand"}
Truth table33%1/3
A and B
A= exists $args{"-strand"}B= defined $args{"-strand"}
ABresult
0X0
100
111
74 1696 $self->strand( $args{-strand} );
75 }
76  
77 # check orientation
78 1696 ▶ if ( defined $self->[START]
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[1] and defined $self->[2] and $self->[1] > $self->[2]) 0 1696 1696
Condition33%2/6
defined $self->[1] and defined $self->[2] and $self->[1] > $self->[2]
!ll&&!rl&&r
016960
defined $self->[1] and defined $self->[2]
!ll&&!rl&&r
001696
MC/DC0%0/3
defined $self->[1] and defined $self->[2] and $self->[1] > $self->[2]
defined $self->[1] defined $self->[2] $self->[1] > $self->[2]
Truth table25%1/4
A and B and C
A= defined $self->[1]B= defined $self->[2]C= $self->[1] > $self->[2]
ABCresult
0XX0
10X0
1100
1111
79 and defined $self->[STOP]
80 and $self->[START] > $self->[STOP] )
81 {
82 # flip the coordinates around
83 0 ( $self->[START], $self->[STOP] ) = ( $self->[STOP], $self->[START] );
84 0 ▶ if ( defined $self->[STRND] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[3]) { } 0 0 0
85 0 $self->[STRND] *= -1;
86 }
87 else {
88 0 $self->[STRND] = -1;
89 }
90 }
91  
92 # additional options
93 1696 ▶ $args{-type} ||= $args{-primary_tag} || undef;
Condition100%5/5
$args{"-type"} ||= $args{"-primary_tag"} || undef
l!l&&r!l&&!r
471120916
$args{'-primary_tag'} || undef
l!l
120916
MC/DC100%2/2
$args{"-type"} ||= $args{"-primary_tag"} || undef
$args{"-type"} $args{'-primary_tag'}
Truth table100%3/3
A ||= B
A= $args{"-type"}B= $args{'-primary_tag'}
ABresult
1X1
011
000
94 1696 ▶ if ( defined $args{-type} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{"-type"}) 1680 16 1696
95 1680 $self->type( $args{-type} );
96 }
97 1696 ▶ $args{-source} ||= $args{-source_tag} || undef;
Condition100%5/5
$args{"-source"} ||= $args{"-source_tag"} || undef
l!l&&r!l&&!r
1213234249
$args{'-source_tag'} || undef
l!l
234249
MC/DC100%2/2
$args{"-source"} ||= $args{"-source_tag"} || undef
$args{"-source"} $args{'-source_tag'}
Truth table100%3/3
A ||= B
A= $args{"-source"}B= $args{'-source_tag'}
ABresult
1X1
011
000
98 1696 ▶ if ( defined $args{-source} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{"-source"}) 1447 249 1696
99 1447 $self->[SRC] = $args{-source};
100 }
101 1696 ▶ if ( exists $args{-score} and defined $args{-score} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"-score"} and defined $args{"-score"}) 16 1680 1696
Condition100%3/3
exists $args{"-score"} and defined $args{"-score"}
!ll&&!rl&&r
16641616
MC/DC100%2/2
exists $args{"-score"} and defined $args{"-score"}
exists $args{"-score"} defined $args{"-score"}
Truth table100%3/3
A and B
A= exists $args{"-score"}B= defined $args{"-score"}
ABresult
0X0
100
111
102 16 $self->[SCORE] = $args{-score};
103 }
104 1696 ▶ if ( exists $args{-phase} and defined $args{-phase} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"-phase"} and defined $args{"-phase"}) 278 1418 1696
Condition66%2/3
exists $args{"-phase"} and defined $args{"-phase"}
!ll&&!rl&&r
14180278
MC/DC50%1/2
exists $args{"-phase"} and defined $args{"-phase"}
exists $args{"-phase"} defined $args{"-phase"}
Truth table66%2/3
A and B
A= exists $args{"-phase"}B= defined $args{"-phase"}
ABresult
0X0
100
111
105 278 $self->phase( $args{-phase} );
106 }
107 1696 ▶ if ( exists $args{-attributes} or exists $args{-tags} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"-attributes"} or exists $args{"-tags"}) 1 1695 1696
Condition66%2/3
exists $args{"-attributes"} or exists $args{"-tags"}
l!l&&r!l&&!r
101695
MC/DC50%1/2
exists $args{"-attributes"} or exists $args{"-tags"}
exists $args{"-attributes"} exists $args{"-tags"}
Truth table66%2/3
A or B
A= exists $args{"-attributes"}B= exists $args{"-tags"}
ABresult
1X1
011
000
108 1 ▶ $args{-attributes} ||= $args{-tags};
Condition33%1/3
$args{"-attributes"} ||= $args{"-tags"}
l!l&&r!l&&!r
100
MC/DC0%0/2
$args{"-attributes"} ||= $args{"-tags"}
$args{"-attributes"} $args{"-tags"}
Truth table33%1/3
A ||= B
A= $args{"-attributes"}B= $args{"-tags"}
ABresult
1X1
011
000
109 1 ▶ if ( $args{-attributes} and ref( $args{-attributes} ) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"-attributes"} and ref $args{"-attributes"} eq "HASH") 1 0 1
Condition33%1/3
$args{"-attributes"} and ref $args{"-attributes"} eq "HASH"
!ll&&!rl&&r
001
MC/DC0%0/2
$args{"-attributes"} and ref $args{"-attributes"} eq "HASH"
$args{"-attributes"} ref $args{"-attributes"} eq "HASH"
Truth table33%1/3
A and B
A= $args{"-attributes"}B= ref $args{"-attributes"} eq "HASH"
ABresult
0X0
100
111
110 1 $self->[ATTRB] = $args{-attributes};
111 }
112 }
113 1696 ▶ if ( exists $args{-segments}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"-segments"} and $args{"-segments"} and ref $args{"-segments"} eq "ARRAY") 2 1694 1696
Condition66%4/6
exists $args{"-segments"} and $args{"-segments"} and ref $args{"-segments"} eq "ARRAY"
!ll&&!rl&&r
169402
exists $args{"-segments"} and $args{"-segments"}
!ll&&!rl&&r
169402
MC/DC33%1/3
exists $args{"-segments"} and $args{"-segments"} and ref $args{"-segments"} eq "ARRAY"
exists $args{"-segments"} $args{"-segments"} ref $args{"-segments"} eq "ARRAY"
Truth table50%2/4
A and B and C
A= exists $args{"-segments"}B= $args{"-segments"}C= ref $args{"-segments"} eq "ARRAY"
ABCresult
0XX0
10X0
1100
1111
114 and $args{-segments}
115 and ref( $args{-segments} ) eq 'ARRAY' )
116 {
117 2 $self->[SUBF] = [];
118 2 foreach my $s ( @{ $args{-segments} } ) {
119 16 ▶ unless ( ref($s) eq $class ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $s eq $class) 0 16 16
120 0 croak "FATAL: segments should be passed as $class objects!";
121 }
122 16 push @{ $self->[SUBF] }, $s;
123 }
124 }
125  
126 1696 return $self;
127 }
128  
129 2076 ▶sub seq_id {
Subroutine seq_id: called CC=3 SCAR=12.5
Pod documented
130 2076 my $self = shift;
131 2076 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 0 2076 2076
132 0 $self->[SEQID] = $_[0];
133 }
134 2076 ▶ return defined $self->[SEQID] ? $self->[SEQID] : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[0] ? : 2076 0 2076
135 }
136  
137 7382 ▶sub start {
Subroutine start: called CC=3 SCAR=12.5
Pod documented
138 7382 my $self = shift;
139 7382 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 0 7382 7382
140 0 $self->[START] = int $_[0];
141 }
142 7382 ▶ return defined $self->[START] ? $self->[START] : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[1] ? : 7382 0 7382
143 }
144  
145 2657 ▶sub end {
Subroutine end: called CC=3 SCAR=11.0
Pod documented
146 2657 my $self = shift;
147 2657 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 9 2648 2657
148 9 $self->[STOP] = int $_[0];
149 }
150 2657 ▶ return defined $self->[STOP] ? $self->[STOP] : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[2] ? : 2657 0 2657
151 }
152  
153 4556 ▶sub strand {
Subroutine strand: called CC=8 SCAR=20.8
Pod documented
154 4556 my $self = shift;
155 4556 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 1737 2819 4556
156 1737 my $str = $_[0];
157 1737 ▶ if ( $str eq '+' ) {
Branch: 5 branches
BranchTrueFalseTotal
if ($str eq '+') { } 262 1475 1737
elsif ($str eq '-') { } 116 1359 1475
elsif ($str eq '.') { } 16 1343 1359
elsif ($str =~ /^[\+\-]?1$/) { } 1245 98 1343
elsif ($str eq '0') { } 98 0 98
158 262 $self->[STRND] = 1;
159 }
160 elsif ( $str eq '-' ) {
161 116 $self->[STRND] = -1;
162 }
163 elsif ( $str eq '.' ) {
164 16 $self->[STRND] = 0;
165 }
166 elsif ( $str =~ /^[\+\-]?1$/ ) {
167 1245 $self->[STRND] = $str;
168 }
169 elsif ( $str eq '0' ) {
170 98 $self->[STRND] = 0;
171 }
172 }
173 4556 ▶ return defined $self->[STRND] ? $self->[STRND] : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[3] ? : 4556 0 4556
174 }
175  
176 1808 ▶sub display_name {
Subroutine display_name: called CC=3 SCAR=11.0
Pod documented
177 1808 my $self = shift;
178 1808 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 225 1583 1808
179 225 $self->[NAME] = $_[0];
180 }
181 1808 ▶ return defined $self->[NAME] ? $self->[NAME] : $self->primary_id;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[4] ? : 1519 289 1808
182 }
183  
184 2447 ▶sub primary_id {
Subroutine primary_id: called CC=3 SCAR=11.0
Pod documented
185 2447 my $self = shift;
186 2447 ▶ if ( defined $_[0] ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $_[0]) { } 443 2004 2447
elsif (not defined $self->[5]) { } 1 2003 2004
187 443 $self->[ID] = $_[0];
188 }
189 elsif ( not defined $self->[ID] ) {
190  
191 # automatically assign a new ID
192 1 $self->[ID] =
193 sprintf( "%s:%d-%d", $self->[SEQID], $self->[START], $self->[STOP] );
194 }
195 2447 return $self->[ID];
196 }
197  
198 12761 ▶sub primary_tag {
Subroutine primary_tag: called CC=3 SCAR=11.0
Pod documented
199 12761 my $self = shift;
200 12761 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 92 12669 12761
201 92 $self->[TYPE] = $_[0];
202 }
203 12761 ▶ return defined $self->[TYPE] ? $self->[TYPE] : 'feature';
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[6] ? : 12758 3 12761
204 }
205  
206 2414 ▶sub source_tag {
Subroutine source_tag: called CC=3 SCAR=11.0
Pod documented
207 2414 my $self = shift;
208 2414 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 135 2279 2414
209 135 $self->[SRC] = $_[0];
210 }
211 2414 ▶ return defined $self->[SRC] ? $self->[SRC] : q();
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[7] ? : 2005 409 2414
212 }
213  
214 1789 ▶sub type {
Subroutine type: called CC=6 SCAR=18.5
Pod documented
215 1789 my $self = shift;
216 1789 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 1680 109 1789
217 1680 my $type = $_[0];
218 1680 ▶ if ( $type =~ /:/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type =~ /:/) { } 0 1680 1680
219 0 my ( $t, $s ) = split /:/, $type;
220 0 $self->[TYPE] = $t;
221 0 $self->[SRC] = $s;
222 }
223 else {
224 1680 $self->[TYPE] = $type;
225 }
226 }
227 1789 ▶ $self->[TYPE] ||= undef;
Condition50%1/2
$self->[6] ||= undef
l!l
17890
MC/DC0%0/1
$self->[6] ||= undef
$self->[6]
Truth table50%1/2
A
A= $self->[6]
Aresult
11
00
228 1789 ▶ $self->[SRC] ||= undef;
Condition100%2/2
$self->[7] ||= undef
l!l
911698
MC/DC100%1/1
$self->[7] ||= undef
$self->[7]
Truth table100%2/2
A
A= $self->[7]
Aresult
11
00
229 1789 ▶ if ( defined $self->[SRC] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[7]) 91 1698 1789
230 91 return join( ':', $self->[TYPE], $self->[SRC] );
231 }
232 1698 return $self->[TYPE];
233 }
234  
235 318 ▶sub score {
Subroutine score: called CC=3 SCAR=11.0
Pod documented
236 318 my $self = shift;
237 318 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 68 250 318
238 68 $self->[SCORE] = $_[0];
239 }
240 318 ▶ return defined $self->[SCORE] ? $self->[SCORE] : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[8] ? : 70 248 318
241 }
242  
243 715 ▶sub phase {
Subroutine phase: called CC=4 SCAR=14.0
Pod documented
244 715 my $self = shift;
245 715 ▶ if ( defined $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) 394 321 715
246 394 my $p = $_[0];
247 394 ▶ unless ( $p =~ /^[012\.]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($p =~ /^[012\.]$/) 0 394 394
248 0 carp 'ERROR: phase must be 0, 1, 2 or .!';
249 }
250 394 $self->[PHASE] = $p;
251 }
252 715 ▶ return defined $self->[PHASE] ? $self->[PHASE] : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[9] ? : 596 119 715
253 }
254  
255 471 ▶sub duplicate {
Subroutine duplicate: called CC=3 SCAR=11.3
Pod documented
256 471 my $self = shift;
257 471 my $n = $self->new(
258 -seq_id => $self->[SEQID],
259 -start => $self->[START],
260 -end => $self->[STOP],
261 -strand => $self->strand,
262 -type => $self->primary_tag,
263 -source => $self->source_tag,
264 -display_name => $self->name
265 );
266 471 ▶ $n->score( $self->[SCORE] ) if defined $self->[SCORE];
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->[8] 0 471 471
267 471 ▶ $n->phase( $self->[PHASE] ) if defined $self->[PHASE];
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->[9] 0 471 471
268 471 return $n;
269 }
270  
271 773 ▶sub add_SeqFeature {
Subroutine add_SeqFeature: called CC=8 SCAR=21.1
Pod documented
272 773 my $self = shift;
273 773 ▶ return unless (@_);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 773 773
274 773 ▶ $self->[SUBF] ||= [];
Condition100%2/2
$self->[11] ||= []
l!l
583190
MC/DC100%1/1
$self->[11] ||= []
$self->[11]
Truth table100%2/2
A
A= $self->[11]
Aresult
11
00
275 773 my $count = 0;
276 773 foreach my $s (@_) {
277 773 ▶ if ( ref($s) eq ref($self) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $s eq ref $self) { } 773 0 773
278 773 ▶ $s->seq_id( $self->seq_id ) unless ( $s->seq_id );
Branch: 1 branch
BranchTrueFalseTotal
unless $s->seq_id 0 773 773
279 773 ▶ $s->strand( $self->strand ) unless ( $s->strand );
Branch: 1 branch
BranchTrueFalseTotal
unless $s->strand 41 732 773
280 773 ▶ $s->source_tag( $self->source_tag ) unless ( $s->source_tag );
Branch: 1 branch
BranchTrueFalseTotal
unless $s->source_tag 135 638 773
281 773 push @{ $self->[SUBF] }, $s;
282 773 $count++;
283 }
284 else {
285 0 carp 'ERROR: use SeqFeature objects when adding sub features!';
286 }
287 }
288 773 return $count;
289 }
290  
291 1412 ▶sub get_SeqFeatures {
Subroutine get_SeqFeatures: called CC=4 SCAR=13.9
Pod documented
292 1412 my $self = shift;
293 1412 ▶ return unless $self->[SUBF];
Branch: 1 branch
BranchTrueFalseTotal
unless $self->[11] 148 1264 1412
294 1264 my @children;
295 1264 foreach ( @{ $self->[SUBF] } ) {
296 13417 push @children, $_;
297 }
298 1264 ▶ return wantarray ? @children : \@children;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 1264 0 1264
299 }
300  
301 0 ▶sub delete_SeqFeature {
Subroutine delete_SeqFeature: not called CC=6 SCAR=37.4
Pod documented
302 0 my $self = shift;
303 0 my $id = shift;
304 0 ▶ return unless $id;
Branch: 1 branch
BranchTrueFalseTotal
unless $id 0 0 0
305 0 ▶ return unless $self->[SUBF];
Branch: 1 branch
BranchTrueFalseTotal
unless $self->[11] 0 0 0
306 0 my $d;
307 0 my $i = 0;
308 0 foreach ( @{ $self->[SUBF] } ) {
309 0 ▶ if ( $_->[ID] eq $id ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_->[5] eq $id) 0 0 0
310 0 $d = $i;
311 0 last;
312 }
313 0 $i++;
314 }
315 0 ▶ if ( defined $d ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $d) 0 0 0
316 0 splice( @{ $self->[SUBF] }, $d, 1 );
317 0 return 1;
318 }
319 0 return;
320 }
321  
322 813 ▶sub add_tag_value {
Subroutine add_tag_value: called CC=6 SCAR=24.1
Pod documented
323 813 my ( $self, $key, $value ) = @_;
324 813 ▶ return unless ( defined $key and defined $value );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key and defined $value 0 813 813
Condition33%1/3
defined $key and defined $value
!ll&&!rl&&r
00813
MC/DC0%0/2
defined $key and defined $value
defined $key defined $value
Truth table33%1/3
A and B
A= defined $keyB= defined $value
ABresult
0X0
100
111
325 813 ▶ $self->[ATTRB] ||= {};
Condition100%2/2
$self->[10] ||= {}
l!l
424389
MC/DC100%1/1
$self->[10] ||= {}
$self->[10]
Truth table100%2/2
A
A= $self->[10]
Aresult
11
00
326 813 ▶ if ( exists $self->[ATTRB]->{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->[10]{$key}) { } 0 813 813
327 0 ▶ if ( ref( $self->[ATTRB]->{$key} ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->[10]{$key} eq 'ARRAY') { } 0 0 0
328 0 push @{ $self->[ATTRB]->{$key} }, $value;
329 }
330 else {
331 0 my $current = $self->[ATTRB]->{$key};
332 0 $self->[ATTRB]->{$key} = [ $current, $value ];
333 }
334 }
335 else {
336 813 $self->[ATTRB]->{$key} = $value;
337 }
338 }
339  
340 759 ▶sub has_tag {
Subroutine has_tag: called CC=3 SCAR=11.0
Pod documented
341 759 my ( $self, $key ) = @_;
342 759 ▶ return unless $key;
Branch: 1 branch
BranchTrueFalseTotal
unless $key 0 759 759
343 759 ▶ return unless $self->[ATTRB];
Branch: 1 branch
BranchTrueFalseTotal
unless $self->[10] 132 627 759
344 627 return exists $self->[ATTRB]->{$key};
345 }
346  
347 400 ▶sub get_tag_values {
Subroutine get_tag_values: called CC=6 SCAR=19.6
Pod documented
348 400 my ( $self, $key ) = @_;
349 400 ▶ return unless $key;
Branch: 1 branch
BranchTrueFalseTotal
unless $key 0 400 400
350 400 ▶ return unless $self->[ATTRB];
Branch: 1 branch
BranchTrueFalseTotal
unless $self->[10] 27 373 400
351 373 ▶ if ( exists $self->[ATTRB]->{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->[10]{$key}) { } 321 52 373
352 321 ▶ if ( ref( $self->[ATTRB]->{$key} ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->[10]{$key} eq 'ARRAY') { } 0 321 321
353 0 ▶ return wantarray ? @{ $self->[ATTRB]->{$key} } : $self->[ATTRB]->{$key};
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
354 }
355 else {
356 321 return $self->[ATTRB]->{$key};
357 }
358 }
359 else {
360 52 return;
361 }
362 }
363  
364 1 ▶sub attributes {
Subroutine attributes: called CC=3 SCAR=16.5
Pod documented
365 1 my $self = shift;
366 1 ▶ return unless $self->[ATTRB];
Branch: 1 branch
BranchTrueFalseTotal
unless $self->[10] 1 0 1
367 0 ▶ return wantarray ? %{ $self->[ATTRB] } : $self->[ATTRB];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
368 }
369  
370 49 ▶sub all_tags {
Subroutine all_tags: called CC=3 SCAR=11.0
Pod documented
371 49 my $self = shift;
372 49 ▶ return unless $self->[ATTRB];
Branch: 1 branch
BranchTrueFalseTotal
unless $self->[10] 34 15 49
373 15 my @k = keys %{ $self->[ATTRB] };
374 15 ▶ return wantarray ? @k : \@k;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 15 0 15
375 }
376  
377 0 ▶sub remove_tag {
Subroutine remove_tag: not called CC=4 SCAR=30.0
Pod documented
378 0 my ( $self, $key ) = @_;
379 0 ▶ return unless $key;
Branch: 1 branch
BranchTrueFalseTotal
unless $key 0 0 0
380 0 ▶ return unless $self->[ATTRB];
Branch: 1 branch
BranchTrueFalseTotal
unless $self->[10] 0 0 0
381 0 ▶ if ( exists $self->[ATTRB]->{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->[10]{$key}) 0 0 0
382 0 delete $self->[ATTRB]->{$key};
383 }
384 }
385  
386 ### Range Methods
387 # Borrowed from Bio::RangeI, but does not do strong/weak strand checks
388  
389 271 ▶sub length {
Subroutine length: called CC=1 SCAR=0.0
Pod documented
390 271 my $self = shift;
391 271 return $self->end - $self->start + 1;
392 }
393  
394 0 ▶sub overlaps {
Subroutine overlaps: not called CC=5 SCAR=34.0
Pod documented
395 0 my ( $self, $other ) = @_;
396 0 ▶ return unless ( $other and ref($other) =~ /seqfeature|range/xi );
Branch: 1 branch
BranchTrueFalseTotal
unless $other and ref($other) =~ /seqfeature|range/xi 0 0 0
Condition0%0/3
$other and ref($other) =~ /seqfeature|range/xi
!ll&&!rl&&r
000
MC/DC0%0/2
$other and ref($other) =~ /seqfeature|range/xi
$other ref($other) =~ /seqfeature|range/xi
Truth table0%0/3
A and B
A= $otherB= ref($other) =~ /seqfeature|range/xi
ABresult
0X0
100
111
397 0 ▶ return unless ( $self->seq_id eq $other->seq_id );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->seq_id eq $other->seq_id 0 0 0
398 0 ▶ return not( $self->start > $other->end
Condition0%0/3
$self->start > $other->end || $self->end < $other->start
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->start > $other->end || $self->end < $other->start
$self->start > $other->end $self->end < $other->start
Truth table0%0/3
A || B
A= $self->start > $other->endB= $self->end < $other->start
ABresult
1X1
011
000
399 or $self->end < $other->start );
400 }
401  
402 0 ▶sub contains {
Subroutine contains: not called CC=5 SCAR=34.0
Pod documented
403 0 my ( $self, $other ) = @_;
404 0 ▶ return unless ( $other and ref($other) =~ /seqfeature|range/xi );
Branch: 1 branch
BranchTrueFalseTotal
unless $other and ref($other) =~ /seqfeature|range/xi 0 0 0
Condition0%0/3
$other and ref($other) =~ /seqfeature|range/xi
!ll&&!rl&&r
000
MC/DC0%0/2
$other and ref($other) =~ /seqfeature|range/xi
$other ref($other) =~ /seqfeature|range/xi
Truth table0%0/3
A and B
A= $otherB= ref($other) =~ /seqfeature|range/xi
ABresult
0X0
100
111
405 0 ▶ return unless ( $self->seq_id eq $other->seq_id );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->seq_id eq $other->seq_id 0 0 0
406 0 ▶ return ( $other->start >= $self->start and $other->end <= $self->end );
Condition0%0/3
$other->start >= $self->start && $other->end <= $self->end
!ll&&!rl&&r
000
MC/DC0%0/2
$other->start >= $self->start && $other->end <= $self->end
$other->start >= $self->start $other->end <= $self->end
Truth table0%0/3
A && B
A= $other->start >= $self->startB= $other->end <= $self->end
ABresult
0X0
100
111
407 }
408  
409 0 ▶sub equals {
Subroutine equals: not called CC=5 SCAR=34.0
Pod documented
410 0 my ( $self, $other ) = @_;
411 0 ▶ return unless ( $other and ref($other) =~ /seqfeature|range/xi );
Branch: 1 branch
BranchTrueFalseTotal
unless $other and ref($other) =~ /seqfeature|range/xi 0 0 0
Condition0%0/3
$other and ref($other) =~ /seqfeature|range/xi
!ll&&!rl&&r
000
MC/DC0%0/2
$other and ref($other) =~ /seqfeature|range/xi
$other ref($other) =~ /seqfeature|range/xi
Truth table0%0/3
A and B
A= $otherB= ref($other) =~ /seqfeature|range/xi
ABresult
0X0
100
111
412 0 ▶ return unless ( $self->seq_id eq $other->seq_id );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->seq_id eq $other->seq_id 0 0 0
413 0 ▶ return ( $other->start == $self->start and $other->end == $self->end );
Condition0%0/3
$other->start == $self->start && $other->end == $self->end
!ll&&!rl&&r
000
MC/DC0%0/2
$other->start == $self->start && $other->end == $self->end
$other->start == $self->start $other->end == $self->end
Truth table0%0/3
A && B
A= $other->start == $self->startB= $other->end == $self->end
ABresult
0X0
100
111
414 }
415  
416 0 ▶sub intersection {
Subroutine intersection: not called CC=7 SCAR=40.3
Pod documented
417 0 my ( $self, $other ) = @_;
418 0 ▶ return unless ( $other and ref($other) =~ /seqfeature|range/xi );
Branch: 1 branch
BranchTrueFalseTotal
unless $other and ref($other) =~ /seqfeature|range/xi 0 0 0
Condition0%0/3
$other and ref($other) =~ /seqfeature|range/xi
!ll&&!rl&&r
000
MC/DC0%0/2
$other and ref($other) =~ /seqfeature|range/xi
$other ref($other) =~ /seqfeature|range/xi
Truth table0%0/3
A and B
A= $otherB= ref($other) =~ /seqfeature|range/xi
ABresult
0X0
100
111
419 0 ▶ return unless ( $self->seq_id eq $other->seq_id );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->seq_id eq $other->seq_id 0 0 0
420 0 my ( $start, $stop );
421 0 ▶ if ( $self->start >= $other->start ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->start >= $other->start) { } 0 0 0
422 0 $start = $self->start;
423 }
424 else {
425 0 $start = $other->start;
426 }
427 0 ▶ if ( $self->end <= $other->end ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->end <= $other->end) { } 0 0 0
428 0 $stop = $self->end;
429 }
430 else {
431 0 $stop = $other->end;
432 }
433 0 ▶ return if $start > $stop;
Branch: 1 branch
BranchTrueFalseTotal
if $start > $stop 0 0 0
434 0 return $self->new(
435 -seq_id => $self->seq_id,
436 -start => $start,
437 -end => $stop,
438 );
439 }
440  
441 0 ▶sub union {
Subroutine union: not called CC=7 SCAR=40.3
Pod documented
442 0 my ( $self, $other ) = @_;
443 0 ▶ return unless ( $other and ref($other) =~ /seqfeature|range/xi );
Branch: 1 branch
BranchTrueFalseTotal
unless $other and ref($other) =~ /seqfeature|range/xi 0 0 0
Condition0%0/3
$other and ref($other) =~ /seqfeature|range/xi
!ll&&!rl&&r
000
MC/DC0%0/2
$other and ref($other) =~ /seqfeature|range/xi
$other ref($other) =~ /seqfeature|range/xi
Truth table0%0/3
A and B
A= $otherB= ref($other) =~ /seqfeature|range/xi
ABresult
0X0
100
111
444 0 ▶ return unless ( $self->seq_id eq $other->seq_id );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->seq_id eq $other->seq_id 0 0 0
445 0 my ( $start, $stop );
446 0 ▶ if ( $self->start <= $other->start ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->start <= $other->start) { } 0 0 0
447 0 $start = $self->start;
448 }
449 else {
450 0 $start = $other->start;
451 }
452 0 ▶ if ( $self->end >= $other->end ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->end >= $other->end) { } 0 0 0
453 0 $stop = $self->end;
454 }
455 else {
456 0 $stop = $other->end;
457 }
458 0 ▶ return if $start > $stop;
Branch: 1 branch
BranchTrueFalseTotal
if $start > $stop 0 0 0
459 0 return $self->new(
460 -seq_id => $self->seq_id,
461 -start => $start,
462 -end => $stop,
463 );
464 }
465  
466 0 ▶sub subtract {
Subroutine subtract: not called CC=9 SCAR=45.0
Pod documented
467 0 my ( $self, $other ) = @_;
468 0 ▶ return unless ( $other and ref($other) =~ /seqfeature|range/xi );
Branch: 1 branch
BranchTrueFalseTotal
unless $other and ref($other) =~ /seqfeature|range/xi 0 0 0
Condition0%0/3
$other and ref($other) =~ /seqfeature|range/xi
!ll&&!rl&&r
000
MC/DC0%0/2
$other and ref($other) =~ /seqfeature|range/xi
$other ref($other) =~ /seqfeature|range/xi
Truth table0%0/3
A and B
A= $otherB= ref($other) =~ /seqfeature|range/xi
ABresult
0X0
100
111
469 0 ▶ return unless ( $self->seq_id eq $other->seq_id );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->seq_id eq $other->seq_id 0 0 0
470 0 ▶ return if $self->equals($other);
Branch: 1 branch
BranchTrueFalseTotal
if $self->equals($other) 0 0 0
471 0 my @pieces;
472 0 ▶ if ( $self->overlaps($other) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->overlaps($other)) { } 0 0 0
473 0 my $int = $self->intersection($other);
474 0 ▶ if ( $self->start < $int->start ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->start < $int->start) 0 0 0
475 0 push @pieces,
476 $self->new(
477 -seq_id => $self->seq_id,
478 -start => $self->start,
479 -end => $int->start - 1,
480 );
481 }
482 0 ▶ if ( $self->end > $int->end ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->end > $int->end) 0 0 0
483 0 push @pieces,
484 $self->new(
485 -seq_id => $self->seq_id,
486 -start => $int->end + 1,
487 -end => $self->end,
488 );
489 }
490 }
491 else {
492 0 push @pieces,
493 $self->new(
494 -seq_id => $self->seq_id,
495 -start => $self->start,
496 -end => $self->end,
497 );
498 }
499 0 ▶ return wantarray ? @pieces : \@pieces;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
500 }
501  
502 ### Export methods
503  
504 2 ▶sub version {
Subroutine version: called CC=3 SCAR=13.3
Pod documented
505 2 my $self = shift;
506 2 ▶ if ( @_ and $_[0] ne '3' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and $_[0] ne 3) 0 2 2
Condition33%1/3
@_ and $_[0] ne 3
!ll&&!rl&&r
020
MC/DC0%0/2
@_ and $_[0] ne 3
@_ $_[0] ne 3
Truth table33%1/3
A and B
A= @_B= $_[0] ne 3
ABresult
0X0
100
111
507 0 carp 'sorry, only GFF version 3 is currently supported!';
508 }
509 2 return 3;
510 }
511  
512 101 ▶sub gff_string {
Subroutine gff_string: called CC=28 SCAR=36.5
Pod documented
513  
514 # exports version 3 GFF, sorry, no mechanism for others....
515 101 my $self = shift;
516 101 ▶ my $recurse = shift || 0;
Condition50%1/2
shift() || 0
l!l
1010
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
517 101 ▶ my $childIDs = shift || undef;
Condition100%2/2
shift() || undef
l!l
992
MC/DC100%1/1
shift() || undef
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
518  
519 # skip myself if we've already printed myself
520 return if ( $recurse
521 and $childIDs
522 101 ▶ and not exists $childIDs->{ $self->primary_id } );
Branch: 1 branch
BranchTrueFalseTotal
if $recurse and $childIDs and not exists $$childIDs{$self->primary_id} 52 49 101
Condition83%5/6
$recurse and $childIDs and not exists $$childIDs{$self->primary_id}
!ll&&!rl&&r
24752
$recurse and $childIDs
!ll&&!rl&&r
0299
MC/DC66%2/3
$recurse and $childIDs and not exists $$childIDs{$self->primary_id}
$recurse $childIDs not exists $$childIDs{$self->primary_id}
Truth table75%3/4
A and B and not(C)
A= $recurseB= $childIDsC= not exists $$childIDs{$self->primary_id}
ABCresult
0XX0
10X0
1100
1111
523  
524 # map all parent-child relationships
525 49 ▶ if ( $recurse and not defined $childIDs ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($recurse and not defined $childIDs) 2 47 49
Condition66%2/3
$recurse and not defined $childIDs
!ll&&!rl&&r
0472
MC/DC50%1/2
$recurse and not defined $childIDs
$recurse not defined $childIDs
Truth table66%2/3
A and not(B)
A= $recurseB= not defined $childIDs
ABresult
0X0
100
111
526  
527 # we have a top level SeqFeature and we need to go spelunking for IDs
528 2 $childIDs = {};
529 2 foreach my $f ( $self->get_SeqFeatures ) {
530 14 $f->_spelunk( $self->primary_id, $childIDs );
531 }
532 }
533  
534 # basics
535 49 ▶ my $string = join(
Branch: 4 branches
BranchTrueFalseTotal
defined $self->score ? : 0 49 49
$self->strand > 0 ? : 49 0 49
$self->strand < 0 ? : 0 0 0
defined $self->phase ? : 15 34 49
Condition50%4/8
$self->seq_id || '.'
l!l
490
$self->source_tag || '.'
l!l
490
$self->start || 1
l!l
490
$self->end || 1
l!l
490
MC/DC0%0/1
$self->seq_id || '.'
$self->seq_id
MC/DC0%0/1
$self->source_tag || '.'
$self->source_tag
MC/DC0%0/1
$self->start || 1
$self->start
MC/DC0%0/1
$self->end || 1
$self->end
Truth table50%1/2
A
A= $self->seq_id
Aresult
11
00
Truth table50%1/2
A
A= $self->source_tag
Aresult
11
00
Truth table50%1/2
A
A= $self->start
Aresult
11
00
Truth table50%1/2
A
A= $self->end
Aresult
11
00
536 "\t",
537 (
538 $self->seq_id || '.',
539 $self->source_tag || '.',
540 $self->primary_tag,
541 $self->start || 1,
542 $self->end || 1,
543 defined $self->score ? $self->score : '.',
544 $self->strand > 0 ? '+' : $self->strand < 0 ? '-' : '.',
545 defined $self->phase ? $self->phase : '.',
546 )
547 );
548  
549 # group attributes
550 49 my $attributes;
551 49 my $name = $self->display_name;
552 49 ▶ if ($name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name) { } 49 0 49
553  
554 # names are optional and may not exist
555 49 $attributes = sprintf "Name=%s;ID=%s", $self->_encode($name),
556 $self->_encode( $self->primary_id );
557 }
558 else {
559 # IDs always exist
560 0 $attributes = sprintf "ID=%s", $self->_encode( $self->primary_id );
561 }
562 49 ▶ if ($childIDs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($childIDs) 49 0 49
563 49 ▶ if ( exists $childIDs->{ $self->primary_id } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $$childIDs{$self->primary_id}) 47 2 49
564 $attributes .= ';Parent='
565 . join( ',',
566 100 sort { $a cmp $b }
567 99 map { $self->_encode($_) }
568 47 keys %{ $childIDs->{ $self->primary_id } } );
569 47 delete $childIDs->{ $self->primary_id };
570 }
571 }
572 49 foreach my $tag ( $self->all_tags ) {
573 67 ▶ next if $tag eq 'Name';
Branch: 1 branch
BranchTrueFalseTotal
if $tag eq "Name" 0 67 67
574 67 ▶ next if $tag eq 'ID';
Branch: 1 branch
BranchTrueFalseTotal
if $tag eq "ID" 0 67 67
575 67 ▶ next if $tag eq 'Parent';
Branch: 1 branch
BranchTrueFalseTotal
if $tag eq "Parent" 14 53 67
576 53 my $value = $self->get_tag_values($tag);
577 53 ▶ if ( ref($value) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value eq 'ARRAY') { } 0 53 53
578 0 $value = join( ',', map { $self->_encode($_) } @{$value} );
579 }
580 else {
581 53 $value = $self->_encode($value);
582 }
583 53 $attributes .= ";$tag=$value";
584 }
585 49 $string .= "\t$attributes\n";
586  
587 # recurse
588 49 ▶ if ($recurse) {
Branch: 1 branch
BranchTrueFalseTotal
if ($recurse) 49 0 49
589 49 foreach my $f ( $self->get_SeqFeatures ) {
590 99 my $s = $f->gff_string( 1, $childIDs );
591 99 ▶ $string .= $s if $s;
Branch: 1 branch
BranchTrueFalseTotal
if $s 47 52 99
592 }
593 }
594 49 return $string;
595 }
596  
597 250 ▶sub _encode {
Subroutine _encode: called CC=1 SCAR=0.2
598 250 my ( $self, $value ) = @_;
599 0 $value =~ s/( [\t\n\r%&\=;,\ ] ) /sprintf("%%%X", ord($1) )/xge;
600 250 return $value;
601 }
602  
603 99 ▶sub _spelunk {
Subroutine _spelunk: called CC=2 SCAR=6.9
604 99 my ( $self, $parentID, $childIDs ) = @_;
605 99 $childIDs->{ $self->primary_id }{$parentID} += 1;
606 99 foreach my $f ( $self->get_SeqFeatures ) {
607 85 $f->_spelunk( $self->primary_id, $childIDs );
608 }
609 }
610  
611 0 ▶sub bed_string {
Subroutine bed_string: not called CC=7 SCAR=40.3
Pod documented
612 0 my $self = shift;
613 0 ▶ my $string = join(
Branch: 2 branches
BranchTrueFalseTotal
defined $self->score ? : 0 0 0
$self->strand >= 0 ? : 0 0 0
Condition0%0/9
$self->seq_id || '.'
l!l
00
$self->start || 1
l!l
00
$self->end || 1
l!l
00
$self->display_name || $self->primary_id
l!l&&r!l&&!r
000
MC/DC0%0/1
$self->seq_id || '.'
$self->seq_id
MC/DC0%0/1
$self->start || 1
$self->start
MC/DC0%0/1
$self->end || 1
$self->end
MC/DC0%0/2
$self->display_name || $self->primary_id
$self->display_name $self->primary_id
Truth table0%0/2
A
A= $self->seq_id
Aresult
11
00
Truth table0%0/2
A
A= $self->start
Aresult
11
00
Truth table0%0/2
A
A= $self->end
Aresult
11
00
Truth table0%0/3
A || B
A= $self->display_nameB= $self->primary_id
ABresult
1X1
011
000
614 "\t",
615 (
616 $self->seq_id || '.',
617 ( $self->start || 1 ) - 1,
618 $self->end || 1,
619 $self->display_name || $self->primary_id,
620 defined $self->score ? $self->score : 0,
621 $self->strand >= 0 ? '+' : '-',
622 )
623 );
624 0 return "$string\n";
625 }
626  
627 2 1;
628  
629 __END__
« lib/Bio/ToolBox/Parser/ucsc.pm ↑ Summary lib/Bio/ToolBox/Parser.pm »