2 # BioPerl module for Bio::Symbol::DNAAlphabet
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::DNAAlphabet - A ready made DNA alphabet
20 use Bio::Symbol::DNAAlphabet;
21 my $alpha = Bio::Symbol::DNAAlphabet->new();
22 foreach my $symbol ( $alpha->symbols ) {
23 print "symbol is $symbol\n";
28 This object builds an Alphabet with DNA 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
::DNAAlphabet
;
78 use Bio
::Symbol
::Symbol
;
79 use Bio
::Tools
::IUPAC
;
81 use base
qw(Bio::Symbol::Alphabet);
86 Usage : my $obj = Bio::Symbol::DNAAlphabet->new();
87 Function: Builds a new Bio::Symbol::DNAAlphabet object
88 Returns : Bio::Symbol::DNAAlphabet
95 my($class,@args) = @_;
96 my $self = $class->SUPER::new
(@args);
97 my %alphabet = Bio
::Tools
::IUPAC
::iupac_iub
();
99 foreach my $let ( keys %alphabet ) {
100 next unless @
{$alphabet{$let}} == 1 || $let eq 'U';
101 $symbols{$let} = Bio
::Symbol
::Symbol
->new(-name
=> $let,
105 foreach my $let ( keys %alphabet ) {
106 next if( $symbols{$let} || $let eq 'U');
109 foreach my $sublet ( @
{$alphabet{$let}} ) {
110 push @subsymbols, $symbols{$sublet};
112 my $alpha = Bio
::Symbol
::Alphabet
->new(-symbols
=> \
@subsymbols);
113 $symbols{$let} = Bio
::Symbol
::Symbol
->new(-name
=> $let,
116 -symbols
=> \
@subsymbols);
119 $self->symbols(values %symbols);