| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::Phylo::Identifiable; |
|
2
|
57
|
|
|
57
|
|
13852
|
use Bio::Phylo::Util::IDPool; |
|
|
57
|
|
|
|
|
139
|
|
|
|
57
|
|
|
|
|
1546
|
|
|
3
|
57
|
|
|
57
|
|
10123
|
use Bio::Phylo::Util::Exceptions 'throw'; |
|
|
57
|
|
|
|
|
204
|
|
|
|
57
|
|
|
|
|
3378
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
57
|
|
|
57
|
|
311
|
use strict; |
|
|
57
|
|
|
|
|
136
|
|
|
|
57
|
|
|
|
|
1059
|
|
|
6
|
57
|
|
|
57
|
|
247
|
use warnings; |
|
|
57
|
|
|
|
|
102
|
|
|
|
57
|
|
|
|
|
8129
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Bio::Phylo::Identifiable - Objects with unique identifiers |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Actually, you would almost never use this module directly. This is |
|
15
|
|
|
|
|
|
|
# the base class for other modules. |
|
16
|
|
|
|
|
|
|
use Bio::Phylo::Identifiable; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $obj = Bio::Phylo::Identifiable->new; |
|
19
|
|
|
|
|
|
|
print $obj->get_id; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This is the base class for objects in the Bio::Phylo package |
|
25
|
|
|
|
|
|
|
that need unique identifiers. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 CONSTRUCTOR |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item new() |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Type : Constructor |
|
36
|
|
|
|
|
|
|
Title : new |
|
37
|
|
|
|
|
|
|
Usage : my $phylo = Bio::Phylo::Identifiable->new; |
|
38
|
|
|
|
|
|
|
Function: Instantiates Bio::Phylo::Identifiable object |
|
39
|
|
|
|
|
|
|
Returns : a Bio::Phylo::Identifiable object |
|
40
|
|
|
|
|
|
|
Args : NONE |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub new { |
|
45
|
13384
|
|
|
13384
|
1
|
18487
|
my $class = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# happens only and exactly once because this |
|
48
|
|
|
|
|
|
|
# root class is visited from every constructor |
|
49
|
13384
|
|
|
|
|
34564
|
my $self = Bio::Phylo::Util::IDPool->_initialize(); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# bless in child class, not __PACKAGE__ |
|
52
|
13384
|
|
|
|
|
23341
|
bless $self, $class; |
|
53
|
13384
|
|
|
|
|
23403
|
return $self; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item get_id() |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Gets invocant's UID. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Type : Accessor |
|
61
|
|
|
|
|
|
|
Title : get_id |
|
62
|
|
|
|
|
|
|
Usage : my $id = $obj->get_id; |
|
63
|
|
|
|
|
|
|
Function: Returns the object's unique ID |
|
64
|
|
|
|
|
|
|
Returns : INT |
|
65
|
|
|
|
|
|
|
Args : None |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub get_id { |
|
70
|
2748190
|
|
|
2748190
|
1
|
3546086
|
my ($self) = @_; |
|
71
|
2748190
|
50
|
|
|
|
4509148
|
if ( UNIVERSAL::isa( $self, 'SCALAR' ) ) { |
|
72
|
2748190
|
|
|
|
|
6740671
|
return $$self; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
else { |
|
75
|
0
|
|
|
|
|
|
throw 'API' => "Not a SCALAR reference"; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item is_equal() |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Compares invocant's UID with argument's UID |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Type : Test |
|
84
|
|
|
|
|
|
|
Title : is_equal |
|
85
|
|
|
|
|
|
|
Usage : do_something() if $obj->is_equal($other); |
|
86
|
|
|
|
|
|
|
Function: Compares objects by UID |
|
87
|
|
|
|
|
|
|
Returns : BOOLEAN |
|
88
|
|
|
|
|
|
|
Args : Another object to compare with |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub is_equal { |
|
93
|
0
|
|
|
0
|
1
|
|
my ($self,$other) = @_; |
|
94
|
0
|
|
|
|
|
|
return $self->get_id == $other->get_id; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo> |
|
102
|
|
|
|
|
|
|
for any user or developer questions and discussions. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com> |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 CITATION |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
If you use Bio::Phylo in published research, please cite it: |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
B<Rutger A Vos>, B<Jason Caravas>, B<Klaas Hartmann>, B<Mark A Jensen> |
|
111
|
|
|
|
|
|
|
and B<Chase Miller>, 2011. Bio::Phylo - phyloinformatic analysis using Perl. |
|
112
|
|
|
|
|
|
|
I<BMC Bioinformatics> B<12>:63. |
|
113
|
|
|
|
|
|
|
L<http://dx.doi.org/10.1186/1471-2105-12-63> |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |