3 # BioPerl module for Bio::Symbol::ProteinAlphabet
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Jason Stajich <jason@bioperl.org>
9 # Copyright Jason Stajich
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
17 Bio::Symbol::ProteinAlphabet - A ready made Protein alphabet
21 use Bio::Symbol::ProteinAlphabet;
22 my $alpha = Bio::Symbol::ProteinAlphabet->new();
23 foreach my $symbol ( $alpha->symbols ) {
24 print "symbol is $symbol\n";
29 This object builds an Alphabet with Protein symbols.
35 User feedback is an integral part of the evolution of this and other
36 Bioperl modules. Send your comments and suggestions preferably to
37 the Bioperl mailing list. Your participation is much appreciated.
39 bioperl-l@bioperl.org - General discussion
40 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
44 Please direct usage questions or support issues to the mailing list:
46 L<bioperl-l@bioperl.org>
48 rather than to the module maintainer directly. Many experienced and
49 reponsive experts will be able look at the problem and quickly
50 address it. Please include a thorough description of the problem
51 with code and data examples if at all possible.
55 Report bugs to the Bioperl bug tracking system to help us keep track
56 of the bugs and their resolution. Bug reports can be submitted via the
59 http://bugzilla.open-bio.org/
61 =head1 AUTHOR - Jason Stajich
63 Email jason@bioperl.org
67 The rest of the documentation details each of the object methods.
68 Internal methods are usually preceded with a _
73 # Let the code begin...
76 package Bio
::Symbol
::ProteinAlphabet
;
79 use Bio
::Symbol
::Symbol
;
80 use Bio
::Tools
::IUPAC
;
83 use base
qw(Bio::Symbol::Alphabet);
88 Usage : my $obj = Bio::Symbol::ProteinAlphabet->new();
89 Function: Builds a new Bio::Symbol::ProteinAlphabet object
90 Returns : Bio::Symbol::ProteinAlphabet
97 my($class,@args) = @_;
98 my $self = $class->SUPER::new
(@args);
99 my %aa = Bio
::SeqUtils
->valid_aa(2);
100 my %codes = Bio
::Tools
::IUPAC
->iupac_iup();
104 foreach my $let ( keys %codes ) {
105 if( scalar @
{$codes{$let}} != 1) { push @left, $let; next; }
106 $symbols{$let} = Bio
::Symbol
::Symbol
->new(-name
=> $aa{$let},
109 foreach my $l ( @left ) {
111 foreach my $sym ( @
{$codes{$l}} ) {
112 push @subsym, $symbols{$sym};
114 my $alpha = Bio
::Symbol
::Alphabet
->new(-symbols
=> \
@subsym);
115 $symbols{$l} = Bio
::Symbol
::Symbol
->new(-name
=> $aa{$l},
118 -symbols
=> \
@subsym);
121 $self->symbols(values %symbols);