| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package R::YapRI::Robject::Rattributes; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
44717
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
21
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use autodie; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
2888
|
use Carp qw( carp croak cluck ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1088
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
############### |
|
12
|
|
|
|
|
|
|
### PERLDOC ### |
|
13
|
|
|
|
|
|
|
############### |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
R::YapRI::Robject::Rattributes |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
A module to store R attributes for an object |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
24
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use R::YapRI::Robject::Rattributes; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $rattr = R::YapRI::Rattributes->new(); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$rattr->set_names(["X", "Y"]); |
|
33
|
|
|
|
|
|
|
my @names = @{$rattr->get_names()}; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$rattr->set_dim([5,5]); |
|
36
|
|
|
|
|
|
|
my @dim = @{$attr->get_dim()}; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$rattr->set_dimnames([["a", "b", "c"], ["x", "y", "z"]]); |
|
39
|
|
|
|
|
|
|
my @dimnames_arefs = @{$rattr->set_dimnames()}; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$rattr->set_rownames(["x", "y", "z"]); |
|
42
|
|
|
|
|
|
|
my @rownames_arefs = @{$rattr->set_rownames()}; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$rattr->set_class("data.frame"); |
|
45
|
|
|
|
|
|
|
my $class = $attr->get_class(); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$rattr->set_tsp($start, $end, $frequency); |
|
48
|
|
|
|
|
|
|
my ($start, $end, $frequency) = $attr->get_tsp(); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Create a R::YapRI::Robject::Rattributes object, used by L |
|
54
|
|
|
|
|
|
|
to define the attributes for an Robject. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
There are 5 basic attributes for R objects (names, dim, dimnames, class and tsp) |
|
57
|
|
|
|
|
|
|
(for more info L) |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
It also has an special case, row.names for data.frames. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Aureliano Bombarely |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 CLASS METHODS |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
The following class methods are implemented: |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
############################ |
|
75
|
|
|
|
|
|
|
### GENERAL CONSTRUCTORS ### |
|
76
|
|
|
|
|
|
|
############################ |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 (*) CONSTRUCTORS: |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
It has a simple constructor using new() function. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Any of the accessors can be used as function arguments to set the accessor |
|
83
|
|
|
|
|
|
|
value during the object creation. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 constructor new |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Usage: my $rattr = R::YapRI::Robject::Rattributes->new($acc_href); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Desc: Create a new R::YapRI::Robject::Rattributes object. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Ret: a R::YapRI::Robject::Rattributes object |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Args: $acc_href, an accessor hash ref. with the following key/value pairs: |
|
94
|
|
|
|
|
|
|
names => arrayref. of strings (generally used with vectors and lists) |
|
95
|
|
|
|
|
|
|
dim => arrayref. of positive integers. |
|
96
|
|
|
|
|
|
|
dimnames => arrayref. of arrayref. of strings. |
|
97
|
|
|
|
|
|
|
rownames => arrayref. of rownames (generally used with data.frames) |
|
98
|
|
|
|
|
|
|
class => an scalar defining the class |
|
99
|
|
|
|
|
|
|
tsp => an arrayref. with three members: start, end and frequency. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Side_Effects: Die if the accessor hashref. is not a hash ref. or it is |
|
102
|
|
|
|
|
|
|
has a different accessor than names, dim, dimnames, class or |
|
103
|
|
|
|
|
|
|
tsp. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Example: my $rattr = R::YapRI::Robject::Rattributes->new($acc_href); |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub new { |
|
110
|
3
|
|
|
3
|
1
|
1548
|
my $class = shift; |
|
111
|
3
|
|
|
|
|
3
|
my $acchref = shift; |
|
112
|
|
|
|
|
|
|
|
|
113
|
3
|
|
|
|
|
6
|
my $self = bless( {}, $class ); |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
## Check variables. |
|
116
|
|
|
|
|
|
|
|
|
117
|
3
|
|
|
|
|
6
|
my %accs = (); |
|
118
|
3
|
100
|
|
|
|
7
|
if (defined $acchref) { |
|
119
|
2
|
100
|
|
|
|
5
|
if (ref($acchref) ne 'HASH') { |
|
120
|
1
|
|
|
|
|
20
|
croak("ARG. ERROR: $acchref supplied to new() isnt an HASHREF."); |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
else { |
|
123
|
1
|
|
|
|
|
1
|
%accs = %{$acchref}; |
|
|
1
|
|
|
|
|
4
|
|
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
## Permitted accessors |
|
128
|
|
|
|
|
|
|
|
|
129
|
2
|
|
|
|
|
21
|
my %permacc = ( |
|
130
|
|
|
|
|
|
|
names => [], |
|
131
|
|
|
|
|
|
|
dim => [], |
|
132
|
|
|
|
|
|
|
dimnames => [[]], |
|
133
|
|
|
|
|
|
|
rownames => [], |
|
134
|
|
|
|
|
|
|
class => '', |
|
135
|
|
|
|
|
|
|
tsp => ['', '', ''], |
|
136
|
|
|
|
|
|
|
); |
|
137
|
|
|
|
|
|
|
|
|
138
|
2
|
|
|
|
|
7
|
foreach my $acc (sort keys %accs) { |
|
139
|
1
|
50
|
|
|
|
3
|
unless (defined $permacc{$acc}) { |
|
140
|
1
|
|
|
|
|
9
|
croak("ARG. ERROR: accessor name $acc isnt permited for new()"); |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
## Add default values (empty variables) and set the accessors |
|
145
|
|
|
|
|
|
|
|
|
146
|
1
|
|
|
|
|
7
|
foreach my $pacc (sort keys %permacc) { |
|
147
|
|
|
|
|
|
|
|
|
148
|
6
|
|
|
|
|
7
|
my $acc_function = 'set_' . $pacc; |
|
149
|
|
|
|
|
|
|
|
|
150
|
6
|
50
|
|
|
|
9
|
unless (defined $accs{$pacc}) { |
|
151
|
6
|
|
|
|
|
20
|
$self->$acc_function($permacc{$pacc}); |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
else { |
|
154
|
0
|
|
|
|
|
0
|
$self->$acc_function($accs{$pacc}); |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
1
|
|
|
|
|
5
|
return $self; |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
################# |
|
163
|
|
|
|
|
|
|
### ACCESSORS ### |
|
164
|
|
|
|
|
|
|
################# |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 (*) ACCESSORS: |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
There are a couple of functions (get/set) for accessors |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 get/set_names |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Usage: my $names_aref = $rattr->get_names(); |
|
173
|
|
|
|
|
|
|
$rattr->set_names($names_aref); |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Desc: Get/Set the names attributes to Rattributes object |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Ret: Get: $names_aref, an array ref. with names attribute |
|
178
|
|
|
|
|
|
|
Set: None |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Args: Get: None |
|
181
|
|
|
|
|
|
|
Set: $names_aref, an array ref. with names attribute |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Side_Effects: Get: None |
|
184
|
|
|
|
|
|
|
Set: Die if the argument supplied is not an array ref. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Example: my @names = @{$rattr->get_names()}; |
|
187
|
|
|
|
|
|
|
$rattr->set_names(\@names); |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub get_names { |
|
192
|
1
|
|
|
1
|
0
|
6
|
my $self = shift; |
|
193
|
1
|
|
|
|
|
5
|
return $self->{names}; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
sub set_names { |
|
197
|
4
|
|
|
4
|
1
|
632
|
my $self = shift; |
|
198
|
4
|
|
|
|
|
4
|
my $names_aref = shift; |
|
199
|
|
|
|
|
|
|
|
|
200
|
4
|
100
|
|
|
|
8
|
unless (defined $names_aref) { |
|
201
|
1
|
|
|
|
|
9
|
croak("ERROR: No argument was supplied to set_names function."); |
|
202
|
|
|
|
|
|
|
} |
|
203
|
|
|
|
|
|
|
else { |
|
204
|
3
|
100
|
|
|
|
10
|
if (ref($names_aref) ne 'ARRAY') { |
|
205
|
1
|
|
|
|
|
12
|
croak("ERROR: $names_aref supplied to set_names isnt an ARRAYREF."); |
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
} |
|
208
|
|
|
|
|
|
|
|
|
209
|
2
|
|
|
|
|
4
|
$self->{names} = $names_aref; |
|
210
|
|
|
|
|
|
|
} |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 get/set_dim |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Usage: my $dim_aref = $rattr->get_dim(); |
|
216
|
|
|
|
|
|
|
$rattr->set_dim($dim_aref); |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Desc: Get/Set the dim (dimension) attribute to Rattributes object |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Ret: Get: $dim_aref, an array ref. with dim (integers) attribute |
|
221
|
|
|
|
|
|
|
Set: None |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Args: Get: None |
|
224
|
|
|
|
|
|
|
Set: $dim_aref, an array ref. with dim (integers) attribute |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Side_Effects: Get: None |
|
227
|
|
|
|
|
|
|
Set: Die if the argument supplied is not an array ref. |
|
228
|
|
|
|
|
|
|
Die if the elements of the array ref. are not integers. |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Example: my @dim = @{$rattr->get_dim()}; |
|
231
|
|
|
|
|
|
|
$rattr->set_dim(\@dim); |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=cut |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub get_dim { |
|
236
|
1
|
|
|
1
|
0
|
4
|
my $self = shift; |
|
237
|
1
|
|
|
|
|
5
|
return $self->{dim}; |
|
238
|
|
|
|
|
|
|
} |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
sub set_dim { |
|
241
|
5
|
|
|
5
|
1
|
1311
|
my $self = shift; |
|
242
|
5
|
|
|
|
|
4
|
my $dim_aref = shift; |
|
243
|
|
|
|
|
|
|
|
|
244
|
5
|
100
|
|
|
|
14
|
unless (defined $dim_aref) { |
|
245
|
1
|
|
|
|
|
8
|
croak("ERROR: No argument was supplied to set_dim function."); |
|
246
|
|
|
|
|
|
|
} |
|
247
|
|
|
|
|
|
|
else { |
|
248
|
4
|
100
|
|
|
|
12
|
if (ref($dim_aref) ne 'ARRAY') { |
|
249
|
1
|
|
|
|
|
10
|
croak("ERROR: $dim_aref supplied to set_dim isnt an ARRAYREF."); |
|
250
|
|
|
|
|
|
|
} |
|
251
|
|
|
|
|
|
|
else { |
|
252
|
3
|
|
|
|
|
6
|
foreach my $dim (@{$dim_aref}) { |
|
|
3
|
|
|
|
|
9
|
|
|
253
|
3
|
100
|
|
|
|
15
|
if ($dim !~ m/^\d+$/) { |
|
254
|
1
|
|
|
|
|
11
|
croak("ERROR: dim=$dim used at set_dim isnt an INTEGER."); |
|
255
|
|
|
|
|
|
|
} |
|
256
|
|
|
|
|
|
|
} |
|
257
|
|
|
|
|
|
|
} |
|
258
|
|
|
|
|
|
|
} |
|
259
|
|
|
|
|
|
|
|
|
260
|
2
|
|
|
|
|
5
|
$self->{dim} = $dim_aref; |
|
261
|
|
|
|
|
|
|
} |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=head2 get/set_dimnames |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
Usage: my $dimnames_arefaref = $rattr->get_dimnames(); |
|
267
|
|
|
|
|
|
|
$rattr->set_dimnames($dimnames_arefaref); |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
Desc: Get/Set the dimnames attribute to Rattributes object. |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Ret: Get: $dimnames_arefaref, an array ref. of array references |
|
272
|
|
|
|
|
|
|
with dimnames attributes |
|
273
|
|
|
|
|
|
|
Set: None |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
Args: Get: None |
|
276
|
|
|
|
|
|
|
Set: $dimnames_arefaref, an array ref. of array references |
|
277
|
|
|
|
|
|
|
with dimnames attribute |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
Side_Effects: Get: None |
|
280
|
|
|
|
|
|
|
Set: Die if the argument supplied is not an array ref. |
|
281
|
|
|
|
|
|
|
Die if the elements of the array ref. are not array refs. |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
Example: my @dimnames_aref = @{$rattr->get_dimnames()}; |
|
284
|
|
|
|
|
|
|
$rattr->set_dimnames([ ['A', 'B'], ['x', 'y'] ]); |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=cut |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
sub get_dimnames { |
|
289
|
1
|
|
|
1
|
0
|
8
|
my $self = shift; |
|
290
|
1
|
|
|
|
|
9
|
return $self->{dimnames}; |
|
291
|
|
|
|
|
|
|
} |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
sub set_dimnames { |
|
294
|
5
|
|
|
5
|
1
|
2937
|
my $self = shift; |
|
295
|
5
|
|
|
|
|
6
|
my $dns_afaf = shift; |
|
296
|
|
|
|
|
|
|
|
|
297
|
5
|
100
|
|
|
|
14
|
unless (defined $dns_afaf) { |
|
298
|
1
|
|
|
|
|
19
|
croak("ERROR: No argument was supplied to set_dimnames function."); |
|
299
|
|
|
|
|
|
|
} |
|
300
|
|
|
|
|
|
|
else { |
|
301
|
4
|
100
|
|
|
|
14
|
if (ref($dns_afaf) ne 'ARRAY') { |
|
302
|
1
|
|
|
|
|
10
|
croak("ERROR: $dns_afaf supplied to set_dimnames isnt ARRAYREF."); |
|
303
|
|
|
|
|
|
|
} |
|
304
|
|
|
|
|
|
|
else { |
|
305
|
3
|
|
|
|
|
4
|
foreach my $dns_af (@{$dns_afaf}) { |
|
|
3
|
|
|
|
|
10
|
|
|
306
|
4
|
100
|
|
|
|
18
|
if (ref($dns_af) ne 'ARRAY') { |
|
307
|
1
|
|
|
|
|
15
|
croak("ERROR: $dns_af used at set_dimnames isnt an AREF."); |
|
308
|
|
|
|
|
|
|
} |
|
309
|
|
|
|
|
|
|
} |
|
310
|
|
|
|
|
|
|
} |
|
311
|
|
|
|
|
|
|
} |
|
312
|
|
|
|
|
|
|
|
|
313
|
2
|
|
|
|
|
6
|
$self->{dimnames} = $dns_afaf; |
|
314
|
|
|
|
|
|
|
} |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=head2 get/set_rownames |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Usage: my $rownames_aref = $rattr->get_rownames(); |
|
319
|
|
|
|
|
|
|
$rattr->set_rownames($rownames_aref); |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
Desc: Get/Set the row.names attributes to Rattributes object |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
Ret: Get: $rownames_aref, an array ref. with row.names attribute |
|
324
|
|
|
|
|
|
|
Set: None |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
Args: Get: None |
|
327
|
|
|
|
|
|
|
Set: $rownames_aref, an array ref. with row.names attribute |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
Side_Effects: Get: None |
|
330
|
|
|
|
|
|
|
Set: Die if the argument supplied is not an array ref. |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Example: my @rownames = @{$rattr->get_rownames()}; |
|
333
|
|
|
|
|
|
|
$rattr->set_rownames(\@rownames); |
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=cut |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
sub get_rownames { |
|
338
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
339
|
0
|
|
|
|
|
0
|
return $self->{rownames}; |
|
340
|
|
|
|
|
|
|
} |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
sub set_rownames { |
|
343
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
344
|
1
|
|
|
|
|
2
|
my $rowns_aref = shift; |
|
345
|
|
|
|
|
|
|
|
|
346
|
1
|
50
|
|
|
|
2
|
unless (defined $rowns_aref) { |
|
347
|
0
|
|
|
|
|
0
|
croak("ERROR: No argument was supplied to set_rownames function."); |
|
348
|
|
|
|
|
|
|
} |
|
349
|
|
|
|
|
|
|
else { |
|
350
|
1
|
50
|
|
|
|
9
|
if (ref($rowns_aref) ne 'ARRAY') { |
|
351
|
0
|
|
|
|
|
0
|
croak("ERROR: $rowns_aref supplied to set_rownames isnt an AREF."); |
|
352
|
|
|
|
|
|
|
} |
|
353
|
|
|
|
|
|
|
} |
|
354
|
|
|
|
|
|
|
|
|
355
|
1
|
|
|
|
|
2
|
$self->{rownames} = $rowns_aref; |
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=head2 get/set_class |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
Usage: my $class = $rattr->get_class(); |
|
361
|
|
|
|
|
|
|
$rattr->set_class($class); |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
Desc: Get/Set the class attribute to Rattributes object |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
Ret: Get: $class, a class attribute for an R object |
|
366
|
|
|
|
|
|
|
Set: None |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
Args: Get: None |
|
369
|
|
|
|
|
|
|
Set: $class, a class attribute for an R object |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
Side_Effects: Get: None |
|
372
|
|
|
|
|
|
|
Set: Die if no arguments is supplied to this function |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
Example: my $class = @{$rattr->get_class()}; |
|
375
|
|
|
|
|
|
|
$rattr->set_class($class); |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=cut |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
sub get_class { |
|
380
|
1
|
|
|
1
|
0
|
4
|
my $self = shift; |
|
381
|
1
|
|
|
|
|
6
|
return $self->{class}; |
|
382
|
|
|
|
|
|
|
} |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
sub set_class { |
|
385
|
4
|
|
|
4
|
1
|
661
|
my $self = shift; |
|
386
|
4
|
|
|
|
|
5
|
my $class = shift; |
|
387
|
|
|
|
|
|
|
|
|
388
|
4
|
100
|
|
|
|
12
|
unless (defined $class) { |
|
|
|
100
|
|
|
|
|
|
|
389
|
1
|
|
|
|
|
12
|
croak("ERROR: No argument was supplied to set_class function."); |
|
390
|
|
|
|
|
|
|
} |
|
391
|
|
|
|
|
|
|
elsif (ref($class)) { |
|
392
|
1
|
|
|
|
|
10
|
croak("ERROR: $class supplied to set_class is not a string/scalar") |
|
393
|
|
|
|
|
|
|
} |
|
394
|
|
|
|
|
|
|
|
|
395
|
2
|
|
|
|
|
7
|
$self->{class} = $class; |
|
396
|
|
|
|
|
|
|
} |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
=head2 get/set_tsp |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
Usage: my $tsp_aref = $rattr->get_tsp(); |
|
401
|
|
|
|
|
|
|
$rattr->set_tsp($tsp_aref); |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
Desc: Get/Set the tsp (time series) attribute to Rattributes object |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
Ret: Get: $tsp_aref, a tsp array ref. attribute for an R object with three |
|
406
|
|
|
|
|
|
|
elements: $start, $end, $frequency. |
|
407
|
|
|
|
|
|
|
Set: None |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
Args: Get: None |
|
410
|
|
|
|
|
|
|
Set: $tsp_aref, a tsp array ref. attribute for an R object with three |
|
411
|
|
|
|
|
|
|
elements: $start, $end, $frequency. |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
Side_Effects: Get: None |
|
414
|
|
|
|
|
|
|
Set: Die if no arguments is supplied to this function. |
|
415
|
|
|
|
|
|
|
Die if the argument provided is not an array ref. |
|
416
|
|
|
|
|
|
|
If the array ref. supplied has more than three elements, |
|
417
|
|
|
|
|
|
|
that array will be modify and the elements beyond 3 will |
|
418
|
|
|
|
|
|
|
be deleted (last index of the array will be set to 2) |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
Example: my ($start, $end, $frequency) = @{$rattr->get_tsp()}; |
|
421
|
|
|
|
|
|
|
$rattr->set_class([$start, $end, $frequency]); |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=cut |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
sub get_tsp { |
|
426
|
2
|
|
|
2
|
0
|
687
|
my $self = shift; |
|
427
|
2
|
|
|
|
|
11
|
return $self->{tsp}; |
|
428
|
|
|
|
|
|
|
} |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
sub set_tsp { |
|
431
|
4
|
|
|
4
|
1
|
687
|
my $self = shift; |
|
432
|
4
|
|
|
|
|
5
|
my $tsp_aref = shift; |
|
433
|
|
|
|
|
|
|
|
|
434
|
4
|
100
|
|
|
|
32
|
unless (defined $tsp_aref) { |
|
435
|
1
|
|
|
|
|
19
|
croak("ERROR: No argument was supplied to set_tsp function."); |
|
436
|
|
|
|
|
|
|
} |
|
437
|
|
|
|
|
|
|
else { |
|
438
|
3
|
100
|
|
|
|
9
|
if (ref($tsp_aref) ne 'ARRAY') { |
|
439
|
1
|
|
|
|
|
10
|
croak("ERROR: $tsp_aref supplied to set_tsp is not an ARRAYREF."); |
|
440
|
|
|
|
|
|
|
} |
|
441
|
2
|
100
|
|
|
|
3
|
if (scalar(@{$tsp_aref}) > 3) { |
|
|
2
|
|
|
|
|
6
|
|
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
## Modify the array ref. and cut just to take 3 elements. |
|
444
|
1
|
|
|
|
|
5
|
$#$tsp_aref = 2; |
|
445
|
|
|
|
|
|
|
} |
|
446
|
|
|
|
|
|
|
} |
|
447
|
|
|
|
|
|
|
|
|
448
|
2
|
|
|
|
|
5
|
$self->{tsp} = $tsp_aref; |
|
449
|
|
|
|
|
|
|
} |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
Lukas Mueller |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
Robert Buels |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
Naama Menda |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
Jonathan "Duke" Leto |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
Copyright 2011 Boyce Thompson Institute for Plant Research |
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
Copyright 2011 Sol Genomics Network (solgenomics.net) |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
|
471
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=cut |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
#### |
|
476
|
|
|
|
|
|
|
1; # |
|
477
|
|
|
|
|
|
|
#### |