[Bio] / FigKernelPackages / NCBI_genetic_code.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/NCBI_genetic_code.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Fri Nov 23 21:47:55 2007 UTC revision 1.2, Fri Nov 23 21:59:40 2007 UTC
# Line 1  Line 1 
1    #
2    # Copyright (c) 2003-2007 University of Chicago and Fellowship
3    # for Interpretations of Genomes. All Rights Reserved.
4    #
5    # This file is part of the SEED Toolkit.
6    #
7    # The SEED Toolkit is free software. You can redistribute
8    # it and/or modify it under the terms of the SEED Toolkit
9    # Public License.
10    #
11    # You should have received a copy of the SEED Toolkit Public License
12    # along with this program; if not write to the University of Chicago
13    # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14    # Genomes at veronika@thefig.info or download a copy from
15    # http://www.theseed.org/LICENSE.TXT.
16    #
17    
18  package NCBI_genetic_code;  package NCBI_genetic_code;
19    
20  #  #
21  #  Access to the numbered genetic codes used by NCBI.  A code is returned  #  Access to the numbered genetic codes used by NCBI.  A code is returned
22  #  as a reference to a hash that has both uppercase and lowercase translations.  #  as a reference to a hash that has both uppercase and lowercase translations.
23  #  #
24  #  There are two access methods: by hash element and by subroutine:  #  There are two access methods: by hash element and by subroutine:
25  #  #
26  #   \%genetic_code_n = $NCBI_genetic_code::NCBI_code{ $n };  #   \%genetic_code_n = $NCBI_genetic_code::genetic_code{ $n };
27  #  #
28  #   \%genetic_code_n =  NCBI_genetic_code::NCBI_code( $n );  #   \%genetic_code_n =  NCBI_genetic_code::genetic_code( $n );
29  #  #
30  #  The only difference in behaviour is that the subroutine defaults to code  #  The only difference in behaviour is that the subroutine defaults to code
31  #  number 1 when no parameter is supplied:  #  number 1 when no parameter is supplied:
32  #  #
33  #   \%genetic_code_1 =  NCBI_genetic_code::NCBI_code();  #   \%genetic_code_1 =  NCBI_genetic_code::genetic_code();
34  #  #
35  #  All other invalid numbers return an undefined value.  #  All other invalid numbers return an undefined value.
36  #  #
# Line 30  Line 48 
48    
49  my $code_num;  my $code_num;
50    
51  our %NCBI_code = map { my @aas = split //, $_->[1];  our %genetic_code = map { my @aas = split //, $_->[1];
52                         $_->[0] => { map { @$_, map { lc } @$_ }   # uc and lc                         $_->[0] => { map { @$_, map { lc } @$_ }   # uc and lc
53                                      map { [ $_ => shift @aas ] }  # assignments                                         map { [ $_ => shift @aas ] }  # assignment
54                                      @triplets                     # codons                                      @triplets                     # codons
55                                    }                                    }
56                       }                       }
# Line 179  Line 197 
197    
198  End_of_Codes  End_of_Codes
199    
200  sub NCBI_code { $NCBI_code{ $_[0] || '1' } }  sub genetic_code { $genetic_code{ $_[0] || '1' } }
201    
202  1;  1;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3