line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Palantir::Refiner::ClusterPlus; |
2
|
|
|
|
|
|
|
# ABSTRACT: Refiner internal class for handling ClusterPlus objects |
3
|
|
|
|
|
|
|
$Bio::Palantir::Refiner::ClusterPlus::VERSION = '0.200700'; |
4
|
1
|
|
|
1
|
|
476
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
5380
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
61
|
use Data::UUID; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
65
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use aliased 'Bio::Palantir::Refiner::GenePlus'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# private attributes |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '_cluster' => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'Bio::Palantir::Parser::Cluster', |
17
|
|
|
|
|
|
|
handles => [qw( |
18
|
|
|
|
|
|
|
rank name type sequence |
19
|
|
|
|
|
|
|
genomic_prot_begin genomic_prot_end genomic_prot_size |
20
|
|
|
|
|
|
|
genomic_prot_coordinates genomic_dna_begin genomic_dna_end |
21
|
|
|
|
|
|
|
genomic_dna_size genomic_dna_coordinates |
22
|
|
|
|
|
|
|
)], |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has 'gap_filling' => ( |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
isa => 'Bool', |
28
|
|
|
|
|
|
|
default => 1, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has 'undef_cleaning' => ( |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
isa => 'Bool', |
34
|
|
|
|
|
|
|
default => 1, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has 'from_seq' => ( |
38
|
|
|
|
|
|
|
is => 'ro', |
39
|
|
|
|
|
|
|
isa => 'Bool', |
40
|
|
|
|
|
|
|
default => 0, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has 'module_delineation' => ( |
44
|
|
|
|
|
|
|
is => 'ro', |
45
|
|
|
|
|
|
|
isa => 'Str', |
46
|
|
|
|
|
|
|
default => 'substrate-selection', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
has 'uui' => ( |
50
|
|
|
|
|
|
|
is => 'ro', |
51
|
|
|
|
|
|
|
isa => 'Str', |
52
|
|
|
|
|
|
|
init_arg => undef, |
53
|
|
|
|
|
|
|
default => sub { |
54
|
|
|
|
|
|
|
my $self = shift; |
55
|
|
|
|
|
|
|
my $ug = Data::UUID->new; |
56
|
|
|
|
|
|
|
my $uui = $ug->create_str; |
57
|
|
|
|
|
|
|
return $uui; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# public array(s) of composed objects |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
has 'genes' => ( |
66
|
|
|
|
|
|
|
traits => ['Array'], |
67
|
|
|
|
|
|
|
is => 'ro', |
68
|
|
|
|
|
|
|
isa => 'ArrayRef[Bio::Palantir::Refiner::GenePlus]', |
69
|
|
|
|
|
|
|
writer => '_set_genes', |
70
|
|
|
|
|
|
|
init_arg => undef, |
71
|
|
|
|
|
|
|
handles => { |
72
|
|
|
|
|
|
|
count_genes => 'count', |
73
|
|
|
|
|
|
|
all_genes => 'elements', |
74
|
|
|
|
|
|
|
get_gene => 'get', |
75
|
|
|
|
|
|
|
next_gene => 'shift', |
76
|
|
|
|
|
|
|
}, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
with 'Bio::Palantir::Roles::Modulable'; |
80
|
|
|
|
|
|
|
with 'Bio::Palantir::Roles::Clusterable'; ## no critic (ProhibitMultipleWiths) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub BUILD { |
84
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# determine how delineate modules |
87
|
0
|
|
0
|
|
|
|
$self->_set_cutting_mode( |
88
|
|
|
|
|
|
|
$self->module_delineation // $self->_cluster->module_delineation |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
my @genes_plus; |
92
|
|
|
|
|
|
|
push @genes_plus, GenePlus->new( |
93
|
|
|
|
|
|
|
_gene => $_, |
94
|
|
|
|
|
|
|
gap_filling => $self->gap_filling, |
95
|
|
|
|
|
|
|
undef_cleaning => $self->undef_cleaning, |
96
|
|
|
|
|
|
|
from_seq => $self->from_seq, |
97
|
0
|
|
|
|
|
|
) for $self->_cluster->all_genes; |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
$self->_set_genes(\@genes_plus); |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
$self->_update_domain_ranks; |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# public attributes |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub _update_domain_ranks { |
109
|
0
|
|
|
0
|
|
|
my $self = shift; |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
my $rank = 1; |
112
|
0
|
|
|
|
|
|
my $exp_rank = 1; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
for my $gene ($self->all_genes) { |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
next |
117
|
0
|
0
|
0
|
|
|
|
unless $gene->all_domains || $gene->all_exp_domains; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my @sorted_domains |
120
|
0
|
|
|
|
|
|
= sort { $a->begin <=> $b->begin } $gene->all_domains; |
|
0
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
$sorted_domains[$_]->_set_rank($rank++) |
122
|
0
|
|
|
|
|
|
for (0..(scalar @sorted_domains - 1)); |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# assign Domain objets array in the coordinates order |
125
|
0
|
|
|
|
|
|
$gene->_set_domains(\@sorted_domains); |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
my @sorted_exp_domains |
128
|
0
|
|
|
|
|
|
= sort { $a->begin <=> $b->begin } $gene->all_exp_domains; |
|
0
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
$sorted_exp_domains[$_]->_set_rank($exp_rank++) |
130
|
0
|
|
|
|
|
|
for (0..(scalar @sorted_exp_domains - 1)); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
return; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
138
|
|
|
|
|
|
|
1; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
__END__ |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=pod |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 NAME |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Bio::Palantir::Refiner::ClusterPlus - Refiner internal class for handling ClusterPlus objects |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 VERSION |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
version 0.200700 |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 SYNOPSIS |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
# TODO |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 DESCRIPTION |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
# TODO |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 genes |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
ArrayRef of L<Bio::Palantir::Refiner::Gene> |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 METHODS |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 count_genes |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Returns the number of Genes of the Cluster. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
# $cluster is a Bio::Palantir::Refiner::Cluster |
173
|
|
|
|
|
|
|
my $count = $cluster->count_genes; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
This method does not accept any arguments. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 all_genes |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Returns all the Genes of the Cluster (not an array reference). |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
# $cluster is a Bio::Palantir::Refiner::Cluster |
182
|
|
|
|
|
|
|
my @genes = $cluster->all_genes; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This method does not accept any arguments. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 get_gene |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Returns one Gene of the Cluster by its index. You can also use |
189
|
|
|
|
|
|
|
negative index numbers, just as with Perl's core array handling. If the |
190
|
|
|
|
|
|
|
specified Gene does not exist, this method will return C<undef>. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
# $cluster is a Bio::Palantir::Refiner::Cluster |
193
|
|
|
|
|
|
|
my $gene = $cluster->get_gene($index); |
194
|
|
|
|
|
|
|
croak "Gene $index not found!" unless defined $gene; |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This method accepts just one argument (and not an array slice). |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 next_gene |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Shifts the first Gene of the array off and returns it, shortening the |
201
|
|
|
|
|
|
|
array by 1 and moving everything down. If there are no more Genes in |
202
|
|
|
|
|
|
|
the array, returns C<undef>. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
# $cluster is a Bio::Palantir::Refiner::Cluster |
205
|
|
|
|
|
|
|
while (my $gene = $cluster->next_gene) { |
206
|
|
|
|
|
|
|
# process $gene |
207
|
|
|
|
|
|
|
# ... |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
This method does not accept any arguments. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head1 AUTHOR |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Loic MEUNIER <lmeunier@uliege.be> |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
This software is copyright (c) 2019 by University of Liege / Unit of Eukaryotic Phylogenomics / Loic MEUNIER and Denis BAURAIN. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
221
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=cut |