Class GeneticCode


  • public final class GeneticCode
    extends java.lang.Object
    A set of standard genetic codes.
    Version:
    $Id: GeneticCode.java 1044 2009-12-09 03:33:54Z stevensh $
    Author:
    Andrew Rambaut, Alexei Drummond
    • Field Detail

      • VERTEBRATE_MT

        public static final GeneticCode VERTEBRATE_MT
      • MOLD_PROTOZOAN_MT

        public static final GeneticCode MOLD_PROTOZOAN_MT
      • MYCOPLASMA

        public static final GeneticCode MYCOPLASMA
      • INVERTEBRATE_MT

        public static final GeneticCode INVERTEBRATE_MT
      • ECHINODERM_MT

        public static final GeneticCode ECHINODERM_MT
      • EUPLOTID_NUC

        public static final GeneticCode EUPLOTID_NUC
      • ASCIDIAN_MT

        public static final GeneticCode ASCIDIAN_MT
      • FLATWORM_MT

        public static final GeneticCode FLATWORM_MT
      • BLEPHARISMA_NUC

        public static final GeneticCode BLEPHARISMA_NUC
      • GENETIC_CODES

        @Deprecated
        public static final GeneticCode[] GENETIC_CODES
        Deprecated.
        use getGeneticCodes() instead
        Use of this field is deprecated because being an array it is mutable, i.e. an attacker could potentially replace values in this array.
    • Method Detail

      • getGeneticCodes

        public static java.lang.Iterable<GeneticCode> getGeneticCodes()
        Returns an iterable that allows you to iterate over all the standard genetic codes
        Returns:
        An iterable over the genetic codes
      • getGeneticCodesArray

        public static GeneticCode[] getGeneticCodesArray()
      • valueOf

        public static GeneticCode valueOf​(java.lang.String name)
        Parameters:
        name - the name of the genetic code
        Returns:
        the genetic code such that getDescription() equals name
      • valueOf

        public static GeneticCode valueOf​(int NCBITranslationTableNumber)
        Parameters:
        NCBITranslationTableNumber - the name of the genetic code
        Returns:
        the genetic code such that getNcbiTranslationTableNumber() equals NCBITranslationTableNumber
      • getName

        public java.lang.String getName()
        Returns the name of the genetic code
        Returns:
        the name of this genetic code
      • getDescription

        public java.lang.String getDescription()
        Returns the description of the genetic code
        Returns:
        the description of this genetic code
      • getCodeTable

        public java.lang.String getCodeTable()
        Returns a length-64 string that for each nucleotide triplet contains the single-character amino acid code (see AminoAcids to which that triplet is translated in this genetic code.
        Returns:
        the string passed to the constructor as the codeTable argument.
      • getTranslation

        public AminoAcidState getTranslation​(CodonState codonState)
        Returns the state associated with AminoAcid represented by codonState. Note that the state is the canonical state (generated combinatorially)
        Returns:
        '?' if codon unknown
        See Also:
        AminoAcids, Codons
      • getTranslation

        public AminoAcidState getTranslation​(NucleotideState nucleotide1,
                                             NucleotideState nucleotide2,
                                             NucleotideState nucleotide3)
        Returns the state associated with AminoAcid represented by the three nucleotides. If one or more of the nucleotides are ambiguous, and all combinations translate to the same protein, then this method will return that protein
        Returns:
        '?' if codon unknown
        See Also:
        AminoAcids, Codons
      • getTranslation

        public AminoAcidState getTranslation​(java.lang.String nucleotides)
        Returns the state associated with AminoAcid represented by the three nucleotides. If one or more of the nucleotides are ambiguous, and all combinations translate to the same protein, then this method will return that protein
        Parameters:
        nucleotides - a string consisting of exactly 3 residues in any case.
        Returns:
        '?' if codon unknown
        See Also:
        AminoAcids, Codons
      • isStartCodonString

        public MaybeBoolean isStartCodonString​(java.lang.String tripletString)
                                        throws java.lang.IllegalArgumentException
        Checks whether all possible disambiguations of a given nucleotide triplet string represents a start codon.
        Parameters:
        tripletString - A string of length 3, with each character representing one nucleotide or ambiguity symbol
        Returns:
        Whether all possible disambiguations of tripletString represent a start codon.
        Throws:
        java.lang.IllegalArgumentException - if tripletString doesn't consist of 3 nucleotide or ambiguity symbols
        java.lang.NullPointerException - if tripletString is null
      • isStartCodon

        @Deprecated
        public boolean isStartCodon​(CodonState codonState)
        Deprecated.
        As of 2007-07-30, CodonStates exist only for nonambiguous nucleotide triplets. Therefore, this method cannot be used to check if an ambiguous triplet of nucleotides codes for a transcription, start and therefore this method is deprecated.
        Parameters:
        codonState -
        Returns:
        True if the specified codonState codes for a transcription start under this genetic code.
      • isStopCodon

        @Deprecated
        public boolean isStopCodon​(CodonState codonState)
        Deprecated.
        As of 2007-07-30, CodonStates exist only for nonambiguous nucleotide triplets. Therefore, this method cannot be used to check if an ambiguous triplet of nucleotides codes for a stop, and therefore this method is deprecated.
        Parameters:
        codonState -
        Returns:
        True if the specified codonState codes for a stop under this genetic code.
      • isStopCodonString

        public MaybeBoolean isStopCodonString​(java.lang.String tripletString)
                                       throws java.lang.IllegalArgumentException
        Checks whether a given String represents a stop codon.
        Parameters:
        tripletString - A string of length 3, with each character representing one nucleotide or ambiguity symbol
        Returns:
        true if tripletString represents a stop codon.
        Throws:
        java.lang.IllegalArgumentException - if tripletString doesn't consist of 3 nucleotide or ambiguity symbols
        java.lang.NullPointerException - if tripletString is null
      • getCodonsForAminoAcid

        public java.util.Set<CodonState> getCodonsForAminoAcid​(AminoAcidState aminoAcidState)
        Returns:
        all the possible codons for a given amino acid
      • getStartCodons

        public java.util.Set<CodonState> getStartCodons()
        Returns:
        the codon states of starts
      • getStopCodons

        public java.util.Set<CodonState> getStopCodons()
        Returns:
        the codon states of stops.
      • getStopCodonCount

        public int getStopCodonCount()
        Returns the number of terminator amino acids.
      • getNcbiTranslationTableNumber

        public int getNcbiTranslationTableNumber()
        Returns:
        the number used by NCBI to represent this genetic code or -1 if none. Eg. 1 = Standard...
      • toString

        public java.lang.String toString()
        Same as getDescription() (so that GeneticCode objects can be used e.g. in a JComboBox).
        Overrides:
        toString in class java.lang.Object
        Returns:
        the description of this genetic code