File Coverage

blib/lib/Bio/Palantir/Parser/Domain.pm
Criterion Covered Total %
statement 22 31 70.9
branch n/a
condition 2 14 14.2
subroutine 9 17 52.9
pod 9 9 100.0
total 42 71 59.1


line stmt bran cond sub pod time code
1             package Bio::Palantir::Parser::Domain;
2             # ABSTRACT: BiosynML DTD-derived internal class
3             $Bio::Palantir::Parser::Domain::VERSION = '0.201670';
4 1     1   602 use Moose;
  1         2  
  1         5  
5 1     1   6639 use namespace::autoclean;
  1         3  
  1         6  
6              
7             # AUTOGENERATED CODE! DO NOT MODIFY THIS FILE!
8              
9 1     1   94 use XML::Bare qw(forcearray);
  1         2  
  1         46  
10 1     1   6 use Data::UUID;
  1         2  
  1         68  
11              
12 1     1   8 use aliased 'Bio::Palantir::Parser::Motif';
  1         2  
  1         7  
13 1     1   130 use aliased 'Bio::Palantir::Parser::Location';
  1         2  
  1         7  
14              
15              
16             # private attributes
17             has '_root' => (
18             is => 'ro',
19             isa => 'HashRef',
20             required => 1,
21             );
22              
23              
24             has 'uui' => (
25             is => 'ro',
26             isa => 'Str',
27             init_arg => undef,
28             default => sub {
29             my $self = shift;
30             my $ug = Data::UUID->new;
31             my $uui = $ug->create_str();
32             return $uui;
33             }
34             );
35              
36             has 'rank' => (
37             is => 'ro',
38             isa => 'Num',
39             default => -1,
40             writer => '_set_rank',
41             );
42              
43             has 'monomer' => (
44             is => 'ro',
45             isa => 'Maybe[Str]',
46             init_arg => undef,
47             writer => '_set_monomer',
48             );
49              
50              
51             # public array(s) of composed objects
52              
53              
54             has 'motifs' => (
55             traits => ['Array'],
56             is => 'ro',
57             isa => 'ArrayRef[Bio::Palantir::Parser::Motif]',
58             handles => {
59             count_motifs => 'count',
60             all_motifs => 'elements',
61             get_motif => 'get',
62             next_motif => 'shift',
63             },
64             );
65              
66              
67             ## no critic (ProhibitUnusedPrivateSubroutines)
68              
69              
70             ## use critic
71              
72              
73              
74             # public composed object(s)
75              
76              
77             has 'gene_locations' => (
78             is => 'ro',
79             isa => 'Bio::Palantir::Parser::Location',
80             init_arg => undef,
81             lazy => 1,
82             builder => '_build_gene_locations',
83             handles => {
84             dna_begin => 'dna_begin',
85             dna_end => 'dna_end',
86             dna_size => 'dna_size',
87             dna_coordinates => 'dna_coordinates',
88             },
89             );
90              
91             ## no critic (ProhibitUnusedPrivateSubroutines)
92              
93             sub _build_gene_locations {
94 0     0   0 my $self = shift;
95             return Location->new(
96             _root => $self->_root->{location}->{gene}->{position}
97 0         0 );
98             }
99              
100             # use critic
101              
102              
103             has 'protein_locations' => (
104             is => 'ro',
105             isa => 'Bio::Palantir::Parser::Location',
106             init_arg => undef,
107             lazy => 1,
108             builder => '_build_protein_locations',
109             handles => {
110             begin => 'dna_begin',
111             end => 'dna_end',
112             size => 'dna_size',
113             coordinates => 'dna_coordinates',
114             },
115             );
116              
117             ## no critic (ProhibitUnusedPrivateSubroutines)
118              
119             sub _build_protein_locations {
120 13     13   23 my $self = shift;
121             return Location->new(
122             _root => $self->_root->{location}->{protein}->{position}
123 13         368 );
124             }
125              
126             # use critic
127              
128              
129             # public deep methods
130              
131              
132             sub protein_sequence {
133 5     5 1 154 return shift->_root->{'location'}->{'protein'}->{'sequence'}->{'value'}
134             }
135              
136              
137             sub protein_name {
138 0     0 1 0 return shift->_root->{'location'}->{'protein'}->{'name'}->{'value'}
139             }
140              
141              
142             # public methods
143              
144              
145             sub nodeid {
146 0   0 0 1 0 return shift->_root->{'nodeid'}->{'value'} // 'NA'
147             }
148              
149              
150             sub function {
151 15   100 15 1 525 return shift->_root->{'function'}->{'value'} // 'NA'
152             }
153              
154              
155             sub subtype {
156 0   0 0 1   return shift->_root->{'subtype'}->{'value'} // 'NA'
157             }
158              
159              
160             sub dstatus {
161 0   0 0 1   return shift->_root->{'dstatus'}->{'value'} // 'NA'
162             }
163              
164              
165             sub label {
166 0   0 0 1   return shift->_root->{'label'}->{'value'} // 'NA'
167             }
168              
169              
170             sub chemistry {
171 0   0 0 1   return shift->_root->{'chemistry'}->{'value'} // 'NA'
172             }
173              
174              
175             sub substrate {
176 0   0 0 1   return shift->_root->{'substrate'}->{'value'} // 'NA'
177             }
178              
179             with 'Bio::Palantir::Roles::Domainable';
180              
181             # public aliases
182              
183              
184             __PACKAGE__->meta->make_immutable;
185             1;
186              
187             __END__
188              
189             =pod
190              
191             =head1 NAME
192              
193             Bio::Palantir::Parser::Domain - BiosynML DTD-derived internal class
194              
195             =head1 VERSION
196              
197             version 0.201670
198              
199             =head1 SYNOPSIS
200              
201             # TODO
202              
203             =head1 DESCRIPTION
204              
205             # TODO
206              
207             =head1 ATTRIBUTES
208              
209             =head2 motifs
210              
211             ArrayRef of L<Bio::Palantir::Parser::Motif>
212              
213             =head2 gene_locations
214              
215             L<Bio::Palantir::Parser::Location> composed object
216              
217             =head2 protein_locations
218              
219             L<Bio::Palantir::Parser::Location> composed object
220              
221             =head1 METHODS
222              
223             =head2 count_motifs
224              
225             Returns the number of Motifs of the Domain.
226              
227             # $domain is a Bio::Palantir::Parser::Domain
228             my $count = $domain->count_motifs;
229              
230             This method does not accept any arguments.
231              
232             =head2 all_motifs
233              
234             Returns all the Motifs of the Domain (not an array reference).
235              
236             # $domain is a Bio::Palantir::Parser::Domain
237             my @motifs = $domain->all_motifs;
238              
239             This method does not accept any arguments.
240              
241             =head2 get_motif
242              
243             Returns one Motif of the Domain by its index. You can also use
244             negative index numbers, just as with Perl's core array handling. If the
245             specified Motif does not exist, this method will return C<undef>.
246              
247             # $domain is a Bio::Palantir::Parser::Domain
248             my $motif = $domain->get_motif($index);
249             croak "Motif $index not found!" unless defined $motif;
250              
251             This method accepts just one argument (and not an array slice).
252              
253             =head2 next_motif
254              
255             Shifts the first Motif of the array off and returns it, shortening the
256             array by 1 and moving everything down. If there are no more Motifs in
257             the array, returns C<undef>.
258              
259             # $domain is a Bio::Palantir::Parser::Domain
260             while (my $motif = $domain->next_motif) {
261             # process $motif
262             # ...
263             }
264              
265             This method does not accept any arguments.
266              
267             =head2 protein_sequence
268              
269             Returns the value of the element C<<location}->{protein}->{sequence>>.
270              
271             # $domain is a Bio::Palantir::Parser::Domain
272             my $protein_sequence = $domain->protein_sequence;
273              
274             This method does not accept any arguments.
275              
276             =head2 protein_name
277              
278             Returns the value of the element C<<location}->{protein}->{name>>.
279              
280             # $domain is a Bio::Palantir::Parser::Domain
281             my $protein_name = $domain->protein_name;
282              
283             This method does not accept any arguments.
284              
285             =head2 nodeid
286              
287             Returns the value of the element C<<nodeid>>.
288              
289             # $domain is a Bio::Palantir::Parser::Domain
290             my $nodeid = $domain->nodeid;
291              
292             This method does not accept any arguments.
293              
294             =head2 function
295              
296             Returns the value of the element C<<function>>.
297              
298             # $domain is a Bio::Palantir::Parser::Domain
299             my $function = $domain->function;
300              
301             This method does not accept any arguments.
302              
303             =head2 subtype
304              
305             Returns the value of the element C<<subtype>>.
306              
307             # $domain is a Bio::Palantir::Parser::Domain
308             my $subtype = $domain->subtype;
309              
310             This method does not accept any arguments.
311              
312             =head2 dstatus
313              
314             Returns the value of the element C<<dstatus>>.
315              
316             # $domain is a Bio::Palantir::Parser::Domain
317             my $dstatus = $domain->dstatus;
318              
319             This method does not accept any arguments.
320              
321             =head2 label
322              
323             Returns the value of the element C<<label>>.
324              
325             # $domain is a Bio::Palantir::Parser::Domain
326             my $label = $domain->label;
327              
328             This method does not accept any arguments.
329              
330             =head2 chemistry
331              
332             Returns the value of the element C<<chemistry>>.
333              
334             # $domain is a Bio::Palantir::Parser::Domain
335             my $chemistry = $domain->chemistry;
336              
337             This method does not accept any arguments.
338              
339             =head2 substrate
340              
341             Returns the value of the element C<<substrate>>.
342              
343             # $domain is a Bio::Palantir::Parser::Domain
344             my $substrate = $domain->substrate;
345              
346             This method does not accept any arguments.
347              
348             =head1 AUTHOR
349              
350             Loic MEUNIER <lmeunier@uliege.be>
351              
352             =head1 COPYRIGHT AND LICENSE
353              
354             This software is copyright (c) 2019 by University of Liege / Unit of Eukaryotic Phylogenomics / Loic MEUNIER and Denis BAURAIN.
355              
356             This is free software; you can redistribute it and/or modify it under
357             the same terms as the Perl 5 programming language system itself.
358              
359             =cut