lib/Bio/ViennaNGS/Bed.pm

filter: Statementstmt 62.5% 30 / 48 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 100% 1 / 1 totaltotal 55.2% 37 / 67 CC 6 SCAR 22.4
CC
6
Cov
52%
as_bed_line
20.0
_build_length
12.0
BEGIN
1.0
CRAP 9.4
« lib/Bio/ViennaNGS/FeatureChain.pm ↑ Summary lib/Bio/ViennaNGS/FeatureInterval.pm »
1 # -*-CPerl-*-
2 # Last changed Time-stamp: <2017-06-10 18:20:26 michl>
3  
4 package Bio::ViennaNGS::Bed;
5  
6 1 ▶use Bio::ViennaNGS;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use version; our $VERSION = version->declare("$Bio::ViennaNGS::VERSION");
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 extends 'Bio::ViennaNGS::Feature';
14  
15 1 has '+strand' => (
16 required => 1,
17 );
18  
19 1 has 'thickStart' => (
20 is => 'rw',
21 isa => 'Int',
22 predicate => 'has_thickStart',
23 );
24  
25 1 has 'thickEnd' => (
26 is => 'rw',
27 isa => 'Int',
28 predicate => 'has_thickEnd',
29 );
30  
31 1 has 'itemRgb' => (
32 is => 'rw',
33 isa => 'Str',
34 lazy => 1,
35 default => '0',
36 );
37  
38 1 has 'blockCount' => (
39 is => 'rw',
40 isa => 'Int',
41 predicate => 'has_blockCount',
42 );
43  
44 1 has 'blockSizes' => (
45 is => 'rw',
46 isa => 'Value',
47 );
48  
49 1 has 'blockStarts' => (
50 is => 'rw',
51 isa => 'Value',
52 );
53  
54 1 has 'length' => (
55 is => 'rw',
56 isa => 'Int',
57 builder => '_build_length',
58 lazy => 1,
59 predicate => 'has_length',
60 );
61  
62  
63 0 ▶sub _build_length {
Subroutine _build_length: not called CC=3 SCAR=24.8
64 0 my ($self) = @_;
65 0 my ($i,$len) = (0)x2;
66 0 my $this_function = (caller(0))[3];
67 0 my @blockSizes = split (/,/ ,$self->blockSizes);
68 0 my $bc = scalar @blockSizes;
69 0 ▶ croak "ERROR [$this_function] invalid blockSount in BED12 line"
Branch: 1 branch
BranchTrueFalseTotal
unless $bc == $self->blockCount 0 0 0
70 unless ($bc == $self->blockCount);
71  
72 0 ▶ for ($i=0;$i<$bc;$i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $bc) 0 0 0
73 0 $len += $blockSizes[$i];
74 }
75 0 $self->length($len);
76 }
77  
78 0 ▶sub as_bed_line {
Subroutine as_bed_line: not called CC=4 SCAR=30.0
Pod documented
79 0 my ($self,$n) = @_;
80 0 my $this_function = (caller(0))[3];
81 0 ▶ croak "ERROR [$this_function] no argument provided"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $n 0 0 0
82 unless (defined $n);
83 0 ▶ croak "ERROR [$this_function] argument of as_bed_line() must be 6 or 12"
Branch: 1 branch
BranchTrueFalseTotal
unless $n == 6 | $n == 12 0 0 0
84 unless ( ($n == 6) | ($n == 12) );
85 0 my $bed6= join ("\t",
86 $self->chromosome,
87 $self->start,
88 $self->end,
89 $self->name,
90 $self->score,
91 $self->strand,
92 );
93 0 my $bed12 = join ("\t", $bed6,
94 $self->thickStart,
95 $self->thickEnd,
96 $self->itemRgb,
97 $self->blockCount,
98 $self->blockSizes,
99 $self->blockStarts,
100 );
101 0 ▶ if ($n ==6){
Branch: 1 branch
BranchTrueFalseTotal
if ($n == 6) { } 0 0 0
102 0 return $bed6;
103 }
104 else{
105 0 return $bed12;
106 }
107 }
108  
109 # TODO:
110 # sub from_FeatureLine()
111 # sub to_FeatureLine()
112  
113 1 __PACKAGE__->meta->make_immutable;
114  
115 1 1;
116  
117 __END__
« lib/Bio/ViennaNGS/FeatureChain.pm ↑ Summary lib/Bio/ViennaNGS/FeatureInterval.pm »