| 1 | # -*-CPerl-*- | ||||||||||
| 2 | # Last changed Time-stamp: <2018-01-10 00:28:46 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 | sub BUILD { # call a parser method, depending on $self->instanceOf | ||||||||||
| 41 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
BUILD: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 42 | 0 | my $this_function = (caller(0))[3]; | |||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | confess "ERROR [$this_function] \$self->end must be >= than \$self->start" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | unless ($self->end >= $self->start); | ||||||||||
| 46 | 0 | my $len = $self->end-$self->start; | |||||||||
| 47 | 0 | $self->_length($len); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | sub dump { | ||||||||||
| 51 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
dump: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 52 | 0 | print join("\t", | |||||||||
| 53 | $self->chromosome, | ||||||||||
| 54 | $self->start, | ||||||||||
| 55 | $self->end), | ||||||||||
| 56 | "\n"; | ||||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 60 | |||||||||||
| 61 | 1 | 1; | |||||||||
| 62 | |||||||||||
| 63 | __END__ | ||||||||||
| 64 | |||||||||||
| 65 | =head1 NAME | ||||||||||
| 66 | |||||||||||
| 67 | Bio::ViennaNGS::FeatureInterval - A Moose class for unstranded, elementary | ||||||||||
| 68 | genomic intervals. | ||||||||||
| 69 | |||||||||||
| 70 | =head1 SYNOPSIS | ||||||||||
| 71 | |||||||||||
| 72 | use Bio::ViennaNGS::FeatureInterval; | ||||||||||
| 73 | |||||||||||
| 74 | my $obj = Bio::ViennaNGS::FeatureInterval->new(chromosome => "chr1", | ||||||||||
| 75 | start => "1200", | ||||||||||
| 76 | end => "4300", | ||||||||||
| 77 | ); | ||||||||||
| 78 | my $len = $obj->_length(); | ||||||||||
| 79 | $obj->dump(); | ||||||||||
| 80 | |||||||||||
| 81 | =head1 DESCRIPTION | ||||||||||
| 82 | |||||||||||
| 83 | This module provides an object-oriented interface for storing | ||||||||||
| 84 | unstranded, elementary genomic intervals characterized via chromosome, | ||||||||||
| 85 | start and end position. As such, it can be regarded a simple wrapper | ||||||||||
| 86 | for BED3 elements. | ||||||||||
| 87 | |||||||||||
| 88 | This is the base class for L<Bio::ViennaNGS::MinimalFeature>. | ||||||||||
| 89 | |||||||||||
| 90 | =head1 METHODS | ||||||||||
| 91 | |||||||||||
| 92 | =over | ||||||||||
| 93 | |||||||||||
| 94 | =item dump() | ||||||||||
| 95 | |||||||||||
| 96 | Title : dump | ||||||||||
| 97 | |||||||||||
| 98 | Usage : C<$obj-E<gt>dump;> | ||||||||||
| 99 | |||||||||||
| 100 | Function: Print a tab-separated representation of C<$obj> (a BED3 | ||||||||||
| 101 | line). | ||||||||||
| 102 | |||||||||||
| 103 | =back | ||||||||||
| 104 | |||||||||||
| 105 | =head1 SEE ALSO | ||||||||||
| 106 | |||||||||||
| 107 | =over | ||||||||||
| 108 | |||||||||||
| 109 | =item L<Bio::ViennaNGS> | ||||||||||
| 110 | |||||||||||
| 111 | =item L<Bio::ViennaNGS::MinimalFeature> | ||||||||||
| 112 | |||||||||||
| 113 | =back | ||||||||||
| 114 | |||||||||||
| 115 | =head1 AUTHORS | ||||||||||
| 116 | |||||||||||
| 117 | Michael T. Wolfinger E<lt>michael@wolfinger.euE<gt> | ||||||||||
| 118 | |||||||||||
| 119 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 120 | |||||||||||
| 121 | Copyright (C) 2014-2018 Michael T. Wolfinger E<lt>michael@wolfinger.euE<gt> | ||||||||||
| 122 | |||||||||||
| 123 | This library is free software; you can redistribute it and/or modify | ||||||||||
| 124 | it under the same terms as Perl itself, either Perl version 5.10.0 or, | ||||||||||
| 125 | at your option, any later version of Perl 5 you may have available. | ||||||||||
| 126 | |||||||||||
| 127 | This program is distributed in the hope that it will be useful, but | ||||||||||
| 128 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||
| 129 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||
| 130 | General Public License for more details. | ||||||||||
| 131 | |||||||||||
| 132 | =cut | ||||||||||