| 1 | # -*-CPerl-*- | ||||||||||
| 2 | # Last changed Time-stamp: <2018-11-25 21:40:36 mtw> | ||||||||||
| 3 | |||||||||||
| 4 | package Bio::ViennaNGS::FeatureInterval; | ||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Bio::ViennaNGS; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use version; our $VERSION = version->declare("$Bio::ViennaNGS::VERSION"); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | has 'chromosome' => ( | |||||||||
| 13 | is => 'rw', | ||||||||||
| 14 | isa => 'Str', | ||||||||||
| 15 | required => 1, | ||||||||||
| 16 | predicate => 'has_chromosome', | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 1 | has 'start' => ( | |||||||||
| 20 | is => 'rw', | ||||||||||
| 21 | isa => 'Int', | ||||||||||
| 22 | required => 1, | ||||||||||
| 23 | predicate => 'has_start', | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | 1 | has 'end' => ( | |||||||||
| 27 | is => 'rw', | ||||||||||
| 28 | isa => 'Int', | ||||||||||
| 29 | required => 1, | ||||||||||
| 30 | predicate => 'has_end', | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | 1 | has '_length' => ( # length of interval | |||||||||
| 34 | is => 'rw', | ||||||||||
| 35 | isa => 'Int', | ||||||||||
| 36 | predicate => 'length', | ||||||||||
| 37 | init_arg => undef, # make this unsettable via constructor | ||||||||||
| 38 | ); | ||||||||||
| 39 | |||||||||||
| 40 | 1 | with 'Bio::ViennaNGS::FeatureBase'; | |||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | sub BUILD { # call a parser method, depending on $self->instanceOf | ||||||||
|
Subroutine
BUILD: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 43 | 0 | my $self = shift; | |||||||||
| 44 | 0 | my $this_function = (caller(0))[3]; | |||||||||
| 45 | 0 | my $len = undef; | |||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | if ($self->base == 0){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | 0 | ▶ | confess "ERROR [$this_function] \$self->end must be > than \$self->start for 0-based start coordinates [==> start ".eval($self->start)." end ".eval($self->end)." <==]" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | unless ($self->end > $self->start); | ||||||||||
| 50 | 0 | $len = eval($self->end)-eval($self->start)-1; | |||||||||
| 51 | 0 | $self->_length($len); | |||||||||
| 52 | } | ||||||||||
| 53 | else { | ||||||||||
| 54 | 0 | ▶ | confess "ERROR [$this_function] \$self->end must be >= than \$self->start for 0-based start coordinates [==> start ".eval($self->start)." end ".eval($self->end)." <==]" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | unless ($self->end >= $self->start); | ||||||||||
| 56 | 0 | $len = $self->end-$self->start; | |||||||||
| 57 | 0 | $self->_length($len); | |||||||||
| 58 | } | ||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub dump { | ||||||||
|
Subroutine
dump: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 62 | 0 | my $self = shift; | |||||||||
| 63 | 0 | print join("\t", | |||||||||
| 64 | $self->chromosome, | ||||||||||
| 65 | $self->start, | ||||||||||
| 66 | $self->end), | ||||||||||
| 67 | "\n"; | ||||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 71 | |||||||||||
| 72 | 1 | 1; | |||||||||
| 73 | |||||||||||
| 74 | __END__ | ||||||||||