Mercurial > repos > mahtabm > ensemb_rep_gvl
comparison variant_effect_predictor/Bio/Symbol/ProteinAlphabet.pm @ 0:2bc9b66ada89 draft default tip
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 06:29:17 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:2bc9b66ada89 |
---|---|
1 # $Id: ProteinAlphabet.pm,v 1.3 2002/10/22 07:45:21 lapp Exp $ | |
2 # | |
3 # BioPerl module for Bio::Symbol::ProteinAlphabet | |
4 # | |
5 # Cared for by Jason Stajich <jason@bioperl.org> | |
6 # | |
7 # Copyright Jason Stajich | |
8 # | |
9 # You may distribute this module under the same terms as perl itself | |
10 | |
11 # POD documentation - main docs before the code | |
12 | |
13 =head1 NAME | |
14 | |
15 Bio::Symbol::ProteinAlphabet - A ready made Protein alphabet | |
16 | |
17 =head1 SYNOPSIS | |
18 | |
19 use Bio::Symbol::ProteinAlphabet; | |
20 my $alpha = new Bio::Symbol::ProteinAlphabet(); | |
21 foreach my $symbol ( $alpha->symbols ) { | |
22 print "symbol is $symbol\n"; | |
23 } | |
24 | |
25 =head1 DESCRIPTION | |
26 | |
27 This object builds an Alphabet with Protein symbols. | |
28 | |
29 =head1 FEEDBACK | |
30 | |
31 =head2 Mailing Lists | |
32 | |
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. | |
36 | |
37 bioperl-l@bioperl.org - General discussion | |
38 http://bioperl.org/MailList.shtml - About the mailing lists | |
39 | |
40 =head2 Reporting Bugs | |
41 | |
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 | |
44 email or the web: | |
45 | |
46 bioperl-bugs@bioperl.org | |
47 http://bugzilla.bioperl.org/ | |
48 | |
49 =head1 AUTHOR - Jason Stajich | |
50 | |
51 Email jason@bioperl.org | |
52 | |
53 Describe contact details here | |
54 | |
55 =head1 CONTRIBUTORS | |
56 | |
57 Additional contributors names and emails here | |
58 | |
59 =head1 APPENDIX | |
60 | |
61 The rest of the documentation details each of the object methods. | |
62 Internal methods are usually preceded with a _ | |
63 | |
64 =cut | |
65 | |
66 | |
67 # Let the code begin... | |
68 | |
69 | |
70 package Bio::Symbol::ProteinAlphabet; | |
71 use vars qw(@ISA); | |
72 use strict; | |
73 | |
74 use Bio::Symbol::Alphabet; | |
75 use Bio::Symbol::Symbol; | |
76 use Bio::Tools::IUPAC; | |
77 use Bio::SeqUtils; | |
78 | |
79 @ISA = qw(Bio::Symbol::Alphabet); | |
80 | |
81 =head2 new | |
82 | |
83 Title : new | |
84 Usage : my $obj = new Bio::Symbol::ProteinAlphabet(); | |
85 Function: Builds a new Bio::Symbol::ProteinAlphabet object | |
86 Returns : Bio::Symbol::ProteinAlphabet | |
87 Args : | |
88 | |
89 | |
90 =cut | |
91 | |
92 sub new { | |
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(); | |
97 my %symbols; | |
98 my @left; | |
99 | |
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}, | |
104 -token => $let); | |
105 } | |
106 foreach my $l ( @left ) { | |
107 my @subsym; | |
108 foreach my $sym ( @{$codes{$l}} ) { | |
109 push @subsym, $symbols{$sym}; | |
110 } | |
111 my $alpha = new Bio::Symbol::Alphabet(-symbols => \@subsym); | |
112 $symbols{$l} = new Bio::Symbol::Symbol(-name => $aa{$l}, | |
113 -token => $l, | |
114 -matches => $alpha, | |
115 -symbols => \@subsym); | |
116 } | |
117 | |
118 $self->symbols(values %symbols); | |
119 return $self; | |
120 } | |
121 | |
122 | |
123 1; |