File Coverage

blib/lib/Bio/Palantir/Parser/Cluster.pm
Criterion Covered Total %
statement 21 27 77.7
branch n/a
condition 1 14 7.1
subroutine 8 14 57.1
pod 7 7 100.0
total 37 62 59.6


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