Class RNATools


  • public final class RNATools
    extends Object
    Useful functionality for processing DNA and RNA sequences.
    Author:
    Matthew Pocock, Keith James (docs), Thomas Down, Greg Cox, Mark Schreiber, David Huen (refactoring), gwaldon (update genetic code translation tables)
    • Method Detail

      • getRNA

        public static FiniteAlphabet getRNA()
        Return the RNA alphabet.
        Returns:
        a flyweight version of the RNA alphabet
      • getCodonAlphabet

        public static FiniteAlphabet getCodonAlphabet()
        Gets the (RNA x RNA x RNA) Alphabet
        Returns:
        a flyweight version of the (RNA x RNA x RNA) alphabet
      • index

        public static int index​(Symbol sym)
                         throws IllegalSymbolException
        Return an integer index for a symbol - compatible with forIndex.

        The index for a symbol is stable across virtual machines & invocations.

        Parameters:
        sym - the Symbol to index
        Returns:
        the index for that symbol
        Throws:
        IllegalSymbolException - if sym is not a member of the DNA alphabet
      • forIndex

        public static Symbol forIndex​(int index)
                               throws IndexOutOfBoundsException
        Return the symbol for an index - compatible with index.

        The index for a symbol is stable accross virtual machines & invocations.

        Parameters:
        index - the index to look up
        Returns:
        the symbol at that index
        Throws:
        IndexOutOfBoundsException - if index is not between 0 and 3
      • transcribe

        public static SymbolList transcribe​(SymbolList list)
                                     throws IllegalAlphabetException
        Deprecated.
        The naming of this method is confusing and inconsistent use either DNATools.toRNA(SymbolList list) or DNATools.transcribeToRNA(SymbolList list) depending on the desired behaivour.
        Transcribe DNA into RNA.
        Parameters:
        list - the SymbolList to transcribe
        Returns:
        a SymbolList that is the transcribed view
        Throws:
        IllegalAlphabetException - if the list is not DNA
      • getGeneticCode

        public static ManyToOneTranslationTable getGeneticCode​(String name)
        Retrieve a TranslationTable by name. The valid names are:
        • "UNIVERSAL"
        • "VERTEBRATE_MITOCHONDRIAL"
        • "YEAST_MITOCHONDRIAL"
        • "MOLD_MITOCHONDRIAL"
        • "INVERTEBRATE_MITOCHONDRIAL"
        • "CILIATE_NUCLEAR"
        • "ECHINODERM_MITOCHONDRIAL"
        • "EUPLOTID_NUCLEAR"
        • "BACTERIAL"
        • "ALTERNATIVE_YEAST_NUCLEAR"
        • "ASCIDIAN_MITOCHONDRIAL"
        • "FLATWORM_MITOCHONDRIAL"
        • "BLEPHARISMA_MACRONUCLEAR"
        • "CHLOROPHYCEAN_MITOCHONDRIAL"
        • "TREMATODE_MITOCHONDRIAL"
        • "SCENEDESMUS_MITOCHONDRIAL"
        There are public static final fields in the TranslationTable interface which contain these values. One of these should be used as the argument for this method.

        You can now get the reverse translation of the residue back to its (usually several) codons too.

        Since:
        1.1
      • getGeneticCode

        public static ManyToOneTranslationTable getGeneticCode​(int table_num)
        Retrieve a TranslationTable by number. These numbers correspond to the transl_table qualifier in the DDBJ/EMBL/GenBank Feature Table (Version 6.5 Apr 2006): transl_table defines the genetic code table used if other than the universal genetic code table. Tables are described in appendix V, section 7.5.5:
        • " 1 - UNIVERSAL"
        • " 2 - VERTEBRATE_MITOCHONDRIAL"
        • " 3 - YEAST_MITOCHONDRIAL"
        • " 4 - MOLD_MITOCHONDRIAL"
        • " 5 - INVERTEBRATE_MITOCHONDRIAL"
        • " 6 - CILIATE_NUCLEAR"
        • " 9 - ECHINODERM_MITOCHONDRIAL"
        • "10 - EUPLOTID_NUCLEAR"
        • "11 - BACTERIAL"
        • "12 - ALTERNATIVE_YEAST_NUCLEAR"
        • "13 - ASCIDIAN_MITOCHONDRIAL"
        • "14 - FLATWORM_MITOCHONDRIAL"
        • "15 - BLEPHARISMA_MACRONUCLEAR"
        • "16 - 2CHLOROPHYCEAN_MITOCHONDRIAL"
        • "21 - TREMATODE_MITOCHONDRIAL"
        • "23 - SCENEDESMUS_MITOCHONDRIAL"
        Throws:
        IllegalArgumentException - if there is no table with that number.
        Since:
        1.5
      • getGeneticCodeNames

        public static Set getGeneticCodeNames()
        Retrieve a Set containing the name of each genetic code.
        Since:
        1.1