| 1 | # | ||||||||||||
| 2 | # BioPerl module for Bio::Matrix::Mlagan | ||||||||||||
| 3 | # | ||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||
| 5 | # | ||||||||||||
| 6 | # Cared for by Sendu Bala <bix@sendu.me.uk> | ||||||||||||
| 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<Bio::Matrix::Generic> 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<bioperl-l@bioperl.org> | ||||||||||||
| 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 | 3 | $Bio::Matrix::Mlagan::VERSION = '1.7.8'; | |||||||||||
| 77 | 3 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 78 | |||||||||||||
| 79 | 3 | ▶ | use base qw(Bio::Matrix::Generic); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 80 | |||||||||||||
| 81 | |||||||||||||
| 82 | =head2 new | ||||||||||||
| 83 | |||||||||||||
| 84 | Title : new | ||||||||||||
| 85 | Usage : my $obj = Bio::Matrix::Generic->new(); | ||||||||||||
| 86 | Function: Builds a new Bio::Matrix::Generic object | ||||||||||||
| 87 | Returns : an instance of Bio::Matrix::Generic | ||||||||||||
| 88 | Args : -values => arrayref of arrayrefs of data initialization | ||||||||||||
| 89 | -matrix_id => id of the matrix | ||||||||||||
| 90 | -matrix_name => name of the matrix | ||||||||||||
| 91 | -matrix_init_value => default value to initialize empty cells | ||||||||||||
| 92 | -gap_open => gap open penalty (int) | ||||||||||||
| 93 | -gap_continue => gap continue penalty (int) | ||||||||||||
| 94 | |||||||||||||
| 95 | NB: -rownames and -colnames should not be given here, since they are | ||||||||||||
| 96 | always being set to 'A', 'C', 'G', 'T', '.' and 'N'. | ||||||||||||
| 97 | |||||||||||||
| 98 | =cut | ||||||||||||
| 99 | |||||||||||||
| 100 | 2 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 101 | 2 | my($class, @args) = @_; | |||||||||||
| 102 | 2 | my %args = (@args, -rownames => [qw(A C G T . N)], | |||||||||||
| 103 | -colnames => [qw(A C G T . N)]); | ||||||||||||
| 104 | 2 | my $self = $class->SUPER::new(%args); | |||||||||||
| 105 | |||||||||||||
| 106 | 2 | $self->_set_from_args(\@args, -methods => [qw(gap_open gap_continue)]); | |||||||||||
| 107 | |||||||||||||
| 108 | 2 | return $self; | |||||||||||
| 109 | } | ||||||||||||
| 110 | |||||||||||||
| 111 | =head2 gap_open | ||||||||||||
| 112 | |||||||||||||
| 113 | Title : gap_open | ||||||||||||
| 114 | Usage : $obj->gap_open(-400); | ||||||||||||
| 115 | Function: Get/set the gap open amount. | ||||||||||||
| 116 | Returns : int | ||||||||||||
| 117 | Args : none to get, OR int to set | ||||||||||||
| 118 | |||||||||||||
| 119 | =cut | ||||||||||||
| 120 | |||||||||||||
| 121 | 6 | ▶ | sub gap_open { | ||||||||||
|
Subroutine
gap_open: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 122 | 6 | my $self = shift; | |||||||||||
| 123 | 6 | ▶ | if (@_) { $self->{gap_open} = shift } | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 124 | 6 | ▶ | return $self->{gap_open} || return; | ||||||||||
|
Condition50%1/2
$self->{'gap_open'} || (return)
MC/DC0%0/1
$self->{'gap_open'} || (return)
$self->{'gap_open'}
Truth table50%1/2
A
A= $self->{'gap_open'}
| |||||||||||||
| 125 | } | ||||||||||||
| 126 | |||||||||||||
| 127 | =head2 gap_continue | ||||||||||||
| 128 | |||||||||||||
| 129 | Title : gap_continue | ||||||||||||
| 130 | Usage : $obj->gap_continue(-25); | ||||||||||||
| 131 | Function: Get/set the gap continue amount. | ||||||||||||
| 132 | Returns : int | ||||||||||||
| 133 | Args : none to get, OR int to set | ||||||||||||
| 134 | |||||||||||||
| 135 | =cut | ||||||||||||
| 136 | |||||||||||||
| 137 | 6 | ▶ | sub gap_continue { | ||||||||||
|
Subroutine
gap_continue: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 138 | 6 | my $self = shift; | |||||||||||
| 139 | 6 | ▶ | if (@_) { $self->{gap_continue} = shift } | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 140 | 6 | ▶ | return $self->{gap_continue} || return; | ||||||||||
|
Condition50%1/2
$self->{'gap_continue'} || (return)
MC/DC0%0/1
$self->{'gap_continue'} || (return)
$self->{'gap_continue'}
Truth table50%1/2
A
A= $self->{'gap_continue'}
| |||||||||||||
| 141 | } | ||||||||||||
| 142 | |||||||||||||
| 143 | =head2 add_row | ||||||||||||
| 144 | |||||||||||||
| 145 | Title : add_row | ||||||||||||
| 146 | Usage : Do not use | ||||||||||||
| 147 | Function: This generic method is not suitable for mlagan, where the number of | ||||||||||||
| 148 | rows is fixed. | ||||||||||||
| 149 | Returns : Warning | ||||||||||||
| 150 | Args : none | ||||||||||||
| 151 | |||||||||||||
| 152 | =cut | ||||||||||||
| 153 | |||||||||||||
| 154 | 0 | ▶ | sub add_row { | ||||||||||
|
Subroutine
add_row: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 155 | 0 | shift->warn("Mlagan matricies are fixed at 6x6"); | |||||||||||
| 156 | } | ||||||||||||
| 157 | |||||||||||||
| 158 | =head2 remove_row | ||||||||||||
| 159 | |||||||||||||
| 160 | Title : remove_row | ||||||||||||
| 161 | Usage : Do not use | ||||||||||||
| 162 | Function: This generic method is not suitable for mlagan, where the number of | ||||||||||||
| 163 | rows is fixed. | ||||||||||||
| 164 | Returns : Warning | ||||||||||||
| 165 | Args : none | ||||||||||||
| 166 | |||||||||||||
| 167 | =cut | ||||||||||||
| 168 | |||||||||||||
| 169 | 0 | ▶ | sub remove_row { | ||||||||||
|
Subroutine
remove_row: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 170 | 0 | shift->warn("Mlagan matricies are fixed at 6x6"); | |||||||||||
| 171 | } | ||||||||||||
| 172 | |||||||||||||
| 173 | =head2 add_column | ||||||||||||
| 174 | |||||||||||||
| 175 | Title : add_column | ||||||||||||
| 176 | Usage : Do not use | ||||||||||||
| 177 | Function: This generic method is not suitable for mlagan, where the number of | ||||||||||||
| 178 | columns is fixed. | ||||||||||||
| 179 | Returns : Warning | ||||||||||||
| 180 | Args : none | ||||||||||||
| 181 | |||||||||||||
| 182 | =cut | ||||||||||||
| 183 | |||||||||||||
| 184 | 0 | ▶ | sub add_column { | ||||||||||
|
Subroutine
add_column: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 185 | 0 | shift->warn("Mlagan matricies are fixed at 6x6"); | |||||||||||
| 186 | } | ||||||||||||
| 187 | |||||||||||||
| 188 | =head2 remove_column | ||||||||||||
| 189 | |||||||||||||
| 190 | Title : remove_column | ||||||||||||
| 191 | Usage : Do not use | ||||||||||||
| 192 | Function: This generic method is not suitable for mlagan, where the number of | ||||||||||||
| 193 | columns is fixed. | ||||||||||||
| 194 | Returns : Warning | ||||||||||||
| 195 | Args : none | ||||||||||||
| 196 | |||||||||||||
| 197 | =cut | ||||||||||||
| 198 | |||||||||||||
| 199 | 0 | ▶ | sub remove_column { | ||||||||||
|
Subroutine
remove_column: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 200 | 0 | shift->warn("Mlagan matricies are fixed at 6x6"); | |||||||||||
| 201 | } | ||||||||||||
| 202 | |||||||||||||
| 203 | 3 | 1; | |||||||||||