org.biojava.bio.seq
Class DNATools

java.lang.Object
  |
  +--org.biojava.bio.seq.DNATools

public final class DNATools
extends java.lang.Object

Usefull functionality for processing DNA sequences.

Author:
Matthew Pocock

Constructor Summary
DNATools()
           
 
Method Summary
static Symbol a()
           
static Symbol c()
           
static Symbol complement(Symbol sym)
          Complement the symbol.
static SymbolList complement(SymbolList list)
          Retrieve a complement view of list.
static SymbolList createDNA(java.lang.String dna)
          Return a new DNA SymbolList for dna.
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 Symbol g()
           
static FiniteAlphabet getDNA()
          Return the DNA alphabet.
static int index(Symbol res)
          Return an integer index for a symbol - compatible with forIndex.
static SymbolList reverseComplement(SymbolList list)
          Retrieve a reverse-complement view of list.
static Symbol t()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DNATools

public DNATools()
Method Detail

a

public static Symbol a()

g

public static Symbol g()

c

public static Symbol c()

t

public static Symbol t()

getDNA

public static FiniteAlphabet getDNA()
Return the DNA alphabet.
Returns:
a flyweight version of the DNA alphabet

createDNA

public static SymbolList createDNA(java.lang.String dna)
                            throws IllegalSymbolException
Return a new DNA SymbolList for dna.
Parameters:
dna - a String to parse into DNA
Returns:
a SymbolList created form dna
Throws:
IllegalSymbolException - if dna contains any non-DNA characters

index

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

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

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

forIndex

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

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

Parameters:
index - the index to look up
Returns:
the symbol at that index
Throws:
java.lang.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 res
Throws:
IllegalSymbolException - if res is not a member of the DNA 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 does not belong to {a, g, c, t}

complement

public static SymbolList complement(SymbolList list)
                             throws IllegalAlphabetException
Retrieve a complement view of list.
Parameters:
list - the ResidueList 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 ResidueList to complement
Returns:
a SymbolList that is the complement
Throws:
IllegalAlphabetException - if list is not a complementable alphabet