line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: SubsetDef.pm 2011-06-06 erick.antezana $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Module : SubsetDef.pm |
4
|
|
|
|
|
|
|
# Purpose : A subset definition. |
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::Core::SubsetDef; |
11
|
|
|
|
|
|
|
|
12
|
9
|
|
|
9
|
|
11556
|
use Carp; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
554
|
|
13
|
9
|
|
|
9
|
|
50
|
use strict; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
192
|
|
14
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
3617
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
30
|
|
|
30
|
0
|
195
|
my $class = shift; |
18
|
30
|
|
|
|
|
52
|
my $self = {}; |
19
|
|
|
|
|
|
|
|
20
|
30
|
|
|
|
|
62
|
$self->{NAME} = undef; # required |
21
|
30
|
|
|
|
|
133
|
$self->{DESCRIPTION} = undef; # required |
22
|
|
|
|
|
|
|
|
23
|
30
|
|
|
|
|
50
|
bless ($self, $class); |
24
|
30
|
|
|
|
|
82
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
=head2 name |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Usage - print $subset_def->name() or $subset_def->name($name) |
29
|
|
|
|
|
|
|
Returns - the subset def name (string) |
30
|
|
|
|
|
|
|
Args - the subset def name (string) |
31
|
|
|
|
|
|
|
Function - gets/sets the subset def name |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub name { |
36
|
113
|
100
|
|
113
|
0
|
403
|
$_[0]->{NAME} = $_[1] if ($_[1]); |
37
|
113
|
|
|
|
|
404
|
return $_[0]->{NAME}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 description |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Usage - print $subset_def->description() or $subset_def->description($desc) |
43
|
|
|
|
|
|
|
Returns - the subset def description (string) |
44
|
|
|
|
|
|
|
Args - the subset def description (string) |
45
|
|
|
|
|
|
|
Function - gets/sets the synonym description |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub description { |
50
|
38
|
100
|
|
38
|
1
|
124
|
$_[0]->{DESCRIPTION} = $_[1] if ($_[1]); |
51
|
38
|
|
|
|
|
113
|
return $_[0]->{DESCRIPTION}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 as_string |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Usage - $subset_def->as_string() or $subset_def->as_string("GO_SLIM", "GO Slim") |
57
|
|
|
|
|
|
|
Returns - the subset def definition (string) |
58
|
|
|
|
|
|
|
Args - the subset def definition (string) |
59
|
|
|
|
|
|
|
Function - gets/sets the definition of this synonym |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub as_string { |
64
|
33
|
50
|
66
|
33
|
1
|
281
|
if ($_[1] && $_[2]){ |
65
|
9
|
|
|
|
|
24
|
$_[0]->{NAME} = $_[1]; |
66
|
9
|
|
|
|
|
38
|
$_[0]->{DESCRIPTION} = $_[2]; |
67
|
|
|
|
|
|
|
} |
68
|
33
|
|
|
|
|
152
|
return $_[0]->{NAME}.' "'.$_[0]->{DESCRIPTION}.'"'; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 equals |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Usage - print $subset_def->equals($another_subset_def) |
74
|
|
|
|
|
|
|
Returns - either 1 (true) or 0 (false) |
75
|
|
|
|
|
|
|
Args - the subset def definition to compare with |
76
|
|
|
|
|
|
|
Function - tells whether this subset def definition is equal to the given argument (another subset def definition) |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub equals { |
81
|
44
|
|
|
44
|
1
|
53
|
my $result = 0; |
82
|
44
|
50
|
33
|
|
|
103
|
if ($_[1] && eval { $_[1]->isa('OBO::Core::SubsetDef') }) { |
|
44
|
|
|
|
|
218
|
|
83
|
|
|
|
|
|
|
|
84
|
44
|
50
|
|
|
|
106
|
croak 'The name of this subset definition is undefined.' if (!defined($_[0]->{NAME})); |
85
|
44
|
50
|
|
|
|
86
|
croak 'The name of the target subset definition is undefined.' if (!defined($_[1]->{NAME})); |
86
|
|
|
|
|
|
|
|
87
|
44
|
50
|
|
|
|
84
|
croak 'The description of the this subset definition is undefined.' if (!defined($_[0]->{DESCRIPTION})); |
88
|
44
|
50
|
|
|
|
90
|
croak 'The description of the target subset definition is undefined.' if (!defined($_[1]->{DESCRIPTION})); |
89
|
|
|
|
|
|
|
|
90
|
44
|
|
33
|
|
|
177
|
$result = ($_[0]->{NAME} eq $_[1]->{NAME}) && ($_[0]->{DESCRIPTION} eq $_[1]->{DESCRIPTION}); |
91
|
|
|
|
|
|
|
} else { |
92
|
0
|
|
|
|
|
0
|
croak "An unrecognized object type (not a OBO::Core::SubsetDef) was found: '", $_[1], "'"; |
93
|
|
|
|
|
|
|
} |
94
|
44
|
|
|
|
|
166
|
return $result; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |