File Coverage

blib/lib/Bio/Palantir/Parser/Location.pm
Criterion Covered Total %
statement 28 42 66.6
branch 2 6 33.3
condition n/a
subroutine 8 12 66.6
pod 8 8 100.0
total 46 68 67.6


line stmt bran cond sub pod time code
1             package Bio::Palantir::Parser::Location;
2             # ABSTRACT: BiosynML DTD-derived internal class
3             $Bio::Palantir::Parser::Location::VERSION = '0.201670';
4 1     1   641 use Moose;
  1         3  
  1         5  
5 1     1   6919 use namespace::autoclean;
  1         3  
  1         10  
6              
7             # AUTOGENERATED CODE! DO NOT MODIFY THIS FILE!
8              
9 1     1   97 use XML::Bare qw(forcearray);
  1         2  
  1         68  
10 1     1   9 use POSIX;
  1         2  
  1         9  
11              
12              
13              
14             # private attributes
15             has '_root' => (
16             is => 'ro',
17             isa => 'HashRef',
18             required => 1,
19             );
20              
21              
22              
23              
24             # public array(s) of composed objects
25              
26              
27             # public composed object(s)
28              
29              
30             # public deep methods
31              
32              
33             # public methods
34              
35              
36              
37             # public aliases
38             has 'strand' => (
39             is => 'ro',
40             isa => 'Str',
41             default => sub {
42             my $self = shift;
43             my $strand
44             = $self->_root->{begin}->{value} < $self->_root->{end}->{value}
45             ? '+'
46             : '-'
47             ;
48             return $strand;
49             }
50             );
51              
52              
53             sub dna_begin {
54 940     940 1 6787 my $self = shift;
55            
56             my $begin = $self->strand eq '+' ?
57             $self->_root->{'begin'}->{'value'} :
58 940 50       27704 $self->_root->{'end'}->{'value'}
59             ;
60            
61 940         3325 return $begin;
62             }
63              
64              
65             sub dna_end {
66 375     375 1 2406 my $self = shift;
67            
68             my $end = $self->strand eq '+' ?
69             $self->_root->{'end'}->{'value'} :
70 375 50       11430 $self->_root->{'begin'}->{'value'}
71             ;
72            
73 375         1380 return $end;
74             }
75              
76              
77             sub dna_coordinates {
78              
79 100     100 1 260 my $self = shift;
80 100         168 my $begin = $self->dna_begin;
81 100         234 my $end = $self->dna_end;
82 100         271 return [$begin, $end];
83              
84             }
85              
86              
87             sub dna_size {
88            
89 85     85 1 708 my $self = shift;
90 85         160 my $coordinates = $self->dna_coordinates;
91 85         128 my $size = @{ $coordinates }[1] - @{ $coordinates }[0] + 1;
  85         140  
  85         139  
92 85         3013 return $size;
93             }
94              
95              
96             sub prot_begin {
97 0     0 1   my $self = shift;
98 0 0         my $prot_begin = $self->dna_begin == 1 ? 1 : $self->dna_begin / 3;
99 0           return ( ceil($prot_begin) );
100             }
101              
102              
103             sub prot_end {
104 0     0 1   return ( floor(shift->dna_end / 3) )
105             }
106              
107              
108             sub prot_coordinates {
109              
110 0     0 1   my $self = shift;
111 0           my $begin = $self->prot_begin;
112 0           my $end = $self->prot_end;
113 0           return [$begin, $end];
114              
115             }
116              
117              
118             sub prot_size {
119            
120 0     0 1   my $self = shift;
121 0           my $coordinates = $self->prot_coordinates;
122 0           my $size = @{ $coordinates }[1] - @{ $coordinates }[0] + 1;
  0            
  0            
123 0           return $size;
124             }
125              
126              
127              
128             __PACKAGE__->meta->make_immutable;
129             1;
130              
131             __END__
132              
133             =pod
134              
135             =head1 NAME
136              
137             Bio::Palantir::Parser::Location - BiosynML DTD-derived internal class
138              
139             =head1 VERSION
140              
141             version 0.201670
142              
143             =head1 SYNOPSIS
144              
145             # TODO
146              
147             =head1 DESCRIPTION
148              
149             # TODO
150              
151             =head1 METHODS
152              
153             =head2 dna_begin
154              
155             Returns the genomic coordinates of the begin of the object used C<<dna_begin>>.
156              
157             # $location is a Bio::FastParsers::Biosynml
158             my $dna_begin = $location->dna_begin;
159              
160             This method does not accept any arguments.
161              
162             =head2 dna_end
163              
164             Returns the genomic coordinates of the end of the object used C<dna_end>>.
165              
166             # $location is a Bio::FastParsers::Biosynml
167             my $dna_end = $location->dna_end;
168              
169             This method does not accept any arguments.
170              
171             =head2 dna_coordinates
172              
173             Returns an arrayref of the dna_coordinates of the object used
174             C<<dna_coordinates>>.
175              
176             # $location is a Bio::FastParsers::Biosynml
177             my $dna_coordinates = $location->dna_coordinates;
178              
179             This method does not accept any arguments.
180              
181             =head2 dna_size
182              
183             Returns the difference between the begin and end coordinates of the object
184             used C<<dna_size>>.
185              
186             # $location is a Bio::FastParsers::Biosynml
187             my $dna_size = $location->dna_size;
188              
189             This method does not accept any arguments.
190              
191             =head2 prot_begin
192              
193             Returns the protein coordinates of the prot_begin of the object used
194             C<<prot_begin>>.
195              
196             # $location is a Bio::FastParsers::Biosynml
197             my $prot_begin = $location->prot_begin;
198              
199             This method does not accept any arguments.
200              
201             =head2 prot_end
202              
203             Returns the protein coordinates of the end of the object used C<<prot_end>>.
204              
205             # $location is a Bio::FastParsers::Biosynml
206             my $prot_end = $location->prot_end;
207              
208             This method does not accept any arguments.
209              
210             =head2 prot_coordinates
211              
212             Returns an arrayref of the prot_coordinates of the object used
213             C<<prot_coordinates>>.
214              
215             # $location is a Bio::FastParsers::Biosynml
216             my $prot_coordinates = $location->prot_coordinates;
217              
218             This method does not accept any arguments.
219              
220             =head2 prot_size
221              
222             Returns the difference between the begin and end coordinates of the object
223             used C<<prot_size>>.
224              
225             # $location is a Bio::FastParsers::Biosynml
226             my $prot_size = $location->prot_size;
227              
228             This method does not accept any arguments.
229              
230             =head1 AUTHOR
231              
232             Loic MEUNIER <lmeunier@uliege.be>
233              
234             =head1 COPYRIGHT AND LICENSE
235              
236             This software is copyright (c) 2019 by University of Liege / Unit of Eukaryotic Phylogenomics / Loic MEUNIER and Denis BAURAIN.
237              
238             This is free software; you can redistribute it and/or modify it under
239             the same terms as the Perl 5 programming language system itself.
240              
241             =cut