| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Bio::Palantir::Roles::Modulable::Component; | 
| 2 |  |  |  |  |  |  | $Bio::Palantir::Roles::Modulable::Component::VERSION = '0.201670'; | 
| 3 | 1 |  |  | 1 |  | 779 | use Moose; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 8 |  | 
| 4 | 1 |  |  | 1 |  | 7323 | use namespace::autoclean; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 13 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 128 | use aliased 'Bio::Palantir::Parser::Domain'; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 9 |  | 
| 7 | 1 |  |  | 1 |  | 225 | use aliased 'Bio::Palantir::Refiner::DomainPlus'; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 3 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | # private attributes | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | has 'uui' => ( | 
| 13 |  |  |  |  |  |  | is       => 'ro', | 
| 14 |  |  |  |  |  |  | isa      => 'Str', | 
| 15 |  |  |  |  |  |  | init_arg => undef, | 
| 16 |  |  |  |  |  |  | default  => sub { | 
| 17 |  |  |  |  |  |  | my $self = shift; | 
| 18 |  |  |  |  |  |  | my $ug = Data::UUID->new; | 
| 19 |  |  |  |  |  |  | my $uui = $ug->create_str(); | 
| 20 |  |  |  |  |  |  | return $uui; | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  | ); | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | has 'rank' => ( | 
| 25 |  |  |  |  |  |  | is      => 'ro', | 
| 26 |  |  |  |  |  |  | isa     => 'Num', | 
| 27 |  |  |  |  |  |  | default => -1, | 
| 28 |  |  |  |  |  |  | writer  => '_set_rank', | 
| 29 |  |  |  |  |  |  | ); | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | has $_ => ( | 
| 32 |  |  |  |  |  |  | is       => 'ro', | 
| 33 |  |  |  |  |  |  | isa      => 'Str', | 
| 34 |  |  |  |  |  |  | ) for qw(protein_sequence cumulative_protein_sequence); | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | has $_ => ( | 
| 37 |  |  |  |  |  |  | is  => 'ro', | 
| 38 |  |  |  |  |  |  | isa => 'ArrayRef', | 
| 39 |  |  |  |  |  |  | ) for qw(gene_uuis genomic_prot_coordinates); | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | has $_ => ( | 
| 42 |  |  |  |  |  |  | is       => 'ro', | 
| 43 |  |  |  |  |  |  | isa      => 'Num', | 
| 44 |  |  |  |  |  |  | ) for qw(genomic_prot_begin genomic_prot_end size); | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | # public array(s) of composed objects | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | has 'domains' => ( | 
| 51 |  |  |  |  |  |  | traits   => ['Array'], | 
| 52 |  |  |  |  |  |  | is       => 'ro', | 
| 53 |  |  |  |  |  |  | isa      => 'ArrayRef',    # possible to make a link with the role domainable? | 
| 54 |  |  |  |  |  |  | handles  => { | 
| 55 |  |  |  |  |  |  | count_domains => 'count', | 
| 56 |  |  |  |  |  |  | all_domains => 'elements', | 
| 57 |  |  |  |  |  |  | get_domain  => 'get', | 
| 58 |  |  |  |  |  |  | next_domain  => 'shift', | 
| 59 |  |  |  |  |  |  | }, | 
| 60 |  |  |  |  |  |  | ); | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | ## no critic (ProhibitUnusedPrivateSubroutines) | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | ## use critic | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | # public composed object(s) | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | # public deep methods | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | # public methods | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | # public aliases | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | sub sort_domains { | 
| 81 |  |  |  |  |  |  |  | 
| 82 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | return [ sort { | 
| 85 | 0 |  |  |  |  |  | $a->protein_locations->begin <=> $b->protein_locations->begin | 
|  | 0 |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | } $self->all_domains | 
| 87 |  |  |  |  |  |  | ]; | 
| 88 |  |  |  |  |  |  | } | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | sub genomic_dna_begin { | 
| 92 | 0 |  |  | 0 | 1 |  | return (shift->genomic_prot_begin * 3) | 
| 93 |  |  |  |  |  |  | } | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | sub genomic_dna_end { | 
| 97 | 0 |  |  | 0 | 1 |  | return (shift->genomic_prot_end * 3) | 
| 98 |  |  |  |  |  |  | } | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | sub get_domain_functions { | 
| 102 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 103 |  |  |  |  |  |  |  | 
| 104 | 0 |  |  |  |  |  | my @domain_functions = map { $_->function } $self->all_domains; | 
|  | 0 |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  |  | 
| 106 | 0 |  |  |  |  |  | return \@domain_functions; | 
| 107 |  |  |  |  |  |  | } | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 110 |  |  |  |  |  |  | 1; | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | __END__ | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =pod | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | =head1 NAME | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | Bio::Palantir::Roles::Modulable::Component | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | =head1 VERSION | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | version 0.201670 | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | # TODO | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | # TODO | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =head1 ATTRIBUTES | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | =head2 domains | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | ArrayRef of L<Bio::Palantir::Parser::Domain> | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | =head1 METHODS | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | =head2 count_domains | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | Returns the number of Domains of the Component. | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | # $component is a Bio::Palantir::Parser::Component | 
| 145 |  |  |  |  |  |  | my $count = $component->count_domains; | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | This method does not accept any arguments. | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | =head2 all_domains | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | Returns all the Domains of the Component (not an array reference). | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | # $component is a Bio::Palantir::Parser::Component | 
| 154 |  |  |  |  |  |  | my @domains = $component->all_domains; | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | This method does not accept any arguments. | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | =head2 get_domain | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | Returns one Domain of the Component by its index. You can also use | 
| 161 |  |  |  |  |  |  | negative index numbers, just as with Perl's core array handling. If the | 
| 162 |  |  |  |  |  |  | specified Domain does not exist, this method will return C<undef>. | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | # $component is a Bio::Palantir::Parser::Component | 
| 165 |  |  |  |  |  |  | my $domain = $component->get_domain($index); | 
| 166 |  |  |  |  |  |  | croak "Domain $index not found!" unless defined $domain; | 
| 167 |  |  |  |  |  |  |  | 
| 168 |  |  |  |  |  |  | This method accepts just one argument (and not an array slice). | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | =head2 next_domain | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | Shifts the first Domain of the array off and returns it, shortening the | 
| 173 |  |  |  |  |  |  | array by 1 and moving everything down. If there are no more Domains in | 
| 174 |  |  |  |  |  |  | the array, returns C<undef>. | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | # $component is a Bio::Palantir::Parser::Component | 
| 177 |  |  |  |  |  |  | while (my $domain = $component->next_domain) { | 
| 178 |  |  |  |  |  |  | # process $domain | 
| 179 |  |  |  |  |  |  | # ... | 
| 180 |  |  |  |  |  |  | } | 
| 181 |  |  |  |  |  |  |  | 
| 182 |  |  |  |  |  |  | This method does not accept any arguments. | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | =head2 sort_domains | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | Returns a array of sorted domains by increasing start coordinate (by default, the list of domains should be built in the right order, so it is a security here). | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | # $component is a Bio::Palantir::Roles::Modulable::Component | 
| 189 |  |  |  |  |  |  | my @sorted_domains = $component->sort_domains; | 
| 190 |  |  |  |  |  |  |  | 
| 191 |  |  |  |  |  |  | This method does not accept any arguments. | 
| 192 |  |  |  |  |  |  |  | 
| 193 |  |  |  |  |  |  | =head2 genomic_dna_begin | 
| 194 |  |  |  |  |  |  |  | 
| 195 |  |  |  |  |  |  | Returns the begin of the genomic DNA coordinate of the module. | 
| 196 |  |  |  |  |  |  |  | 
| 197 |  |  |  |  |  |  | # $component is a Bio::Palantir::Roles::Modulable::Component | 
| 198 |  |  |  |  |  |  | my $genomic_dna_begin = $component->genomic_dna_begin; | 
| 199 |  |  |  |  |  |  |  | 
| 200 |  |  |  |  |  |  | =head2 genomic_dna_end | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | Returns the end of the genomic DNA coordinate of the module. | 
| 203 |  |  |  |  |  |  |  | 
| 204 |  |  |  |  |  |  | # $component is a Bio::Palantir::Roles::Modulable::Component | 
| 205 |  |  |  |  |  |  | my $genomic_dna_end = $component->genomic_dna_end; | 
| 206 |  |  |  |  |  |  |  | 
| 207 |  |  |  |  |  |  | =head2 get_domain_functions | 
| 208 |  |  |  |  |  |  |  | 
| 209 |  |  |  |  |  |  | Returns the list of functions from the domains constituting the module. | 
| 210 |  |  |  |  |  |  |  | 
| 211 |  |  |  |  |  |  | =head1 AUTHOR | 
| 212 |  |  |  |  |  |  |  | 
| 213 |  |  |  |  |  |  | Loic MEUNIER <lmeunier@uliege.be> | 
| 214 |  |  |  |  |  |  |  | 
| 215 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 216 |  |  |  |  |  |  |  | 
| 217 |  |  |  |  |  |  | This software is copyright (c) 2019 by University of Liege / Unit of Eukaryotic Phylogenomics / Loic MEUNIER and Denis BAURAIN. | 
| 218 |  |  |  |  |  |  |  | 
| 219 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 220 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 221 |  |  |  |  |  |  |  | 
| 222 |  |  |  |  |  |  | =cut |