1
#$Id: OddCodes.pm,v 1.9 2001/11/20 02:09:40 lstein Exp $
1
#$Id: OddCodes.pm,v 1.13 2003/05/17 19:03:57 heikki Exp $
2
2
#-----------------------------------------------------------------------------
3
3
# PACKAGE : OddCodes.pm
4
4
# PURPOSE : To write amino acid sequences in alternative alphabets
5
5
# AUTHOR : Derek Gatherer (D.Gatherer@organon.nhe.akzonobel.nl)
7
7
# CREATED : 8th July 2000
9
# DISCLAIMER : I am employed in the pharmaceutical industry but my
9
# DISCLAIMER : I am employed in the pharmaceutical industry but my
10
10
# : employers do not endorse or sponsor this module
11
11
# : in any way whatsoever. The above email address is
12
12
# : given purely for the purpose of easy communication
13
13
# : with the author, and does not imply any connection
14
14
# : between my employers and anything written below.
15
# LICENCE : You may distribute this module under the same terms
15
# LICENCE : You may distribute this module under the same terms
16
16
# : as the rest of BioPerl.
17
17
#----------------------------------------------------------------------------
21
Bio::Tools::OddCodes - Object holding alternative alphabet coding for
21
Bio::Tools::OddCodes - Object holding alternative alphabet coding for
22
22
one protein sequence
26
Take a sequence object from eg, an inputstream, and creates an object
27
for the purposes of rewriting that sequence in another alphabet.
28
These are abbreviated amino acid sequence alphabets, designed to
29
simplify the statistical aspects of analysing protein sequences, by
30
reducing the combinatorial explosion of the 20-letter alphabet. These
31
abbreviated alphabets range in size from 2 to 8.
33
Creating the OddCodes object, eg:
35
my $inputstream = Bio::SeqIO->new( '-file' => "seqfile",
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
34
# Creating the OddCodes object, eg:
36
my $inputstream = Bio::SeqIO->new( '-file' => "seqfile",
36
37
'-format' => 'Fasta');
37
38
my $seqobj = $inputstream->next_seq();
38
39
my $oddcode_obj = Bio::Tools::Oddcodes->new(-seq => $seqobj);
42
43
my $seqobj = Bio::PrimarySeq->new
43
(-seq=>'[cut and paste a sequence here]',
44
-alphabet = 'protein',
44
(-seq=>'[cut and paste a sequence here]',
45
-alphabet => 'protein',
46
47
my $oddcode_obj = Bio::Tools::OddCodes->new(-seq => $seqobj);
48
do the alternative coding, returning the answer as a reference to a string
49
# do the alternative coding, returning the answer as a reference to
50
52
my $output = $oddcode_obj->structural();
51
53
my $output = $oddcode_obj->chemical();
173
179
=head2 functional
175
181
Title : functional
176
Usage : $output = $oddcode_obj->functional();
182
Usage : $output = $oddcode_obj->functional();
177
183
Function: turns amino acid sequence into 4-letter functional alphabet
178
184
: A (acidic), C (basic), H (hydrophobic), P (polar)
179
Example : a sequence ACDEFGH will become HPAAHHC
185
Example : a sequence ACDEFGH will become HPAAHHC
180
186
Returns : Reference to the new sequence string
341
347
=head2 chemical()
344
Usage : $output = $oddcode_obj->chemical();
350
Usage : $output = $oddcode_obj->chemical();
345
351
Function: turns amino acid sequence into 8-letter chemical alphabet
346
352
: A (acidic), L (aliphatic), M (amide), R (aromatic)
347
353
: C (basic), H (hydroxyl), I (imino), S (sulphur)
348
Example : a sequence ACDEFGH will become LSAARAC
354
Example : a sequence ACDEFGH will become LSAARAC
349
355
Returns : Reference to the new sequence string
420
426
my $seqobj = $self->{'_seqref'};
422
unless ($seqobj->isa("Bio::PrimarySeqI"))
428
unless ($seqobj->isa("Bio::PrimarySeqI"))
424
430
die("die, OddCodes works only on PrimarySeqI objects\n");
432
$self->warn("\tAll OddCode alphabets need a protein sequence,\n".
433
"\tbut BioPerl thinks this is not: [". $seqobj->id. "]")
434
unless $seqobj->alphabet eq 'protein' or $self->verbose < 0;;
427
436
my $seqstring = uc $seqobj->seq();