Branch Coverage

blib/lib/Bio/ToolBox/Data/file.pm
Criterion Covered Total %
branch 186 474 39.2


line true false branch
42 0 10 if ($self->last_row != 0 or $self->number_columns != 0 or $self->filename)
49 0 10 unless ($filename)
54 0 10 unless $self->open_to_read_fh
61 0 198 unless $line =~ /\w+/
64 0 198 if (substr($line, 0, 1) eq '#')
78 0 10 unless $self->verify
87 0 24 unless my $filename = $self->check_file($file)
90 0 24 unless $Taste->open_to_read_fh
96 12 180 unless my $line = $Taste->fh->getline
97 0 180 unless $line =~ /\w+/
98 0 180 if $line =~ /^#/
105 4 20 if ($Taste->gff) { }
12 8 elsif ($Taste->bed) { }
0 8 elsif ($Taste->ucsc) { }
118 0 8 if ($number == 9) { }
0 8 elsif ($number == 10) { }
0 8 elsif ($number == 11) { }
0 8 elsif ($number == 12) { }
0 8 elsif ($number == 15) { }
3 5 elsif ($number == 16) { }
122 0 0 if $Taste->gff == 2
128 0 0 if $Taste->ucsc == 10
131 0 0 if $Taste->ucsc == 10
137 0 0 if $Taste->ucsc == 11
140 0 0 if $Taste->ucsc == 11
146 0 0 if $Taste->ucsc == 12
149 0 0 if $Taste->bed == 12
152 0 0 if $Taste->ucsc == 12
155 0 0 if $Taste->bed == 12
161 0 0 if $Taste->ucsc == 15
164 0 0 if $Taste->ucsc == 15
170 0 3 if $Taste->ucsc == 16
173 3 0 if $Taste->ucsc == 16
180 0 11 unless $file =~ /\.g[tf]f\d?(?:\.gz)?$/i
181 0 11 unless my $fh = $self->open_to_read_fh($file)
185 11 1277 unless my $line = $fh->getline
186 0 1277 unless $line =~ /\w+/
187 36 1241 if $line =~ /^#/
203 60 0 if (exists $self->{'fh'} and $self->{'fh'}) { }
0 0 elsif ($self->filename) { }
214 0 60 if ($self->last_row != 0 or $self->number_columns != 0)
230 0 60 if ($line2 =~ /[\r\n]+/)
246 0 137 if (not $line =~ /\w+/) { }
0 137 elsif ($line =~ /^# Program (.+)$/) { }
10 127 elsif ($line =~ /^# Database (.+)$/) { }
10 117 elsif ($line =~ /^# Feature (.+)$/) { }
0 117 elsif ($line =~ /^# Column_(\d+)/) { }
5 112 elsif ($line =~ /^##gff-version\s+([\d\.]+)$/) { }
0 112 elsif ($line =~ /^##fileformat=VCFv([\d\.]+)$/) { }
44 68 elsif ($line =~ /^#/) { }
8 60 elsif ($line =~ /^(?:track|browser)\s+/i) { }
311 8 0 if ($line =~ /type=(\w+)/i)
328 0 60 if ($self->_commented_header_line($line))
341 5 55 if ($format =~ /g[tf]f/i) { }
16 39 elsif ($format =~ /peak/i) { }
26 13 elsif ($format =~ /bg|bdg|bed/i) { }
0 13 elsif ($format =~ /ref+lat|genepred|ucsc/i) { }
0 13 elsif ($format =~ /sgr/i) { }
369 13 47 unless ($self->number_columns)
380 77 60 if ($self->number_columns == 0) { }
390 0 0 if ($self->number_columns == 0 and scalar @{$self->{'comments'};} and $self->{'comments'}[-1] =~ /\t/)
400 0 0 if ($noheader and not $self->bed and not $self->gff and not $self->vcf and not $self->ucsc)
423 60 0 if ($nextline)
425 0 60 if (scalar(@nextdata) - 1 == $self->number_columns)
441 60 0 if $fh
464 0 574 if (index($linedata[-1], "\t") != -1)
478 0 70 unless defined $filename
480 0 70 unless ($extension)
482 0 0 if ($filename =~ /(\.\w+(?:\.gz)?)$/i)
500 7 1 if (scalar @_ == 1) { }
508 8 0 unless (exists $args{'gz'})
511 0 8 unless ($self->verify)
517 0 8 unless ($args{'filename'} or $self->filename)
527 0 8 if ($extension =~ /(g[tf]f)/i) { }
3 5 elsif ($extension =~ /bedgraph|bed|bdg|narrowpeak|broadpeak/i) { }
0 5 elsif ($extension =~ /vcf/i) { }
0 5 elsif ($extension =~ /sgr/i) { }
0 5 elsif ($extension =~ /reff?lat|genepred|ucsc/i) { }
5 0 elsif ($extension =~ /txt/i) { }
0 0 elsif (not $extension) { }
528 0 0 unless ($self->gff)
530 0 0 $extension =~ /gtf/i ? :
531 0 0 unless ($self->verify and $self->gff)
538 1 2 unless ($self->bed)
541 0 1 unless ($self->verify and $self->bed)
543 0 0 $extension =~ /gz$/i ? :
548 0 0 unless ($self->vcf)
551 0 0 unless ($self->verify and $self->vcf)
553 0 0 $extension =~ /gz$/i ? :
558 0 0 unless ($self->{'extension'} =~ /sgr/i)
564 0 0 if ($self->extension =~ /txt/)
571 0 0 if ($self->ucsc != $self->number_columns)
575 0 0 unless ($self->verify and $self->ucsc)
577 0 0 $extension =~ /gz$/i ? :
590 0 0 if ($self->gff) { }
0 0 elsif ($self->bed) { }
0 0 elsif ($self->ucsc) { }
0 0 elsif ($self->vcf) { }
0 0 elsif ($name =~ /(\.\w{3}(?:\.gz)?)$/i) { }
0 0 elsif ($self->extension) { }
591 0 0 $self->gff == 2.5 ? :
0 0 $self->gff == 3 ? :
594 0 0 if ($self->format) { }
0 0 elsif ($self->number_columns == 4 and $self->name(3) =~ /score/i) { }
609 0 0 if ($self->format) { }
633 0 0 if ($self->extension =~ /g[tf]f/i) { }
0 0 elsif ($self->extension =~ /bed|bdg|peak/i) { }
634 0 0 $self->gff ? :
637 0 0 $self->bed ? :
655 8 0 unless ($args{'format'})
656 0 8 if (defined $args{'simple'}) { }
8 0 elsif ($extension) { }
662 0 8 if ($extension =~ /sgr|cdt/i) { }
678 8 0 unless (defined $args{'gz'})
681 0 8 if ($extension =~ /\.vcf\.gz/i) { }
0 8 elsif ($extension =~ /\.gz$/i) { }
694 0 8 if ($args{'gz'} and not $extension =~ /\.gz$/i) { }
0 8 elsif (not $args{'gz'} and $extension =~ /\.gz$/i) { }
704 0 8 if (length $name . $extension > 255)
716 0 0 if (defined $strand_i and $self->gff || $self->bed || $self->ucsc)
718 0 0 if ($self->gff) { }
0 0 elsif ($self->bed or $self->ucsc) { }
721 0 0 if ($s =~ /\d/)
722 0 0 $s == -1 ? :
0 0 $s == 1 ? :
730 0 0 if ($s =~ /\d/)
731 0 0 $s >= 0 ? :
741 0 8 unless defined $fh
745 8 0 if ($args{'format'} eq 'text')
749 0 8 if ($self->gff)
754 5 0 unless ($self->gff or $self->bed or $self->ucsc or $self->vcf or $extension =~ /sgr|kgg|cdt|peak/i)
760 0 5 if ($self->program)
763 5 0 if ($self->database)
766 5 0 if ($self->feature)
775 4 2 unless (/\n$/s)
780 5 1 if (/^#/) { }
800 8 14 if (exists $self->{$i}{'AUTO'} and scalar keys %{$$self{$i};} == $self->{$i}{'AUTO'}) { }
14 0 elsif (scalar keys %{$$self{$i};} == 2) { }
0 0 elsif ($extension =~ /sgr|kgg|cdt/i or $self->ucsc or $self->vcf) { }
826 0 0 if $_ eq 'name'
827 0 0 if $_ eq 'index'
828 0 0 if $_ eq 'AUTO'
842 5 3 if ($self->{'headers'} == 1)
848 0 8 if ($args{'format'} eq 'simple') { }
857 0 0 if ($_ eq '.') { }
894 120 41 ref($self) =~ /^Bio::ToolBox/ ? :
897 120 41 if (not $file and $obj)
900 0 161 unless ($file)
907 0 161 if ($file =~ /\.gz$/i) { }
0 161 elsif ($file =~ /\.bz2$/i) { }
909 0 0 unless $fh = 'IO::File'->new("gzip -dc $file |")
914 0 0 unless $fh = 'IO::File'->new("bzip2 -dc $file |")
919 0 161 unless $fh = 'IO::File'->new($file, 'r')
923 120 41 if ($obj)
935 0 10 unless ($filename)
943 0 10 if (length $name > 255)
949 2 8 unless (defined $gz)
952 0 2 if ($filename =~ /\.vcf(\.gz)?$/i) { }
0 2 elsif ($filename =~ /\.gz$/i) { }
964 0 10 if ($gz == 1 and not $gzip_app) { }
0 20 elsif ($gz == 2 and not $bgzip_app) { }
968 0 0 if ($gzip_app) { }
976 0 0 unless ($gzip_app)
984 0 0 if ($bgzip_app)
989 0 0 unless ($bgzip_app)
993 0 10 $gz == 2 ? :
0 10 $gz == 1 ? :
996 8 2 unless (defined $append)
1004 8 2 if (not $gzipper || $append) { }
0 2 elsif ($gzipper and not $append) { }
2 0 elsif (not $gzipper and $append) { }
0 0 elsif ($gzipper and $append) { }
1005 0 8 unless $fh = 'IO::File'->new($filename, 'w')
1009 0 0 unless $fh = 'IO::File'->new("| $gzipper >$filename")
1013 0 2 unless $fh = 'IO::File'->new(">> $filename")
1017 0 0 unless $fh = 'IO::File'->new("| $gzipper >>$filename")
1020 10 0 if defined $fh
1029 60 0 if (-e $filename) { }
1038 0 0 if (-e $filename . $ext)
1050 192 0 if exists $self->{'fh'}
1056 70 0 if exists $self->{'fh'} and $self->{'fh'}
1066 30 30 if (scalar @{$data->{'comments'};} >= 1)
1073 0 60 if (scalar @commentdata == scalar @linedata) { }
1094 0 0 if ($key eq 'index')
1095 0 0 if ($index != $value)
1107 0 0 unless (exists $temphash{'index'})
1113 0 0 if (exists $data->{$index}) { }
1139 0 5 if (not $self->gff or $force)
1140 0 0 if (defined $version) { }
0 0 elsif ($self->extension =~ /gtf/i) { }
0 0 elsif ($self->extension =~ /gff3/i) { }
1161 45 0 if ($force or not exists $self->{$i})
1167 45 0 if ($force or not defined $self->{'column_names'}[$i])
1174 5 0 if ($force or $self->{'number_columns'} == 0)
1179 5 0 unless $self->{'0'}{'name'} =~ /^#/
1182 5 0 unless (defined $self->{'feature'})
1207 0 27 if ($self->format =~ /bedgraph/i or $self->extension =~ /bg|bdg|graph/i) { }
1225 200 0 if ($force or not exists $self->{$i})
1231 200 0 if ($force or not defined $self->{'column_names'}[$i])
1238 27 0 unless (defined $self->{'feature'})
1243 27 0 unless $self->{'0'}{'name'} =~ /^#/
1258 8 8 if ($self->format =~ /narrow/i or $self->extension =~ /narrow/i) { }
0 8 elsif ($self->format =~ /broad/i or $self->extension =~ /broad/i) { }
8 0 elsif ($self->format =~ /gapped/i or $self->extension =~ /gapped/i) { }
1282 200 0 if ($force or not exists $self->{$i})
1288 200 0 if ($force or not defined $self->{'column_names'}[$i])
1295 16 0 unless (defined $self->{'feature'})
1300 16 0 unless $self->{'0'}{'name'} =~ /^#/
1321 3 0 if ($column_count == 16) { }
0 0 elsif ($column_count == 15) { }
0 0 elsif ($column_count == 12) { }
0 0 elsif ($column_count == 11) { }
0 0 elsif ($column_count == 10) { }
1346 48 0 if ($force or not exists $self->{$i})
1352 48 0 if ($force or not defined $self->{'column_names'}[$i])
1359 3 0 unless (defined $self->{'feature'})
1364 3 0 unless $self->{'0'}{'name'} =~ /^#/
1382 0 0 if ($force or not exists $self->{$i})
1388 0 0 if ($force or not defined $self->{'column_names'}[$i])
1397 0 0 unless $self->{'0'}{'name'} =~ /^#/
1400 0 0 unless (defined $self->{'feature'})
1420 0 68 if (exists $self->{$i}) { }
1421 0 0 unless ($namelist[$i] eq $self->{$i}{'name'})
1439 13 0 if (scalar @namelist != $self->{'number_columns'})
1458 5 46 if ($type eq 'gff') { }
27 19 elsif ($type eq 'bed12') { }
0 19 elsif ($type eq 'bed6') { }
0 19 elsif ($type eq 'bdg') { }
8 11 elsif ($type eq 'narrowpeak') { }
0 11 elsif ($type eq 'broadpeak') { }
8 3 elsif ($type eq 'gappedpeak') { }
0 3 elsif ($type eq 'sgr') { }
3 0 elsif ($type eq 'ucsc16') { }
0 0 elsif ($type eq 'ucsc15' or $type eq 'genepredext') { }
0 0 elsif ($type eq 'ucsc12' or $type eq 'knowngene') { }
0 0 elsif ($type eq 'ucsc11' or $type eq 'refflat') { }
0 0 elsif ($type eq 'ucsc10' or $type eq 'genepred') { }