| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::Phylo::Taxa::TaxaLinker; |
|
2
|
40
|
|
|
40
|
|
290
|
use Bio::Phylo; |
|
|
40
|
|
|
|
|
82
|
|
|
|
40
|
|
|
|
|
215
|
|
|
3
|
40
|
|
|
40
|
|
207
|
use Bio::Phylo::Mediators::TaxaMediator; |
|
|
40
|
|
|
|
|
81
|
|
|
|
40
|
|
|
|
|
1092
|
|
|
4
|
40
|
|
|
40
|
|
299
|
use Bio::Phylo::Util::Exceptions 'throw'; |
|
|
40
|
|
|
|
|
77
|
|
|
|
40
|
|
|
|
|
1860
|
|
|
5
|
40
|
|
|
40
|
|
227
|
use Bio::Phylo::Util::CONSTANT qw'_TAXA_ looks_like_object'; |
|
|
40
|
|
|
|
|
93
|
|
|
|
40
|
|
|
|
|
1727
|
|
|
6
|
40
|
|
|
40
|
|
219
|
use strict; |
|
|
40
|
|
|
|
|
82
|
|
|
|
40
|
|
|
|
|
5376
|
|
|
7
|
|
|
|
|
|
|
my $logger = Bio::Phylo->get_logger; |
|
8
|
|
|
|
|
|
|
my $mediator = 'Bio::Phylo::Mediators::TaxaMediator'; |
|
9
|
|
|
|
|
|
|
my $TYPE_CONSTANT = _TAXA_; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Bio::Phylo::Taxa::TaxaLinker - Superclass for objects that link to taxa objects |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Bio::Phylo::Factory; |
|
18
|
|
|
|
|
|
|
my $fac = Bio::Phylo::Factory->new; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $matrix = $fac->create_matrix; |
|
21
|
|
|
|
|
|
|
my $taxa = $fac->create_taxa; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
if ( $matrix->isa('Bio::Phylo::Taxa::TaxaLinker') ) { |
|
24
|
|
|
|
|
|
|
$matrix->set_taxa( $taxa ); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This module is a superclass for objects that link to L objects. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 METHODS |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 MUTATORS |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=over |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item set_taxa() |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Associates invocant with Bio::Phylo::Taxa argument. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Type : Mutator |
|
42
|
|
|
|
|
|
|
Title : set_taxa |
|
43
|
|
|
|
|
|
|
Usage : $obj->set_taxa( $taxa ); |
|
44
|
|
|
|
|
|
|
Function: Links the invocant object |
|
45
|
|
|
|
|
|
|
to a taxa object. |
|
46
|
|
|
|
|
|
|
Returns : Modified $obj |
|
47
|
|
|
|
|
|
|
Args : A Bio::Phylo::Taxa object. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub set_taxa : Clonable DeepClonable { |
|
52
|
56
|
|
|
56
|
1
|
137
|
my ( $self, $taxa ) = @_; |
|
53
|
56
|
100
|
66
|
|
|
263
|
if ( $taxa and looks_like_object $taxa, $TYPE_CONSTANT ) { |
|
54
|
52
|
|
|
|
|
308
|
$logger->info("setting taxa '$taxa'"); |
|
55
|
52
|
|
|
|
|
189
|
$mediator->set_link( |
|
56
|
|
|
|
|
|
|
'-one' => $taxa, |
|
57
|
|
|
|
|
|
|
'-many' => $self, |
|
58
|
|
|
|
|
|
|
); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
else { |
|
61
|
4
|
|
|
|
|
14
|
$logger->info("re-setting taxa link"); |
|
62
|
4
|
|
|
|
|
14
|
$mediator->remove_link( '-many' => $self ); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
56
|
|
|
|
|
524
|
$self->check_taxa; |
|
65
|
56
|
|
|
|
|
136
|
return $self; |
|
66
|
40
|
|
|
40
|
|
333
|
} |
|
|
40
|
|
|
|
|
122
|
|
|
|
40
|
|
|
|
|
217
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item unset_taxa() |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Removes association between invocant and Bio::Phylo::Taxa object. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Type : Mutator |
|
73
|
|
|
|
|
|
|
Title : unset_taxa |
|
74
|
|
|
|
|
|
|
Usage : $obj->unset_taxa(); |
|
75
|
|
|
|
|
|
|
Function: Removes the link between invocant object and taxa |
|
76
|
|
|
|
|
|
|
Returns : Modified $obj |
|
77
|
|
|
|
|
|
|
Args : NONE |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub unset_taxa { |
|
82
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
83
|
0
|
|
|
|
|
0
|
$logger->info("unsetting taxa"); |
|
84
|
0
|
|
|
|
|
0
|
$self->set_taxa(); |
|
85
|
0
|
|
|
|
|
0
|
return $self; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=back |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 ACCESSORS |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=over |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item get_taxa() |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Retrieves association between invocant and Bio::Phylo::Taxa object. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Type : Accessor |
|
99
|
|
|
|
|
|
|
Title : get_taxa |
|
100
|
|
|
|
|
|
|
Usage : my $taxa = $obj->get_taxa; |
|
101
|
|
|
|
|
|
|
Function: Retrieves the Bio::Phylo::Taxa |
|
102
|
|
|
|
|
|
|
object linked to the invocant. |
|
103
|
|
|
|
|
|
|
Returns : Bio::Phylo::Taxa |
|
104
|
|
|
|
|
|
|
Args : NONE |
|
105
|
|
|
|
|
|
|
Comments: This method returns the Bio::Phylo::Taxa |
|
106
|
|
|
|
|
|
|
object to which the invocant is linked. |
|
107
|
|
|
|
|
|
|
The returned object can therefore contain |
|
108
|
|
|
|
|
|
|
*more* taxa than are actually in the matrix. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub get_taxa { |
|
113
|
155
|
|
|
155
|
1
|
260
|
my $self = shift; |
|
114
|
155
|
|
|
|
|
462
|
$logger->debug("getting taxa"); |
|
115
|
155
|
|
|
|
|
487
|
return $mediator->get_link( '-source' => $self ); |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item check_taxa() |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Performs sanity check on taxon relationships. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Type : Interface method |
|
123
|
|
|
|
|
|
|
Title : check_taxa |
|
124
|
|
|
|
|
|
|
Usage : $obj->check_taxa |
|
125
|
|
|
|
|
|
|
Function: Performs sanity check on taxon relationships |
|
126
|
|
|
|
|
|
|
Returns : $obj |
|
127
|
|
|
|
|
|
|
Args : NONE |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub check_taxa { |
|
132
|
0
|
|
|
0
|
1
|
0
|
throw 'NotImplemented' => 'Not implemented!'; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item make_taxa() |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Creates a taxa block from the objects contents if none exists yet. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Type : Decorated interface method |
|
140
|
|
|
|
|
|
|
Title : make_taxa |
|
141
|
|
|
|
|
|
|
Usage : my $taxa = $obj->make_taxa |
|
142
|
|
|
|
|
|
|
Function: Creates a taxa block from the objects contents if none exists yet. |
|
143
|
|
|
|
|
|
|
Returns : $taxa |
|
144
|
|
|
|
|
|
|
Args : NONE |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub make_taxa { |
|
149
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
150
|
0
|
0
|
|
|
|
0
|
if ( my $taxa = $self->get_taxa ) { |
|
151
|
0
|
|
|
|
|
0
|
return $taxa; |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
else { |
|
154
|
0
|
|
|
|
|
0
|
throw 'NotImplemented' => 'Not implemented!'; |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub _cleanup { |
|
159
|
148
|
|
|
148
|
|
474
|
my $self = shift; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=back |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
There is a mailing list at L |
|
167
|
|
|
|
|
|
|
for any user or developer questions and discussions. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=over |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item L |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
The matrix object subclasses L. |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item L |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
The forest object subclasses L. |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item L |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Also see the manual: L and L. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=back |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 CITATION |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
If you use Bio::Phylo in published research, please cite it: |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
B, B, B, B |
|
190
|
|
|
|
|
|
|
and B, 2011. Bio::Phylo - phyloinformatic analysis using Perl. |
|
191
|
|
|
|
|
|
|
I B<12>:63. |
|
192
|
|
|
|
|
|
|
L |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
1; |