// $Id: CodonInfo.java,v 1.1 2006/05/20 17:02:03 Sasha Buzko Exp $ // // Copyright (c) 2000-2002 San Diego Supercomputer Center (SDSC), // a facility operated jointly by the University of California, // San Diego (UCSD) and General Atomics, San Diego, California, USA. // // Users and possessors of this source code are hereby granted a // nonexclusive, royalty-free copyright and design patent license to // use this code in individual software. License is not granted for // commercial resale, in whole or in part, without prior written // permission from SDSC. This source is provided "AS IS" without express // or implied warranty of any kind. // // For further information, please see: http://mbt.sdsc.edu // // History: // $Log: CodonInfo.java,v $ // Revision 1.1 2006/05/20 17:02:03 Sasha Buzko // Updated version // // Revision 1.1 2006/04/30 20:13:59 Sasha Buzko // New version of the app // // Revision 1.1 2006/04/15 19:42:27 Sasha Buzko // Initial commit // // Revision 1.1 2005/11/13 04:35:05 Administrator // *** empty log message *** // // Revision 1.1.1.1 2002/07/16 18:00:21 moreland // Imported sources // // Revision 1.0 2002/06/10 23:38:39 moreland // package edu.sdsc.mbt.util; /** * Provides static information about mRNA Codons such nucleic acid tuple * / amino acid code mapping. *

* @see edu.sdsc.mbt.Residue * @see edu.sdsc.mbt.util.AminoAcidInfo * @see edu.sdsc.mbt.util.NucleicAcidInfo *

* @author John L. Moreland */ public class CodonInfo { /** * A 2D storage array for nucleic acid tuple / amino acid code mapping. *

* codons[0][][] is the 1st letter of the nucleic acid codon 3-tuple. * codons[][0][] is the 2nd letter of the nucleic acid codon 3-tuple. * codons[][][0] is the 3rd letter of the nucleic acid codon 3-tuple. * codons[i][j][k] is the amino acid character code. */ private static final String codons[][][] = { // 1st letter = U { // 2nd letter = U { "F", "F", "L", "L" }, // 3rd letter = U, C, A, G // 2nd letter = C { "S", "S", "S", "S" }, // 3rd letter = U, C, A, G // 2nd letter = A { "Y", "Y", ".", "." }, // 3rd letter = U, C, A, G // 2nd letter = G { "C", "C", ".", "W" } // 3rd letter = U, C, A, G }, // 1st letter = C { // 2nd letter = U { "L", "L", "L", "L" }, // 3rd letter = U, C, A, G // 2nd letter = C { "P", "P", "P", "P" }, // 3rd letter = U, C, A, G // 2nd letter = A { "H", "H", "Q", "Q" }, // 3rd letter = U, C, A, G // 2nd letter = G { "R", "R", "R", "R" } // 3rd letter = U, C, A, G }, // 1st letter = A { // 2nd letter = U { "I", "I", "I", "I" }, // 3rd letter = U, C, A, G // 2nd letter = C { "T", "T", "T", "T" }, // 3rd letter = U, C, A, G // 2nd letter = A { "B", "B", "K", "K" }, // 3rd letter = U, C, A, G // 2nd letter = G { "S", "S", "R", "R" } // 3rd letter = U, C, A, G }, // 1st letter = G { // 2nd letter = U { "V", "V", "V", "V" }, // 3rd letter = U, C, A, G // 2nd letter = C { "A", "A", "A", "A" }, // 3rd letter = U, C, A, G // 2nd letter = A { "D", "D", "E", "E" }, // 3rd letter = U, C, A, G // 2nd letter = G { "G", "G", "G", "G" } // 3rd letter = U, C, A, G } }; private static final int getBaseIndex( char letter ) { if ( letter == 'U' ) return 0; if ( letter == 'C' ) return 1; if ( letter == 'A' ) return 2; if ( letter == 'G' ) return 3; return -1; } private static final String letters[] = { "U", "C", "A", "G" }; private static final String getBaseLetter( int index ) { if ( index < 0 ) return null; if ( index > letters.length ) return null; return letters[index]; } /** * Returns the number of codon/amino-acid tuples in the database. *

*/ public static int getCodonCount( ) { return 64; // There are 64 3-tuple mRNA codons. } /** * Returns the amino acid letter code for the given 3-letter codon * tuple. *

*/ public static String getAminoAcidLetter( String codon ) { if ( codon == null ) return null; int i = getBaseIndex( codon.charAt(0) ); int j = getBaseIndex( codon.charAt(1) ); int k = getBaseIndex( codon.charAt(2) ); if ( (i < 0) || (j < 0) || (k < 0) ) return null; if ( i >= codons.length ) return null; if ( j >= codons[i].length ) return null; if ( k >= codons[i][j].length ) return null; return codons[i][j][k]; } /** * Returns the amino acid letter code for the given 3-letter codon * tuple. *

*/ public static String getAminoAcidLetter( String letter1, String letter2, String letter3 ) { if ( letter1 == null ) return null; if ( letter2 == null ) return null; if ( letter3 == null ) return null; int i = getBaseIndex( letter1.charAt(0) ); int j = getBaseIndex( letter2.charAt(0) ); int k = getBaseIndex( letter3.charAt(0) ); if ( (i < 0) || (j < 0) || (k < 0) ) return null; if ( i >= codons.length ) return null; if ( j >= codons[i].length ) return null; if ( k >= codons[i][j].length ) return null; return codons[i][j][k]; } }