File Coverage

Bio/Matrix/Mlagan.pm
Criterion Covered Total %
statement 19 23 82.6
branch 4 4 100.0
condition 2 4 50.0
subroutine 5 9 55.5
pod 7 7 100.0
total 37 47 78.7


line stmt bran cond sub pod time code
1             #
2             # BioPerl module for Bio::Matrix::Mlagan
3             #
4             # Please direct questions and support issues to
5             #
6             # Cared for by Sendu Bala
7             #
8             # Copyright Sendu Bala
9             #
10             # You may distribute this module under the same terms as perl itself
11              
12             # POD documentation - main docs before the code
13              
14             =head1 NAME
15              
16             Bio::Matrix::Mlagan - A generic matrix with mlagan fields
17              
18             =head1 SYNOPSIS
19              
20             # See L for most methods.
21             # These are relevant for mlagan IO:
22             $matrix->gap_open(-400);
23             $matrix->gap_continue(-25);
24              
25             =head1 DESCRIPTION
26              
27             This is based on Bio::Matrix::Generic, differing by storing gap_open and
28             gap_continue data members to allow mlagan IO (see Bio::Matrix::IO::mlagan).
29             (Those values are 'outside' the matrix.)
30              
31             It also limits the structure to a 6x6 matrix with row & column names 'A', 'C',
32             'G', 'T', '.' and 'N'.
33              
34             =head1 FEEDBACK
35              
36             =head2 Mailing Lists
37              
38             User feedback is an integral part of the evolution of this and other
39             Bioperl modules. Send your comments and suggestions preferably to
40             the Bioperl mailing list. Your participation is much appreciated.
41              
42             bioperl-l@bioperl.org - General discussion
43             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
44              
45             =head2 Support
46              
47             Please direct usage questions or support issues to the mailing list:
48              
49             I
50              
51             rather than to the module maintainer directly. Many experienced and
52             reponsive experts will be able look at the problem and quickly
53             address it. Please include a thorough description of the problem
54             with code and data examples if at all possible.
55              
56             =head2 Reporting Bugs
57              
58             Report bugs to the Bioperl bug tracking system to help us keep track
59             of the bugs and their resolution. Bug reports can be submitted via the
60             web:
61              
62             https://github.com/bioperl/bioperl-live/issues
63              
64             =head1 AUTHOR - Sendu Bala
65              
66             Email bix@sendu.me.uk
67              
68             =head1 APPENDIX
69              
70             The rest of the documentation details each of the object methods.
71             Internal methods are usually preceded with a _
72              
73             =cut
74              
75             package Bio::Matrix::Mlagan;
76 1     1   3 use strict;
  1         1  
  1         28  
77              
78 1     1   3 use base qw(Bio::Matrix::Generic);
  1         1  
  1         254  
79              
80              
81             =head2 new
82              
83             Title : new
84             Usage : my $obj = Bio::Matrix::Generic->new();
85             Function: Builds a new Bio::Matrix::Generic object
86             Returns : an instance of Bio::Matrix::Generic
87             Args : -values => arrayref of arrayrefs of data initialization
88             -matrix_id => id of the matrix
89             -matrix_name => name of the matrix
90             -matrix_init_value => default value to initialize empty cells
91             -gap_open => gap open penalty (int)
92             -gap_continue => gap continue penalty (int)
93              
94             NB: -rownames and -colnames should not be given here, since they are
95             always being set to 'A', 'C', 'G', 'T', '.' and 'N'.
96              
97             =cut
98              
99             sub new {
100 2     2 1 3 my($class, @args) = @_;
101 2         11 my %args = (@args, -rownames => [qw(A C G T . N)],
102             -colnames => [qw(A C G T . N)]);
103 2         10 my $self = $class->SUPER::new(%args);
104            
105 2         11 $self->_set_from_args(\@args, -methods => [qw(gap_open gap_continue)]);
106            
107 2         7 return $self;
108             }
109              
110             =head2 gap_open
111              
112             Title : gap_open
113             Usage : $obj->gap_open(-400);
114             Function: Get/set the gap open amount.
115             Returns : int
116             Args : none to get, OR int to set
117              
118             =cut
119              
120             sub gap_open {
121 6     6 1 6 my $self = shift;
122 6 100       12 if (@_) { $self->{gap_open} = shift }
  3         4  
123 6   50     19 return $self->{gap_open} || return;
124             }
125              
126             =head2 gap_continue
127              
128             Title : gap_continue
129             Usage : $obj->gap_continue(-25);
130             Function: Get/set the gap continue amount.
131             Returns : int
132             Args : none to get, OR int to set
133              
134             =cut
135              
136             sub gap_continue {
137 6     6 1 6 my $self = shift;
138 6 100       9 if (@_) { $self->{gap_continue} = shift }
  3         5  
139 6   50     23 return $self->{gap_continue} || return;
140             }
141              
142             =head2 add_row
143              
144             Title : add_row
145             Usage : Do not use
146             Function: This generic method is not suitable for mlagan, where the number of
147             rows is fixed.
148             Returns : Warning
149             Args : none
150              
151             =cut
152              
153             sub add_row {
154 0     0 1   shift->warn("Mlagan matricies are fixed at 6x6");
155             }
156              
157             =head2 remove_row
158              
159             Title : remove_row
160             Usage : Do not use
161             Function: This generic method is not suitable for mlagan, where the number of
162             rows is fixed.
163             Returns : Warning
164             Args : none
165              
166             =cut
167              
168             sub remove_row {
169 0     0 1   shift->warn("Mlagan matricies are fixed at 6x6");
170             }
171              
172             =head2 add_column
173              
174             Title : add_column
175             Usage : Do not use
176             Function: This generic method is not suitable for mlagan, where the number of
177             columns is fixed.
178             Returns : Warning
179             Args : none
180              
181             =cut
182              
183             sub add_column {
184 0     0 1   shift->warn("Mlagan matricies are fixed at 6x6");
185             }
186              
187             =head2 remove_column
188              
189             Title : remove_column
190             Usage : Do not use
191             Function: This generic method is not suitable for mlagan, where the number of
192             columns is fixed.
193             Returns : Warning
194             Args : none
195              
196             =cut
197              
198             sub remove_column {
199 0     0 1   shift->warn("Mlagan matricies are fixed at 6x6");
200             }
201              
202             1;