line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# BioPerl module for Bio::Matrix::MatrixI |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Please direct questions and support issues to |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# Cared for by Jason Stajich |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Copyright Jason Stajich |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Bio::Matrix::MatrixI - An interface for describing a Matrix |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Get a Matrix object |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This is an interface describing how one should be able to interact |
26
|
|
|
|
|
|
|
with a matrix. One can have a lot of information I suppose and this |
27
|
|
|
|
|
|
|
outline won't really work for PWM or PSSMs. We will have to derive a |
28
|
|
|
|
|
|
|
particular interface for those. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 FEEDBACK |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 Mailing Lists |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
35
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to |
36
|
|
|
|
|
|
|
the Bioperl mailing list. Your participation is much appreciated. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
39
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 Support |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
I |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
48
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
49
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
50
|
|
|
|
|
|
|
with code and data examples if at all possible. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 Reporting Bugs |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
55
|
|
|
|
|
|
|
of the bugs and their resolution. Bug reports can be submitted via |
56
|
|
|
|
|
|
|
email or the web: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 AUTHOR - Jason Stajich |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Email jason-at-bioperl.org |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 APPENDIX |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The rest of the documentation details each of the object methods. |
67
|
|
|
|
|
|
|
Internal methods are usually preceded with a _ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Let the code begin... |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
package Bio::Matrix::MatrixI; |
76
|
6
|
|
|
6
|
|
37
|
use strict; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
156
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
6
|
|
|
6
|
|
24
|
use base qw(Bio::Root::RootI); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
1824
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 matrix_id |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Title : matrix_id |
85
|
|
|
|
|
|
|
Usage : my $id = $matrix->matrix_id |
86
|
|
|
|
|
|
|
Function: Get the matrix ID |
87
|
|
|
|
|
|
|
Returns : string value |
88
|
|
|
|
|
|
|
Args : |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub matrix_id{ |
94
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
95
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 matrix_name |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Title : matrix_name |
101
|
|
|
|
|
|
|
Usage : my $name = $matrix->matrix_name(); |
102
|
|
|
|
|
|
|
Function: Get the matrix name |
103
|
|
|
|
|
|
|
Returns : string value |
104
|
|
|
|
|
|
|
Args : |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub matrix_name{ |
110
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 get_entry |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Title : get_entry |
118
|
|
|
|
|
|
|
Usage : my $entry = $matrix->get_entry($rowname,$columname) |
119
|
|
|
|
|
|
|
Function: Get the entry for a given row,column pair |
120
|
|
|
|
|
|
|
Returns : scalar |
121
|
|
|
|
|
|
|
Args : $row name |
122
|
|
|
|
|
|
|
$column name |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub get_entry{ |
128
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 get_column |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Title : get_column |
137
|
|
|
|
|
|
|
Usage : my @row = $matrix->get_column('ALPHA'); |
138
|
|
|
|
|
|
|
Function: Get a particular column |
139
|
|
|
|
|
|
|
Returns : Array (in array context) or arrayref (in scalar context) |
140
|
|
|
|
|
|
|
of values |
141
|
|
|
|
|
|
|
Args : name of the column |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub get_column{ |
147
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
148
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 get_row |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Title : get_row |
154
|
|
|
|
|
|
|
Usage : my @row = $matrix->get_row('ALPHA'); |
155
|
|
|
|
|
|
|
Function: Get a particular row |
156
|
|
|
|
|
|
|
Returns : Array (in array context) or arrayref (in scalar context) |
157
|
|
|
|
|
|
|
of values |
158
|
|
|
|
|
|
|
Args : name of the row |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub get_row{ |
163
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
164
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 get_diagonal |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Title : get_diagonal |
171
|
|
|
|
|
|
|
Usage : my @diagonal = $matrix->get_diagonal; |
172
|
|
|
|
|
|
|
Function: Get the diagonal of the matrix |
173
|
|
|
|
|
|
|
Returns : Array (in array context) or arrayref (in scalar context) |
174
|
|
|
|
|
|
|
Args : none |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub get_diagonal{ |
180
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
181
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 column_num_for_name |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Title : column_num_for_name |
187
|
|
|
|
|
|
|
Usage : my $num = $matrix->column_num_for_name($name) |
188
|
|
|
|
|
|
|
Function: Gets the column number for a particular column name |
189
|
|
|
|
|
|
|
Returns : integer |
190
|
|
|
|
|
|
|
Args : string |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=cut |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub column_num_for_name{ |
196
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
197
|
|
|
|
|
|
|
|
198
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head2 row_num_for_name |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Title : row_num_for_name |
204
|
|
|
|
|
|
|
Usage : my $num = $matrix->row_num_for_name($name) |
205
|
|
|
|
|
|
|
Function: Gets the row number for a particular row name |
206
|
|
|
|
|
|
|
Returns : integer |
207
|
|
|
|
|
|
|
Args : string |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub row_num_for_name{ |
213
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
214
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 num_rows |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Title : num_rows |
220
|
|
|
|
|
|
|
Usage : my $rowcount = $matrix->num_rows; |
221
|
|
|
|
|
|
|
Function: Get the number of rows |
222
|
|
|
|
|
|
|
Returns : integer |
223
|
|
|
|
|
|
|
Args : none |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=cut |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
sub num_rows{ |
229
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
230
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head2 num_columns |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Title : num_columns |
237
|
|
|
|
|
|
|
Usage : my $colcount = $matrix->num_columns |
238
|
|
|
|
|
|
|
Function: Get the number of columns |
239
|
|
|
|
|
|
|
Returns : integer |
240
|
|
|
|
|
|
|
Args : none |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub num_columns{ |
246
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
247
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
# inverse? |
252
|
|
|
|
|
|
|
=head2 reverse |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Title : reverse |
255
|
|
|
|
|
|
|
Usage : my $matrix = $matrix->reverse |
256
|
|
|
|
|
|
|
Function: Get the reverse of a matrix |
257
|
|
|
|
|
|
|
Returns : |
258
|
|
|
|
|
|
|
Args : |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=cut |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
sub reverse{ |
264
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
265
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=head2 row_names |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
Title : row_names |
271
|
|
|
|
|
|
|
Usage : my @rows = $matrix->row_names |
272
|
|
|
|
|
|
|
Function: The names of all the rows |
273
|
|
|
|
|
|
|
Returns : array in array context, arrayref in scalar context |
274
|
|
|
|
|
|
|
Args : none |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=cut |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub row_names{ |
280
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
281
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=head2 column_names |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
Title : column_names |
288
|
|
|
|
|
|
|
Usage : my @columns = $matrix->column_names |
289
|
|
|
|
|
|
|
Function: The names of all the columns |
290
|
|
|
|
|
|
|
Returns : array in array context, arrayref in scalar context |
291
|
|
|
|
|
|
|
Args : none |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=cut |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
sub column_names{ |
297
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
298
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
1; |