2 # BioPerl module for Bio::Symbol::ProteinAlphabet
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Jason Stajich <jason@bioperl.org>
8 # Copyright Jason Stajich
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::Symbol::ProteinAlphabet - A ready made Protein alphabet
20 use Bio::Symbol::ProteinAlphabet;
21 my $alpha = Bio::Symbol::ProteinAlphabet->new();
22 foreach my $symbol ( $alpha->symbols ) {
23 print "symbol is $symbol\n";
28 This object builds an Alphabet with Protein symbols.
34 User feedback is an integral part of the evolution of this and other
35 Bioperl modules. Send your comments and suggestions preferably to
36 the Bioperl mailing list. Your participation is much appreciated.
38 bioperl-l@bioperl.org - General discussion
39 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
43 Please direct usage questions or support issues to the mailing list:
45 I<bioperl-l@bioperl.org>
47 rather than to the module maintainer directly. Many experienced and
48 reponsive experts will be able look at the problem and quickly
49 address it. Please include a thorough description of the problem
50 with code and data examples if at all possible.
54 Report bugs to the Bioperl bug tracking system to help us keep track
55 of the bugs and their resolution. Bug reports can be submitted via the
58 https://github.com/bioperl/bioperl-live/issues
60 =head1 AUTHOR - Jason Stajich
62 Email jason@bioperl.org
66 The rest of the documentation details each of the object methods.
67 Internal methods are usually preceded with a _
72 # Let the code begin...
75 package Bio
::Symbol
::ProteinAlphabet
;
78 use Bio
::Symbol
::Symbol
;
79 use Bio
::Tools
::IUPAC
;
82 use base
qw(Bio::Symbol::Alphabet);
87 Usage : my $obj = Bio::Symbol::ProteinAlphabet->new();
88 Function: Builds a new Bio::Symbol::ProteinAlphabet object
89 Returns : Bio::Symbol::ProteinAlphabet
96 my($class,@args) = @_;
97 my $self = $class->SUPER::new
(@args);
98 my %aa = Bio
::SeqUtils
->valid_aa(2);
99 my %codes = Bio
::Tools
::IUPAC
->iupac_iup();
103 foreach my $let ( keys %codes ) {
104 if( scalar @
{$codes{$let}} != 1) { push @left, $let; next; }
105 $symbols{$let} = Bio
::Symbol
::Symbol
->new(-name
=> $aa{$let},
108 foreach my $l ( @left ) {
110 foreach my $sym ( @
{$codes{$l}} ) {
111 push @subsym, $symbols{$sym};
113 my $alpha = Bio
::Symbol
::Alphabet
->new(-symbols
=> \
@subsym);
114 $symbols{$l} = Bio
::Symbol
::Symbol
->new(-name
=> $aa{$l},
117 -symbols
=> \
@subsym);
120 $self->symbols(values %symbols);