## org.biojava.bio.seq
Class DNATools

    java.lang.Object
      org.biojava.bio.seq.DNATools

public final class DNATools
extends java.lang.Object

Useful functionality for processing DNA sequences.

Author:
  Matthew Pocock, Keith James (docs), Mark Schreiber

Constructor Summary
`DNATools()`

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` `createDNA(java.lang.String dna)` Return a new DNA SymbolList for dna.
`static Sequence` `createDNASequence(java.lang.String dna, java.lang.String name)` Return a new DNA Sequence for dna.
`static GappedSequence` `createGappedDNASequence(java.lang.String dna, java.lang.String name)` Get a new dna as a GappedSequence
`static char` `dnaToken(Symbol sym)` Get a single-character token for a DNA symbol
`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 (DNA x DNA x DNA) Alphabet
`static FiniteAlphabet` `getDNA()` Return the DNA 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 AtomicSymbol` `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 AtomicSymbol a()

### g

    public static AtomicSymbol g()

### c

    public static AtomicSymbol c()

### t

    public static AtomicSymbol t()

### n

    public static Symbol n()

### getDNA

    public static FiniteAlphabet getDNA()

  Return the DNA alphabet.

  Returns:
    a flyweight version of the DNA alphabet

### getCodonAlphabet

    public static FiniteAlphabet getCodonAlphabet()

  Gets the (DNA x DNA x DNA) Alphabet

  Returns:
    a flyweight version of the (DNA x DNA x 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

### createDNASequence

    public static Sequence createDNASequence(java.lang.String dna,
                                             java.lang.String name)
                                      throws IllegalSymbolException

  Return a new DNA Sequence for dna.

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

### createGappedDNASequence

    public static GappedSequence createGappedDNASequence(java.lang.String dna,
                                                         java.lang.String name)
                                                  throws IllegalSymbolException

  Get a new dna as a GappedSequence

  Throws:
    `IllegalSymbolException`

### 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 accross 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 java.lang.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:
    `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 sym
  Throws:
    `IllegalSymbolException` - if sym 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 is not a valid IUB dna 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

### complementTable

    public static ReversibleTranslationTable complementTable()

  Get a translation table for complementing DNA symbols.

  Since:
    1.1

### dnaToken

    public static char dnaToken(Symbol sym)
                         throws IllegalSymbolException

  Get a single-character token for a DNA symbol

  Throws:
    `IllegalSymbolException` - if `sym` is not a member of the DNA alphabet