remove comment
[bioperl-live.git] / Bio / Symbol / DNAAlphabet.pm
blob32327c0037d23b23002ba9bb97810ceda2ea3394
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
14 =head1 NAME
16 Bio::Symbol::DNAAlphabet - A ready made DNA alphabet
18 =head1 SYNOPSIS
20 use Bio::Symbol::DNAAlphabet;
21 my $alpha = Bio::Symbol::DNAAlphabet->new();
22 foreach my $symbol ( $alpha->symbols ) {
23 print "symbol is $symbol\n";
26 =head1 DESCRIPTION
28 This object builds an Alphabet with DNA symbols.
30 =head1 FEEDBACK
32 =head2 Mailing Lists
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
41 =head2 Support
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.
52 =head2 Reporting Bugs
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
56 web:
58 https://redmine.open-bio.org/projects/bioperl/
60 =head1 AUTHOR - Jason Stajich
62 Email jason@bioperl.org
64 =head1 APPENDIX
66 The rest of the documentation details each of the object methods.
67 Internal methods are usually preceded with a _
69 =cut
72 # Let the code begin...
75 package Bio::Symbol::DNAAlphabet;
76 use strict;
78 use Bio::Symbol::Symbol;
79 use Bio::Tools::IUPAC;
81 use base qw(Bio::Symbol::Alphabet);
83 =head2 new
85 Title : new
86 Usage : my $obj = Bio::Symbol::DNAAlphabet->new();
87 Function: Builds a new Bio::Symbol::DNAAlphabet object
88 Returns : Bio::Symbol::DNAAlphabet
89 Args :
92 =cut
94 sub new {
95 my($class,@args) = @_;
96 my $self = $class->SUPER::new(@args);
97 my %alphabet = Bio::Tools::IUPAC::iupac_iub();
98 my %symbols;
99 foreach my $let ( keys %alphabet ) {
100 next unless @{$alphabet{$let}} == 1 || $let eq 'U';
101 $symbols{$let} = Bio::Symbol::Symbol->new(-name => $let,
102 -token => $let);
105 foreach my $let ( keys %alphabet ) {
106 next if( $symbols{$let} || $let eq 'U');
107 my @subsymbols;
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,
114 -token => $let,
115 -matches => $alpha,
116 -symbols => \@subsymbols);
119 $self->symbols(values %symbols);
120 return $self;