line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Phylo::Taxa::TaxonLinker; |
2
|
46
|
|
|
46
|
|
894
|
use Bio::Phylo::Mediators::TaxaMediator; |
|
46
|
|
|
|
|
90
|
|
|
46
|
|
|
|
|
1284
|
|
3
|
46
|
|
|
46
|
|
218
|
use Bio::Phylo::Util::Exceptions; |
|
46
|
|
|
|
|
91
|
|
|
46
|
|
|
|
|
1466
|
|
4
|
46
|
|
|
46
|
|
240
|
use Bio::Phylo::Util::MOP; |
|
46
|
|
|
|
|
92
|
|
|
46
|
|
|
|
|
222
|
|
5
|
46
|
|
|
46
|
|
202
|
use Bio::Phylo::Util::Logger ':simple'; |
|
46
|
|
|
|
|
89
|
|
|
46
|
|
|
|
|
5006
|
|
6
|
46
|
|
|
46
|
|
306
|
use Bio::Phylo::Util::CONSTANT qw'_TAXON_ looks_like_object'; |
|
46
|
|
|
|
|
84
|
|
|
46
|
|
|
|
|
1982
|
|
7
|
46
|
|
|
46
|
|
236
|
use strict; |
|
46
|
|
|
|
|
121
|
|
|
46
|
|
|
|
|
873
|
|
8
|
46
|
|
|
46
|
|
224
|
use warnings; |
|
46
|
|
|
|
|
98
|
|
|
46
|
|
|
|
|
6180
|
|
9
|
|
|
|
|
|
|
{ |
10
|
|
|
|
|
|
|
my $TAXON_CONSTANT = _TAXON_; |
11
|
|
|
|
|
|
|
my $mediator = 'Bio::Phylo::Mediators::TaxaMediator'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Bio::Phylo::Taxa::TaxonLinker - Superclass for objects that link to taxon objects |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Bio::Phylo::Factory; |
20
|
|
|
|
|
|
|
my $fac = Bio::Phylo::Factory->new; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $node = $fac->create_node; |
23
|
|
|
|
|
|
|
my $taxon = $fac->create_taxon; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# just to show who's what |
26
|
|
|
|
|
|
|
if ( $node->isa('Bio::Phylo::Taxa::TaxonLinker') ) { |
27
|
|
|
|
|
|
|
$node->set_taxon( $taxon ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# prints 'Bio::Phylo::Taxa::Taxon' |
31
|
|
|
|
|
|
|
print ref $node->get_taxon |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
This module is a superclass for objects that link to L<Bio::Phylo::Taxa::Taxon> |
36
|
|
|
|
|
|
|
objects. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 MUTATORS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item set_taxon() |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Links the invocant object to a taxon object. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Type : Mutator |
49
|
|
|
|
|
|
|
Title : set_taxon |
50
|
|
|
|
|
|
|
Usage : $obj->set_taxon( $taxon ); |
51
|
|
|
|
|
|
|
Function: Links the invocant object |
52
|
|
|
|
|
|
|
to a taxon object. |
53
|
|
|
|
|
|
|
Returns : Modified $obj |
54
|
|
|
|
|
|
|
Args : A Bio::Phylo::Taxa::Taxon object. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub set_taxon : Clonable { |
59
|
250
|
|
|
250
|
1
|
620
|
my ( $self, $taxon ) = @_; |
60
|
250
|
100
|
100
|
|
|
665
|
if ( $taxon and looks_like_object $taxon, $TAXON_CONSTANT ) { |
61
|
212
|
|
|
|
|
732
|
INFO "setting taxon '$taxon'"; |
62
|
212
|
|
|
|
|
531
|
$mediator->set_link( '-one' => $taxon, '-many' => $self ); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else { |
65
|
34
|
|
|
|
|
78
|
INFO "re-setting taxon link"; |
66
|
34
|
|
|
|
|
81
|
$mediator->remove_link( '-many' => $self ); |
67
|
|
|
|
|
|
|
} |
68
|
246
|
|
|
|
|
511
|
return $self; |
69
|
46
|
|
|
46
|
|
310
|
} |
|
46
|
|
|
|
|
98
|
|
|
46
|
|
|
|
|
337
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item unset_taxon() |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Unlinks the invocant object from any taxon object. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Type : Mutator |
76
|
|
|
|
|
|
|
Title : unset_taxon |
77
|
|
|
|
|
|
|
Usage : $obj->unset_taxon(); |
78
|
|
|
|
|
|
|
Function: Unlinks the invocant object |
79
|
|
|
|
|
|
|
from any taxon object. |
80
|
|
|
|
|
|
|
Returns : Modified $obj |
81
|
|
|
|
|
|
|
Args : NONE |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub unset_taxon { |
86
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
87
|
0
|
|
|
|
|
0
|
DEBUG "unsetting taxon"; |
88
|
0
|
|
|
|
|
0
|
$self->set_taxon(); |
89
|
0
|
|
|
|
|
0
|
return $self; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 ACCESSORS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=over |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item get_taxon() |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Retrieves the Bio::Phylo::Taxa::Taxon object linked to the invocant. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Type : Accessor |
103
|
|
|
|
|
|
|
Title : get_taxon |
104
|
|
|
|
|
|
|
Usage : my $taxon = $obj->get_taxon; |
105
|
|
|
|
|
|
|
Function: Retrieves the Bio::Phylo::Taxa::Taxon |
106
|
|
|
|
|
|
|
object linked to the invocant. |
107
|
|
|
|
|
|
|
Returns : Bio::Phylo::Taxa::Taxon |
108
|
|
|
|
|
|
|
Args : NONE |
109
|
|
|
|
|
|
|
Comments: |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub get_taxon { |
114
|
567
|
|
|
567
|
1
|
1381
|
$mediator->get_link( '-source' => shift ); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=back |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# podinherit_insert_token |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SEE ALSO |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo> |
126
|
|
|
|
|
|
|
for any user or developer questions and discussions. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=over |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item L<Bio::Phylo::Matrices::Datum> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The datum object subclasses L<Bio::Phylo::Taxa::TaxonLinker>. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item L<Bio::Phylo::Forest::Node> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
The node object subclasses L<Bio::Phylo::Taxa::TaxonLinker>. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item L<Bio::Phylo::Manual> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com>. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=back |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 CITATION |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
If you use Bio::Phylo in published research, please cite it: |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
B<Rutger A Vos>, B<Jason Caravas>, B<Klaas Hartmann>, B<Mark A Jensen> |
149
|
|
|
|
|
|
|
and B<Chase Miller>, 2011. Bio::Phylo - phyloinformatic analysis using Perl. |
150
|
|
|
|
|
|
|
I<BMC Bioinformatics> B<12>:63. |
151
|
|
|
|
|
|
|
L<http://dx.doi.org/10.1186/1471-2105-12-63> |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
1; |