Package org.biojava.bio.seq
Class RNATools
java.lang.Object
org.biojava.bio.seq.RNATools
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
Modifier and TypeMethodDescriptionstatic 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
Get a translation table for complementing DNA symbols.static SymbolList
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
Gets the (RNA x RNA x RNA) Alphabetstatic ManyToOneTranslationTable
getGeneticCode
(int table_num) Retrieve a TranslationTable by number.static ManyToOneTranslationTable
getGeneticCode
(String name) Retrieve a TranslationTable by name.static Set
Retrieve a Set containing the name of each genetic code.static FiniteAlphabet
getRNA()
Return the RNA alphabet.static int
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
Get a translation table for converting DNA to RNA.static SymbolList
translate
(SymbolList syms) Translate RNA into protein (with termination symbols).static AtomicSymbol
u()
-
Method Details
-
a
-
g
-
c
-
u
-
n
-
getRNA
Return the RNA alphabet.- Returns:
- a flyweight version of the RNA alphabet
-
getCodonAlphabet
Gets the (RNA x RNA x RNA) Alphabet- Returns:
- a flyweight version of the (RNA x RNA x RNA) alphabet
-
createRNA
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
Return a new RNA Sequence for rna.- Parameters:
rna
- a String to parse into RNAname
- a String to use as the name- Returns:
- a Sequence created form dna
- Throws:
IllegalSymbolException
- if rna contains any non-DNA characters
-
index
Return an integer index for a symbol - compatible with forIndex.The index for a symbol is stable across virtual machines invalid input: '&' 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
Return the symbol for an index - compatible with index.The index for a symbol is stable accross virtual machines invalid input: '&' 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
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
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
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
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
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
Get a translation table for complementing DNA symbols.- Since:
- 1.1
-
transcriptionTable
Get a translation table for converting DNA to RNA.- Since:
- 1.1
-
getGeneticCode
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"
You can now get the reverse translation of the residue back to its (usually several) codons too.
- Since:
- 1.1
-
getGeneticCode
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
Retrieve a Set containing the name of each genetic code.- Since:
- 1.1
-
translate
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
-