| 1 | #$Id$ | ||||||||||||||||||||||||||||||||||||||||||
| 2 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # PACKAGE : OddCodes.pm | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # PURPOSE : To write amino acid sequences in alternative alphabets | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # AUTHOR : Derek Gatherer (D.Gatherer@organon.nhe.akzonobel.nl) | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # SOURCE : | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # CREATED : 8th July 2000 | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # MODIFIED : | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # DISCLAIMER : I am employed in the pharmaceutical industry but my | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # : employers do not endorse or sponsor this module | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # : in any way whatsoever. The above email address is | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # : given purely for the purpose of easy communication | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # : with the author, and does not imply any connection | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # : between my employers and anything written below. | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # LICENCE : You may distribute this module under the same terms | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # : as the rest of BioPerl. | ||||||||||||||||||||||||||||||||||||||||||
| 17 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | Bio::Tools::OddCodes - Object holding alternative alphabet coding for | ||||||||||||||||||||||||||||||||||||||||||
| 22 | one protein sequence | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | # Take a sequence object from eg, an inputstream, and creates an | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # object for the purposes of rewriting that sequence in another | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # alphabet. These are abbreviated amino acid sequence alphabets, | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # designed to simplify the statistical aspects of analysing protein | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # sequences, by reducing the combinatorial explosion of the | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # 20-letter alphabet. These abbreviated alphabets range in size | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # from 2 to 8. | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | # Creating the OddCodes object, eg: | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | my $inputstream = Bio::SeqIO->new( '-file' => "seqfile", | ||||||||||||||||||||||||||||||||||||||||||
| 37 | '-format' => 'Fasta'); | ||||||||||||||||||||||||||||||||||||||||||
| 38 | my $seqobj = $inputstream->next_seq(); | ||||||||||||||||||||||||||||||||||||||||||
| 39 | my $oddcode_obj = Bio::Tools::Oddcodes->new(-seq => $seqobj); | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | # or: | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | my $seqobj = Bio::PrimarySeq->new | ||||||||||||||||||||||||||||||||||||||||||
| 44 | (-seq=>'[cut and paste a sequence here]', | ||||||||||||||||||||||||||||||||||||||||||
| 45 | -alphabet => 'protein', | ||||||||||||||||||||||||||||||||||||||||||
| 46 | -id => 'test'); | ||||||||||||||||||||||||||||||||||||||||||
| 47 | my $oddcode_obj = Bio::Tools::OddCodes->new(-seq => $seqobj); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | # do the alternative coding, returning the answer as a reference to | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # a string | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | my $output = $oddcode_obj->structural(); | ||||||||||||||||||||||||||||||||||||||||||
| 53 | my $output = $oddcode_obj->chemical(); | ||||||||||||||||||||||||||||||||||||||||||
| 54 | my $output = $oddcode_obj->functional(); | ||||||||||||||||||||||||||||||||||||||||||
| 55 | my $output = $oddcode_obj->charge(); | ||||||||||||||||||||||||||||||||||||||||||
| 56 | my $output = $oddcode_obj->hydrophobic(); | ||||||||||||||||||||||||||||||||||||||||||
| 57 | my $output = $oddcode_obj->Dayhoff(); | ||||||||||||||||||||||||||||||||||||||||||
| 58 | my $output = $oddcode_obj->Sneath(); | ||||||||||||||||||||||||||||||||||||||||||
| 59 | my $output = $oddcode_obj->Stanfel(); | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | # display sequence in new form, eg: | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | my $new_coding = $$output; | ||||||||||||||||||||||||||||||||||||||||||
| 65 | print "\n$new_coding"; | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | Bio::Tools::Oddcodes is a welterweight object for rewriting a protein | ||||||||||||||||||||||||||||||||||||||||||
| 70 | sequence in an alternative alphabet. Eight of these are provided, ranging | ||||||||||||||||||||||||||||||||||||||||||
| 71 | from the the 2-letter hydrophobic alphabet, to the 8-letter chemical | ||||||||||||||||||||||||||||||||||||||||||
| 72 | alphabet. These are useful for the statistical analysis of protein | ||||||||||||||||||||||||||||||||||||||||||
| 73 | sequences since they can partially avoid the combinatorial explosion | ||||||||||||||||||||||||||||||||||||||||||
| 74 | produced by the full 20-letter alphabet (eg. 400 dimers, 8000 trimers | ||||||||||||||||||||||||||||||||||||||||||
| 75 | etc.) | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | The objects will print out a warning if the input sequence is not a | ||||||||||||||||||||||||||||||||||||||||||
| 78 | protein. If you know what you are doing, you can silence the warning | ||||||||||||||||||||||||||||||||||||||||||
| 79 | by setting verbose() to a negative value. | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | See SYNOPSIS above for object creation code. | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | =head1 REFERENCES | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | Stanfel LE (1996) A new approach to clustering the amino acids. J. theor. | ||||||||||||||||||||||||||||||||||||||||||
| 86 | Biol. 183, 195-205. | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | Karlin S, Ost F and Blaisdell BE (1989) Patterns in DNA and amino acid | ||||||||||||||||||||||||||||||||||||||||||
| 89 | sequences and their statistical significance. Chapter 6 of: Mathematical | ||||||||||||||||||||||||||||||||||||||||||
| 90 | Methods for DNA Sequences. Waterman MS (ed.) CRC Press, Boca Raton , FL. | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||
| 97 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||||||||||||||||||||||||||||||||||
| 98 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 101 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 110 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 111 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 112 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 117 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||
| 118 | web: | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | Derek Gatherer | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||
| 129 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | package Bio::Tools::OddCodes; | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 2 | $Bio::Tools::OddCodes::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 2 | ▶ | use base qw(Bio::Root::Root); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | sub new | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=19.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | my($class,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 1 | my ($seqobj) = $self->_rearrange([qw(SEQ)],@args); | |||||||||||||||||||||||||||||||||||||||||
| 147 | 1 | ▶ | if((! defined($seqobj)) && @args && ref($args[0])) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $seqobj and @args and ref $args[0]
not defined $seqobj and @args
MC/DC0%0/3
not defined $seqobj and @args and ref $args[0]
not defined $seqobj
@args
ref $args[0]
Truth table25%1/4
not(A) and B and C
A= not defined $seqobjB= @argsC= ref $args[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | # parameter not passed as named parameter? | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $seqobj = $args[0]; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 1 | ▶ | unless ($seqobj->isa("Bio::PrimarySeqI")) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | { | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $self->throw("Bio::Tools::OddCodes only works on PrimarySeqI objects"); | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 1 | $self->{'_seqref'} = $seqobj; | |||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | =head2 structural | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | Title : structural | ||||||||||||||||||||||||||||||||||||||||||
| 164 | Usage : $output = $oddcode_obj->structural(); | ||||||||||||||||||||||||||||||||||||||||||
| 165 | Function: turns amino acid sequence into 3-letter structural alphabet | ||||||||||||||||||||||||||||||||||||||||||
| 166 | : A (ambivalent), E (external), I (internal) | ||||||||||||||||||||||||||||||||||||||||||
| 167 | Example : a sequence ACDEFGH will become AAEEIAE | ||||||||||||||||||||||||||||||||||||||||||
| 168 | Returns : Reference to the new sequence string | ||||||||||||||||||||||||||||||||||||||||||
| 169 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | sub structural() | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
structural: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | my $seqstring = &_pullseq($self); # see _pullseq() below | |||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | # now the real business | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | $seqstring =~ tr/[ACGPSTWY]/1/; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | $seqstring =~ tr/[RNDQEHK]/2/; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | $seqstring =~ tr/[ILMFV]/3/; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | $seqstring =~ tr/1/A/; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | $seqstring =~ tr/2/E/; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | $seqstring =~ tr/3/I/; | |||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | return \$seqstring; | |||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | # and that's that one | ||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | =head2 functional | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | Title : functional | ||||||||||||||||||||||||||||||||||||||||||
| 195 | Usage : $output = $oddcode_obj->functional(); | ||||||||||||||||||||||||||||||||||||||||||
| 196 | Function: turns amino acid sequence into 4-letter functional alphabet | ||||||||||||||||||||||||||||||||||||||||||
| 197 | : A (acidic), C (basic), H (hydrophobic), P (polar) | ||||||||||||||||||||||||||||||||||||||||||
| 198 | Example : a sequence ACDEFGH will become HPAAHHC | ||||||||||||||||||||||||||||||||||||||||||
| 199 | Returns : Reference to the new sequence string | ||||||||||||||||||||||||||||||||||||||||||
| 200 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | sub functional() | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
functional: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 1 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | my $seqstring = &_pullseq($self); | |||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | # now the real business | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | $seqstring =~ tr/[DE]/1/; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 1 | $seqstring =~ tr/[HKR]/2/; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 1 | $seqstring =~ tr/[AFILMPVW]/3/; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 1 | $seqstring =~ tr/[CGNQSTY]/4/; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 1 | $seqstring =~ tr/1/A/; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 1 | $seqstring =~ tr/2/C/; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 1 | $seqstring =~ tr/3/H/; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 1 | $seqstring =~ tr/4/P/; | |||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | return \$seqstring; | |||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | # and that's that one | ||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | =head2 hydrophobic | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | Title : hydrophobic | ||||||||||||||||||||||||||||||||||||||||||
| 228 | Usage : $output = $oddcode_obj->hydrophobic(); | ||||||||||||||||||||||||||||||||||||||||||
| 229 | Function: turns amino acid sequence into 2-letter hydrophobicity alphabet | ||||||||||||||||||||||||||||||||||||||||||
| 230 | : O (hydrophobic), I (hydrophilic) | ||||||||||||||||||||||||||||||||||||||||||
| 231 | Example : a sequence ACDEFGH will become OIIIOII | ||||||||||||||||||||||||||||||||||||||||||
| 232 | Returns : Reference to the new sequence string | ||||||||||||||||||||||||||||||||||||||||||
| 233 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | sub hydrophobic() | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hydrophobic: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 1 | my $seqstring = &_pullseq($self); | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | # now the real business | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | $seqstring =~ tr/[AFILMPVW]/1/; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | $seqstring =~ tr/[CDEGHKNQRSTY]/2/; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | $seqstring =~ tr/1/I/; | |||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | $seqstring =~ tr/2/O/; | |||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 1 | return \$seqstring; | |||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | # and that's that one | ||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | =head2 Dayhoff | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | Title : Dayhoff | ||||||||||||||||||||||||||||||||||||||||||
| 257 | Usage : $output = $oddcode_obj->Dayhoff(); | ||||||||||||||||||||||||||||||||||||||||||
| 258 | Function: turns amino acid sequence into 6-letter Dayhoff alphabet | ||||||||||||||||||||||||||||||||||||||||||
| 259 | Example : a sequence ACDEFGH will become CADDGCE | ||||||||||||||||||||||||||||||||||||||||||
| 260 | : A (=C), C (=AGPST), D (=DENQ), | ||||||||||||||||||||||||||||||||||||||||||
| 261 | : E (=HKR), F (=ILMV), G (=FWY) | ||||||||||||||||||||||||||||||||||||||||||
| 262 | Returns : Reference to the new sequence string | ||||||||||||||||||||||||||||||||||||||||||
| 263 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | sub Dayhoff() | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Dayhoff: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | my $seqstring = &_pullseq($self); | |||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | # now the real business | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | $seqstring =~ tr/[C]/1/; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | $seqstring =~ tr/[AGPST]/2/; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | $seqstring =~ tr/[DENQ]/3/; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 1 | $seqstring =~ tr/[HKR]/4/; | |||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | $seqstring =~ tr/[ILMV]/5/; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | $seqstring =~ tr/[FWY]/6/; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 1 | $seqstring =~ tr/1/A/; | |||||||||||||||||||||||||||||||||||||||||
| 281 | 1 | $seqstring =~ tr/2/C/; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 1 | $seqstring =~ tr/3/D/; | |||||||||||||||||||||||||||||||||||||||||
| 283 | 1 | $seqstring =~ tr/4/E/; | |||||||||||||||||||||||||||||||||||||||||
| 284 | 1 | $seqstring =~ tr/5/F/; | |||||||||||||||||||||||||||||||||||||||||
| 285 | 1 | $seqstring =~ tr/6/G/; | |||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 1 | return \$seqstring; | |||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | # and that's that one | ||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | =head2 Sneath | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | Title : Sneath | ||||||||||||||||||||||||||||||||||||||||||
| 295 | Usage : $output = $oddcode_obj->Sneath(); | ||||||||||||||||||||||||||||||||||||||||||
| 296 | Function: turns amino acid sequence into 7-letter Sneath alphabet | ||||||||||||||||||||||||||||||||||||||||||
| 297 | Example : a sequence ACDEFGH will become CEFFHCF | ||||||||||||||||||||||||||||||||||||||||||
| 298 | : A (=ILV), C (=AGP), D (=MNQ), E (=CST), | ||||||||||||||||||||||||||||||||||||||||||
| 299 | : F (=DE), G (=KR), H (=FHWY) | ||||||||||||||||||||||||||||||||||||||||||
| 300 | Returns : Reference to the new sequence string | ||||||||||||||||||||||||||||||||||||||||||
| 301 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | sub Sneath() | ||||||||||||||||||||||||||||||||||||||||||
| 306 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Sneath: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 1 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 308 | 1 | my $seqstring = &_pullseq($self); | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | # now the real business | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 1 | $seqstring =~ tr/[ILV]/1/; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | $seqstring =~ tr/[AGP]/2/; | |||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | $seqstring =~ tr/[MNQ]/3/; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | $seqstring =~ tr/[CST]/4/; | |||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | $seqstring =~ tr/[DE]/5/; | |||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | $seqstring =~ tr/[KR]/6/; | |||||||||||||||||||||||||||||||||||||||||
| 318 | 1 | $seqstring =~ tr/[FHWY]/7/; | |||||||||||||||||||||||||||||||||||||||||
| 319 | 1 | $seqstring =~ tr/1/A/; | |||||||||||||||||||||||||||||||||||||||||
| 320 | 1 | $seqstring =~ tr/2/C/; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 1 | $seqstring =~ tr/3/D/; | |||||||||||||||||||||||||||||||||||||||||
| 322 | 1 | $seqstring =~ tr/4/E/; | |||||||||||||||||||||||||||||||||||||||||
| 323 | 1 | $seqstring =~ tr/5/F/; | |||||||||||||||||||||||||||||||||||||||||
| 324 | 1 | $seqstring =~ tr/6/G/; | |||||||||||||||||||||||||||||||||||||||||
| 325 | 1 | $seqstring =~ tr/7/H/; | |||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 1 | return \$seqstring; | |||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | # and that's that one | ||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | =head2 Stanfel | ||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | Title : Stanfel | ||||||||||||||||||||||||||||||||||||||||||
| 335 | Usage : $output = $oddcode_obj->Stanfel(); | ||||||||||||||||||||||||||||||||||||||||||
| 336 | Function: turns amino acid sequence into 4-letter Stanfel alphabet | ||||||||||||||||||||||||||||||||||||||||||
| 337 | Example : a sequence ACDEFGH will become AACCDAE | ||||||||||||||||||||||||||||||||||||||||||
| 338 | : A (=ACGILMPSTV), C (=DENQ), D (=FWY), E (=HKR) | ||||||||||||||||||||||||||||||||||||||||||
| 339 | Returns : Reference to the new sequence string | ||||||||||||||||||||||||||||||||||||||||||
| 340 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | sub Stanfel() | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Stanfel: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 1 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 347 | 1 | my $seqstring = &_pullseq($self); | |||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | # now the real business | ||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | 1 | $seqstring =~ tr/[ACGILMPSTV]/1/; | |||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | $seqstring =~ tr/[DENQ]/2/; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 1 | $seqstring =~ tr/[FWY]/3/; | |||||||||||||||||||||||||||||||||||||||||
| 354 | 1 | $seqstring =~ tr/[HKR]/4/; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | $seqstring =~ tr/1/A/; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 1 | $seqstring =~ tr/2/C/; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 1 | $seqstring =~ tr/3/D/; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 1 | $seqstring =~ tr/4/E/; | |||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 1 | return \$seqstring; | |||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | # and that's that one | ||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | =head2 chemical | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | Title : chemical | ||||||||||||||||||||||||||||||||||||||||||
| 368 | Usage : $output = $oddcode_obj->chemical(); | ||||||||||||||||||||||||||||||||||||||||||
| 369 | Function: turns amino acid sequence into 8-letter chemical alphabet | ||||||||||||||||||||||||||||||||||||||||||
| 370 | : A (acidic), L (aliphatic), M (amide), R (aromatic) | ||||||||||||||||||||||||||||||||||||||||||
| 371 | : C (basic), H (hydroxyl), I (imino), S (sulphur) | ||||||||||||||||||||||||||||||||||||||||||
| 372 | Example : a sequence ACDEFGH will become LSAARAC | ||||||||||||||||||||||||||||||||||||||||||
| 373 | Returns : Reference to the new sequence string | ||||||||||||||||||||||||||||||||||||||||||
| 374 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | sub chemical() | ||||||||||||||||||||||||||||||||||||||||||
| 379 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chemical: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 1 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 381 | 1 | my $seqstring = &_pullseq($self); | |||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | # now the real business | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 1 | $seqstring =~ tr/[DE]/1/; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 1 | $seqstring =~ tr/[AGILV]/2/; | |||||||||||||||||||||||||||||||||||||||||
| 387 | 1 | $seqstring =~ tr/[NQ]/3/; | |||||||||||||||||||||||||||||||||||||||||
| 388 | 1 | $seqstring =~ tr/[FWY]/4/; | |||||||||||||||||||||||||||||||||||||||||
| 389 | 1 | $seqstring =~ tr/[RHK]/5/; | |||||||||||||||||||||||||||||||||||||||||
| 390 | 1 | $seqstring =~ tr/[ST]/6/; | |||||||||||||||||||||||||||||||||||||||||
| 391 | 1 | $seqstring =~ tr/P/7/; | |||||||||||||||||||||||||||||||||||||||||
| 392 | 1 | $seqstring =~ tr/[CM]/8/; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 1 | $seqstring =~ tr/1/A/; | |||||||||||||||||||||||||||||||||||||||||
| 394 | 1 | $seqstring =~ tr/2/L/; | |||||||||||||||||||||||||||||||||||||||||
| 395 | 1 | $seqstring =~ tr/3/M/; | |||||||||||||||||||||||||||||||||||||||||
| 396 | 1 | $seqstring =~ tr/4/R/; | |||||||||||||||||||||||||||||||||||||||||
| 397 | 1 | $seqstring =~ tr/5/C/; | |||||||||||||||||||||||||||||||||||||||||
| 398 | 1 | $seqstring =~ tr/6/H/; | |||||||||||||||||||||||||||||||||||||||||
| 399 | 1 | $seqstring =~ tr/7/I/; | |||||||||||||||||||||||||||||||||||||||||
| 400 | 1 | $seqstring =~ tr/8/S/; | |||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | 1 | return \$seqstring; | |||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | # and that's that one | ||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | =head2 charge | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | Title : charge | ||||||||||||||||||||||||||||||||||||||||||
| 410 | Usage : $output = $oddcode_obj->charge(); | ||||||||||||||||||||||||||||||||||||||||||
| 411 | Function: turns amino acid sequence into 3-letter charge alphabet | ||||||||||||||||||||||||||||||||||||||||||
| 412 | Example : a sequence ACDEFGH will become NNAANNC | ||||||||||||||||||||||||||||||||||||||||||
| 413 | : A (negative; NOT anode), C (positive; NOT cathode), N (neutral) | ||||||||||||||||||||||||||||||||||||||||||
| 414 | Returns : Reference to the new sequence string | ||||||||||||||||||||||||||||||||||||||||||
| 415 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | sub charge() | ||||||||||||||||||||||||||||||||||||||||||
| 420 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
charge: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 1 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 422 | 1 | my $seqstring = &_pullseq($self); | |||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | # now the real business | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | 1 | $seqstring =~ tr/[DE]/1/; | |||||||||||||||||||||||||||||||||||||||||
| 427 | 1 | $seqstring =~ tr/[HKR]/2/; | |||||||||||||||||||||||||||||||||||||||||
| 428 | 1 | $seqstring =~ tr/[ACFGILMNPQSTVWY]/3/; | |||||||||||||||||||||||||||||||||||||||||
| 429 | 1 | $seqstring =~ tr/1/A/; | |||||||||||||||||||||||||||||||||||||||||
| 430 | 1 | $seqstring =~ tr/2/C/; | |||||||||||||||||||||||||||||||||||||||||
| 431 | 1 | $seqstring =~ tr/3/N/; | |||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | 1 | return \$seqstring; | |||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | # and that's that one | ||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | # _pullseq is called within each of the subroutines | ||||||||||||||||||||||||||||||||||||||||||
| 439 | # it just checks a few things and returns the sequence | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | sub _pullseq | ||||||||||||||||||||||||||||||||||||||||||
| 442 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pullseq: called CC=5 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | 8 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 8 | my $seqobj = $self->{'_seqref'}; | |||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | 8 | ▶ | unless ($seqobj->isa("Bio::PrimarySeqI")) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | { | ||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | $self->throw("die, OddCodes works only on PrimarySeqI objects\n"); | |||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||
| 451 | 8 | ▶ | $self->warn("\tAll OddCode alphabets need a protein sequence,\n". | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$seqobj->alphabet eq "protein" or $self->verbose < 0
MC/DC0%0/2
$seqobj->alphabet eq "protein" or $self->verbose < 0
$seqobj->alphabet eq "protein"
$self->verbose < 0
Truth table33%1/3
A or B
A= $seqobj->alphabet eq "protein"B= $self->verbose < 0
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | "\tbut BioPerl thinks this is not: [". $seqobj->id. "]") | ||||||||||||||||||||||||||||||||||||||||||
| 453 | unless $seqobj->alphabet eq 'protein' or $self->verbose < 0;; | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | 8 | my $seqstring = uc $seqobj->seq(); | |||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 8 | ▶ | if(length($seqstring)<1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | { | ||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | $self->throw("$seqstring: die, sequence has zero length\n"); | |||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | 8 | return $seqstring; | |||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||