org.biojava.bio.seq
Class RNATools

java.lang.Object
  extended by org.biojava.bio.seq.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 Summary
static AtomicSymbol a()
           
static AtomicSymbol c()
           
static Symbol complement(Symbol sym)
          Complement the symbol.
static SymbolList complement(SymbolList list)
          Retrieve a complement view of list.
static ReversibleTranslationTable complementTable()
          Get a translation table for complementing DNA symbols.
static SymbolList createRNA(String rna)
          Return a new RNA SymbolList for rna.
static Sequence createRNASequence(String rna, String name)
          Return a new RNA Sequence for rna.
static Symbol forIndex(int index)
          Return the symbol for an index - compatible with index.
static Symbol forSymbol(char token)
          Retrieve the symbol for a symbol.
static AtomicSymbol g()
           
static FiniteAlphabet getCodonAlphabet()
          Gets the (RNA x RNA x RNA) Alphabet
static ManyToOneTranslationTable getGeneticCode(int table_num)
          Retrieve a TranslationTable by number.
static ManyToOneTranslationTable getGeneticCode(String name)
          Retrieve a TranslationTable by name.
static Set getGeneticCodeNames()
          Retrieve a Set containing the name of each genetic code.
static FiniteAlphabet getRNA()
          Return the RNA alphabet.
static int index(Symbol sym)
          Return an integer index for a symbol - compatible with forIndex.
static Symbol n()
           
static SymbolList reverseComplement(SymbolList list)
          Retrieve a reverse-complement view of list.
static SymbolList transcribe(SymbolList list)
          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.
static ReversibleTranslationTable transcriptionTable()
          Get a translation table for converting DNA to RNA.
static SymbolList translate(SymbolList syms)
          Translate RNA into protein (with termination symbols).
static AtomicSymbol u()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

a

public static AtomicSymbol a()

g

public static AtomicSymbol g()

c

public static AtomicSymbol c()

u

public static AtomicSymbol u()

n

public static Symbol n()

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

createRNA

public static SymbolList createRNA(String rna)
                            throws IllegalSymbolException
Return a new RNA SymbolList for rna.

Parameters:
rna - a String to parse into RNA
Returns:
a SymbolList created form rna
Throws:
IllegalSymbolException - if rna contains any non-RNA characters

createRNASequence

public static Sequence createRNASequence(String rna,
                                         String name)
                                  throws IllegalSymbolException
Return a new RNA Sequence for rna.

Parameters:
rna - a String to parse into RNA
name - a String to use as the name
Returns:
a Sequence created form dna
Throws:
IllegalSymbolException - if rna contains any non-DNA characters

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

complement

public static Symbol complement(Symbol sym)
                         throws IllegalSymbolException
Complement the symbol.

Parameters:
sym - the symbol to complement
Returns:
a Symbol that is the complement of sym
Throws:
IllegalSymbolException - if sym is not a member of the RNA alphabet

forSymbol

public static Symbol forSymbol(char token)
                        throws IllegalSymbolException
Retrieve the symbol for a symbol.

Parameters:
token - the char to look up
Returns:
the symbol for that char
Throws:
IllegalSymbolException - if the char is not a valid IUB code.

complement

public static SymbolList complement(SymbolList list)
                             throws IllegalAlphabetException
Retrieve a complement view of list.

Parameters:
list - the SymbolList to complement
Returns:
a SymbolList that is the complement
Throws:
IllegalAlphabetException - if list is not a complementable alphabet

reverseComplement

public static SymbolList reverseComplement(SymbolList list)
                                    throws IllegalAlphabetException
Retrieve a reverse-complement view of list.

Parameters:
list - the SymbolList to complement
Returns:
a SymbolList that is the complement
Throws:
IllegalAlphabetException - if list is not a complementable alphabet

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

complementTable

public static ReversibleTranslationTable complementTable()
Get a translation table for complementing DNA symbols.

Since:
1.1

transcriptionTable

public static ReversibleTranslationTable transcriptionTable()
Get a translation table for converting DNA to RNA.

Since:
1.1

getGeneticCode

public static ManyToOneTranslationTable getGeneticCode(String name)
Retrieve a TranslationTable by name. The valid names are: 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:

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

translate

public static SymbolList translate(SymbolList syms)
                            throws IllegalAlphabetException
Translate RNA into protein (with termination symbols). For compatibility with BioJava 1.1, this will also handle sequences which are already expressed in the (RNA x RNA x RNA) (codon) alphabet.

Throws:
IllegalAlphabetException
Since:
1.1