Branch Coverage

blib/lib/Bio/ToolBox/Data/file.pm
Criterion Covered Total %
branch 192 486 39.5


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)
130 0 0 if $Taste->ucsc == 10
133 0 0 if ($Taste->ucsc == 10)
141 0 0 if $Taste->ucsc == 11
144 0 0 if ($Taste->ucsc == 11)
152 0 0 if ($Taste->ucsc == 12)
157 0 0 if ($Taste->bed == 12)
162 0 0 if ($Taste->ucsc == 12)
167 0 0 if ($Taste->bed == 12)
175 0 0 if ($Taste->ucsc == 15)
180 0 0 if ($Taste->ucsc == 15)
188 0 3 if ($Taste->ucsc == 16)
191 0 3 if $Taste->ucsc == 16
194 3 0 if ($Taste->ucsc == 16)
203 0 11 unless $file =~ /\.g[tf]f\d?(?:\.gz)?$/i
204 0 11 unless my $fh = $self->open_to_read_fh($file)
208 11 1277 unless my $line = $fh->getline
209 0 1277 unless $line =~ /\w+/
210 36 1241 if $line =~ /^#/
226 60 0 if (exists $self->{'fh'} and $self->{'fh'}) { }
0 0 elsif ($self->filename) { }
237 0 60 if ($self->last_row != 0 or $self->number_columns != 0)
253 0 60 if ($line2 =~ /[\r\n]+/)
269 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) { }
334 8 0 if ($line =~ /type=(\w+)/i)
351 0 60 if ($self->_commented_header_line($line))
364 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) { }
392 13 47 unless ($self->number_columns)
403 77 60 if ($self->number_columns == 0) { }
413 0 0 if ($self->number_columns == 0 and scalar @{$self->{'comments'};} and $self->{'comments'}[-1] =~ /\t/)
423 0 0 if ($noheader and not $self->bed and not $self->gff and not $self->vcf and not $self->ucsc)
446 60 0 if ($nextline)
448 0 60 if (scalar(@nextdata) - 1 == $self->number_columns)
457 26 34 if (ref $self eq "Bio::ToolBox::Data::Stream")
469 60 0 if $fh
492 0 574 if (index($linedata[-1], "\t") != -1)
506 0 70 unless defined $filename
508 0 70 unless ($extension)
510 0 0 if ($filename =~ /(\.\w+(?:\.gz)?)$/i)
528 7 1 if (scalar @_ == 1) { }
536 8 0 unless (exists $args{'gz'})
539 0 8 unless ($self->verify)
545 0 8 unless ($args{'filename'} or $self->filename)
555 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) { }
556 0 0 unless ($self->gff)
558 0 0 $extension =~ /gtf/i ? :
559 0 0 unless ($self->verify and $self->gff)
566 1 2 unless ($self->bed)
569 0 1 unless ($self->verify and $self->bed)
571 0 0 $extension =~ /gz$/i ? :
576 0 0 unless ($self->vcf)
579 0 0 unless ($self->verify and $self->vcf)
581 0 0 $extension =~ /gz$/i ? :
586 0 0 unless ($self->{'extension'} =~ /sgr/i)
592 0 0 if ($self->extension =~ /txt/)
599 0 0 if ($self->ucsc != $self->number_columns)
603 0 0 unless ($self->verify and $self->ucsc)
605 0 0 $extension =~ /gz$/i ? :
612 5 0 unless $self->{'headers'} == -1
618 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) { }
619 0 0 $self->gff == 2.5 ? :
0 0 $self->gff == 3 ? :
622 0 0 if ($self->format) { }
0 0 elsif ($self->number_columns == 4 and $self->name(3) =~ /score/i) { }
637 0 0 if ($self->format) { }
661 0 0 if ($self->extension =~ /g[tf]f/i) { }
0 0 elsif ($self->extension =~ /bed|bdg|peak/i) { }
662 0 0 $self->gff ? :
665 0 0 $self->bed ? :
683 8 0 unless ($args{'format'})
684 0 8 if (defined $args{'simple'}) { }
8 0 elsif ($extension) { }
690 0 8 if ($extension =~ /sgr|cdt/i) { }
706 8 0 unless (defined $args{'gz'})
709 0 8 if ($extension =~ /\.vcf\.gz/i) { }
0 8 elsif ($extension =~ /\.gz$/i) { }
722 0 8 if ($args{'gz'} and not $extension =~ /\.gz$/i) { }
0 8 elsif (not $args{'gz'} and $extension =~ /\.gz$/i) { }
732 0 8 if (length $name . $extension > 255)
744 0 0 if (defined $strand_i and $self->gff || $self->bed || $self->ucsc)
746 0 0 if ($self->gff) { }
0 0 elsif ($self->bed or $self->ucsc) { }
749 0 0 if ($s =~ /\d/)
750 0 0 $s == -1 ? :
0 0 $s == 1 ? :
758 0 0 if ($s =~ /\d/)
759 0 0 $s >= 0 ? :
769 0 8 unless defined $fh
773 8 0 if ($args{'format'} eq "text")
777 0 8 if ($self->gff)
782 5 0 unless ($self->gff or $self->bed or $self->ucsc or $self->vcf or $extension =~ /sgr|kgg|cdt|peak/i)
788 0 5 if ($self->program)
791 5 0 if ($self->database)
794 5 0 if ($self->feature)
803 4 2 unless (/\n$/s)
808 5 1 if (/^#/) { }
828 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) { }
854 0 0 if $_ eq "name"
855 0 0 if $_ eq "index"
856 0 0 if $_ eq "AUTO"
870 5 3 if ($self->{'headers'} == 1)
876 0 8 if ($args{'format'} eq 'simple') { }
885 0 0 if ($_ eq '.') { }
922 120 41 ref($self) =~ /^Bio::ToolBox/ ? :
925 120 41 if (not $file and $obj)
928 0 161 unless ($file)
935 0 161 if ($file =~ /\.gz$/i) { }
0 161 elsif ($file =~ /\.bz2$/i) { }
937 0 0 unless $fh = "IO::File"->new("gzip -dc $file |")
942 0 0 unless $fh = "IO::File"->new("bzip2 -dc $file |")
947 0 161 unless $fh = "IO::File"->new($file, "r")
951 120 41 if ($obj)
963 0 10 unless ($filename)
971 0 10 if (length $name > 255)
977 2 8 unless (defined $gz)
980 0 2 if ($filename =~ /\.vcf(\.gz)?$/i) { }
0 2 elsif ($filename =~ /\.gz$/i) { }
992 0 10 if ($gz == 1 and not $gzip_app) { }
0 20 elsif ($gz == 2 and not $bgzip_app) { }
996 0 0 if ($gzip_app) { }
1004 0 0 unless ($gzip_app)
1012 0 0 if ($bgzip_app)
1017 0 0 unless ($bgzip_app)
1021 0 10 $gz == 2 ? :
0 10 $gz == 1 ? :
1024 8 2 unless (defined $append)
1032 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) { }
1033 0 8 unless $fh = "IO::File"->new($filename, "w")
1037 0 0 unless $fh = "IO::File"->new("| $gzipper >$filename")
1041 0 2 unless $fh = "IO::File"->new(">> $filename")
1045 0 0 unless $fh = "IO::File"->new("| $gzipper >>$filename")
1048 10 0 if defined $fh
1057 60 0 if (-e $filename) { }
1066 0 0 if (-e $filename . $ext)
1078 192 0 if exists $self->{'fh'}
1084 70 0 if exists $self->{'fh'} and $self->{'fh'}
1094 30 30 if (scalar @{$data->{'comments'};} >= 1)
1101 0 60 if (scalar @commentdata == scalar @linedata) { }
1122 0 0 if ($key eq "index")
1123 0 0 if ($index != $value)
1135 0 0 unless (exists $temphash{'index'})
1141 0 0 if (exists $data->{$index}) { }
1167 0 5 if (not $self->gff or $force)
1168 0 0 if (defined $version) { }
0 0 elsif ($self->extension =~ /gtf/i) { }
0 0 elsif ($self->extension =~ /gff3/i) { }
1182 5 0 unless ($self->format)
1184 0 0 $v > 2 ? :
5 0 $v == 3 ? :
1195 45 0 if ($force or not exists $self->{$i})
1201 45 0 if ($force or not defined $self->{'column_names'}[$i])
1208 5 0 if ($force or $self->{'number_columns'} == 0)
1213 5 0 unless $self->{'0'}{'name'} =~ /^#/
1216 5 0 unless (defined $self->{'feature'})
1241 0 27 if ($self->format =~ /bedgraph/i or $self->extension =~ /bg|bdg|graph/i) { }
1260 200 0 if ($force or not exists $self->{$i})
1266 200 0 if ($force or not defined $self->{'column_names'}[$i])
1273 27 0 unless (defined $self->{'feature'})
1278 27 0 unless $self->{'0'}{'name'} =~ /^#/
1293 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) { }
1318 200 0 if ($force or not exists $self->{$i})
1324 200 0 if ($force or not defined $self->{'column_names'}[$i])
1331 16 0 unless (defined $self->{'feature'})
1336 16 0 unless $self->{'0'}{'name'} =~ /^#/
1357 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) { }
1383 48 0 if ($force or not exists $self->{$i})
1389 48 0 if ($force or not defined $self->{'column_names'}[$i])
1396 3 0 unless (defined $self->{'feature'})
1401 3 0 unless $self->{'0'}{'name'} =~ /^#/
1419 0 0 if ($force or not exists $self->{$i})
1425 0 0 if ($force or not defined $self->{'column_names'}[$i])
1434 0 0 unless $self->{'0'}{'name'} =~ /^#/
1437 0 0 unless (defined $self->{'feature'})
1457 0 68 if (exists $self->{$i}) { }
1458 0 0 unless ($namelist[$i] eq $self->{$i}{'name'})
1476 13 0 if (scalar @namelist != $self->{'number_columns'})
1495 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') { }