line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Phylo::Taxa::TaxaLinker; |
2
|
40
|
|
|
40
|
|
286
|
use Bio::Phylo; |
|
40
|
|
|
|
|
81
|
|
|
40
|
|
|
|
|
203
|
|
3
|
40
|
|
|
40
|
|
196
|
use Bio::Phylo::Mediators::TaxaMediator; |
|
40
|
|
|
|
|
77
|
|
|
40
|
|
|
|
|
1165
|
|
4
|
40
|
|
|
40
|
|
191
|
use Bio::Phylo::Util::Exceptions 'throw'; |
|
40
|
|
|
|
|
87
|
|
|
40
|
|
|
|
|
1842
|
|
5
|
40
|
|
|
40
|
|
209
|
use Bio::Phylo::Util::CONSTANT qw'_TAXA_ looks_like_object'; |
|
40
|
|
|
|
|
71
|
|
|
40
|
|
|
|
|
1981
|
|
6
|
40
|
|
|
40
|
|
218
|
use strict; |
|
40
|
|
|
|
|
82
|
|
|
40
|
|
|
|
|
5358
|
|
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<Bio::Phylo::Taxa> 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
|
131
|
my ( $self, $taxa ) = @_; |
53
|
56
|
100
|
66
|
|
|
210
|
if ( $taxa and looks_like_object $taxa, $TYPE_CONSTANT ) { |
54
|
52
|
|
|
|
|
247
|
$logger->info("setting taxa '$taxa'"); |
55
|
52
|
|
|
|
|
164
|
$mediator->set_link( |
56
|
|
|
|
|
|
|
'-one' => $taxa, |
57
|
|
|
|
|
|
|
'-many' => $self, |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else { |
61
|
4
|
|
|
|
|
15
|
$logger->info("re-setting taxa link"); |
62
|
4
|
|
|
|
|
15
|
$mediator->remove_link( '-many' => $self ); |
63
|
|
|
|
|
|
|
} |
64
|
56
|
|
|
|
|
200
|
$self->check_taxa; |
65
|
56
|
|
|
|
|
115
|
return $self; |
66
|
40
|
|
|
40
|
|
339
|
} |
|
40
|
|
|
|
|
95
|
|
|
40
|
|
|
|
|
205
|
|
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
|
254
|
my $self = shift; |
114
|
155
|
|
|
|
|
425
|
$logger->debug("getting taxa"); |
115
|
155
|
|
|
|
|
443
|
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
|
|
388
|
my $self = shift; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=back |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 SEE ALSO |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo> |
167
|
|
|
|
|
|
|
for any user or developer questions and discussions. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=over |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item L<Bio::Phylo::Matrices::Matrix> |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
The matrix object subclasses L<Bio::Phylo::Taxa::TaxaLinker>. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item L<Bio::Phylo::Forest> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
The forest object subclasses L<Bio::Phylo::Taxa::TaxaLinker>. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item L<Bio::Phylo::Manual> |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com>. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=back |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 CITATION |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
If you use Bio::Phylo in published research, please cite it: |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
B<Rutger A Vos>, B<Jason Caravas>, B<Klaas Hartmann>, B<Mark A Jensen> |
190
|
|
|
|
|
|
|
and B<Chase Miller>, 2011. Bio::Phylo - phyloinformatic analysis using Perl. |
191
|
|
|
|
|
|
|
I<BMC Bioinformatics> B<12>:63. |
192
|
|
|
|
|
|
|
L<http://dx.doi.org/10.1186/1471-2105-12-63> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
1; |