line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: TermSet.pm 2014-09-29 erick.antezana $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Module : TermSet.pm |
4
|
|
|
|
|
|
|
# Purpose : Term set. |
5
|
|
|
|
|
|
|
# License : Copyright (c) 2006-2015 by Erick Antezana. All rights reserved. |
6
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
7
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
# Contact : Erick Antezana |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
package OBO::Util::TermSet; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(OBO::Util::ObjectSet); |
13
|
8
|
|
|
8
|
|
7641
|
use OBO::Util::ObjectSet; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
203
|
|
14
|
|
|
|
|
|
|
|
15
|
8
|
|
|
8
|
|
40
|
use strict; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
163
|
|
16
|
8
|
|
|
8
|
|
44
|
use warnings; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
1175
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 contains_id |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Usage - $set->contains_id($element_id) |
21
|
|
|
|
|
|
|
Returns - true if this set contains an element with the given ID |
22
|
|
|
|
|
|
|
Args - the ID to be checked |
23
|
|
|
|
|
|
|
Function - checks if this set constains an element with the given ID |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub contains_id { |
28
|
2
|
|
|
2
|
1
|
4
|
my ($self, $id) = @_; |
29
|
2
|
100
|
|
|
|
11
|
return ($self->{MAP}->{$id})?1:0; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 contains_name |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Usage - $set->contains_name($element_name) |
35
|
|
|
|
|
|
|
Returns - true if this set contains an element with the given name |
36
|
|
|
|
|
|
|
Args - the name to be checked |
37
|
|
|
|
|
|
|
Function - checks if this set constains an element with the given name |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub contains_name { |
42
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
43
|
2
|
|
|
|
|
3
|
my $result = 0; |
44
|
2
|
50
|
|
|
|
6
|
if (@_) { |
45
|
2
|
|
|
|
|
8
|
my $term_id = shift; |
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
|
|
3
|
foreach my $ele (sort values %{$self->{MAP}}){ |
|
2
|
|
|
|
|
19
|
|
48
|
12
|
100
|
|
|
|
30
|
if ($ele->name() eq $term_id) { |
49
|
1
|
|
|
|
|
2
|
$result = 1; |
50
|
1
|
|
|
|
|
2
|
last; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
2
|
|
|
|
|
8
|
return $result; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |