Use /usr/bin/perl instead of env even on examples
[bioperl-live.git] / lib / Bio / Matrix / Mlagan.pm
blob31a5a458bd5a6f1ea85fe43151621c20a8c8aa3b
2 # BioPerl module for Bio::Matrix::Mlagan
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Sendu Bala <bix@sendu.me.uk>
8 # Copyright Sendu Bala
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::Matrix::Mlagan - A generic matrix with mlagan fields
18 =head1 SYNOPSIS
20 # See L<Bio::Matrix::Generic> for most methods.
21 # These are relevant for mlagan IO:
22 $matrix->gap_open(-400);
23 $matrix->gap_continue(-25);
25 =head1 DESCRIPTION
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.)
31 It also limits the structure to a 6x6 matrix with row & column names 'A', 'C',
32 'G', 'T', '.' and 'N'.
34 =head1 FEEDBACK
36 =head2 Mailing Lists
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.
42 bioperl-l@bioperl.org - General discussion
43 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
45 =head2 Support
47 Please direct usage questions or support issues to the mailing list:
49 I<bioperl-l@bioperl.org>
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.
56 =head2 Reporting Bugs
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:
62 https://github.com/bioperl/bioperl-live/issues
64 =head1 AUTHOR - Sendu Bala
66 Email bix@sendu.me.uk
68 =head1 APPENDIX
70 The rest of the documentation details each of the object methods.
71 Internal methods are usually preceded with a _
73 =cut
75 package Bio::Matrix::Mlagan;
76 use strict;
78 use base qw(Bio::Matrix::Generic);
81 =head2 new
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)
94 NB: -rownames and -colnames should not be given here, since they are
95 always being set to 'A', 'C', 'G', 'T', '.' and 'N'.
97 =cut
99 sub new {
100 my($class, @args) = @_;
101 my %args = (@args, -rownames => [qw(A C G T . N)],
102 -colnames => [qw(A C G T . N)]);
103 my $self = $class->SUPER::new(%args);
105 $self->_set_from_args(\@args, -methods => [qw(gap_open gap_continue)]);
107 return $self;
110 =head2 gap_open
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
118 =cut
120 sub gap_open {
121 my $self = shift;
122 if (@_) { $self->{gap_open} = shift }
123 return $self->{gap_open} || return;
126 =head2 gap_continue
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
134 =cut
136 sub gap_continue {
137 my $self = shift;
138 if (@_) { $self->{gap_continue} = shift }
139 return $self->{gap_continue} || return;
142 =head2 add_row
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
151 =cut
153 sub add_row {
154 shift->warn("Mlagan matricies are fixed at 6x6");
157 =head2 remove_row
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
166 =cut
168 sub remove_row {
169 shift->warn("Mlagan matricies are fixed at 6x6");
172 =head2 add_column
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
181 =cut
183 sub add_column {
184 shift->warn("Mlagan matricies are fixed at 6x6");
187 =head2 remove_column
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
196 =cut
198 sub remove_column {
199 shift->warn("Mlagan matricies are fixed at 6x6");