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