1
# $Id: ProteinAlphabet.pm,v 1.2 2001/12/13 23:09:52 jason Exp $
3
# BioPerl module for Bio::Symbol::ProteinAlphabet
5
# Cared for by Jason Stajich <jason@bioperl.org>
7
# Copyright Jason Stajich
9
# You may distribute this module under the same terms as perl itself
11
# POD documentation - main docs before the code
15
Bio::Symbol::ProteinAlphabet - A ready made Protein alphabet
19
use Bio::Symbol::ProteinAlphabet;
20
my $alpha = new Bio::Symbol::ProteinAlphabet();
21
foreach my $symbol ( $alpha->symbols ) {
22
print "symbol is $symbol\n";
27
This object builds an Alphabet with Protein symbols.
33
User feedback is an integral part of the evolution of this and other
34
Bioperl modules. Send your comments and suggestions preferably to
35
the Bioperl mailing list. Your participation is much appreciated.
37
bioperl-l@bioperl.org - General discussion
38
http://bioperl.org/MailList.shtml - About the mailing lists
42
Report bugs to the Bioperl bug tracking system to help us keep track
43
of the bugs and their resolution. Bug reports can be submitted via
46
bioperl-bugs@bioperl.org
47
http://bioperl.org/bioperl-bugs/
49
=head1 AUTHOR - Jason Stajich
51
Email jason@bioperl.org
53
Describe contact details here
57
Additional contributors names and emails here
61
The rest of the documentation details each of the object methods.
62
Internal methods are usually preceded with a _
67
# Let the code begin...
70
package Bio::Symbol::ProteinAlphabet;
74
use Bio::Symbol::Alphabet;
75
use Bio::Symbol::Symbol;
76
use Bio::Tools::IUPAC;
79
@ISA = qw(Bio::Symbol::Alphabet);
84
Usage : my $obj = new Bio::Symbol::ProteinAlphabet();
85
Function: Builds a new Bio::Symbol::ProteinAlphabet object
86
Returns : Bio::Symbol::ProteinAlphabet
93
my($class,@args) = @_;
94
my $self = $class->SUPER::new(@args);
95
my %aa = Bio::SeqUtils->valid_aa(2);
96
my %codes = Bio::Tools::IUPAC->iupac_iup();
100
foreach my $let ( keys %codes ) {
101
next if( $let eq 'U');
102
if( scalar @{$codes{$let}} != 1) { push @left, $let; next; }
103
$symbols{$let} = new Bio::Symbol::Symbol(-name => $aa{$let},
106
foreach my $l ( @left ) {
108
foreach my $sym ( @{$codes{$l}} ) {
109
push @subsym, $symbols{$sym};
111
my $alpha = new Bio::Symbol::Alphabet(-symbols => \@subsym);
112
$symbols{$l} = new Bio::Symbol::Symbol(-name => $aa{$l},
115
-symbols => \@subsym);
118
$self->symbols(values %symbols);