Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ensembl.util
Class SequenceUtil

    java.lang.Object
      org.ensembl.util.SequenceUtil

public class SequenceUtil
extends java.lang.Object

Utility functions for dealing with sequence data.

Constructor Summary
`SequenceUtil()`

Method Summary
`static java.lang.String` | `codon2aminoAcid(java.lang.String codon)` Converts 3 nuceic acids into an amino acid.
`static byte[]` | `dna2protein(byte[] dna)`
`static java.lang.String` | `dna2protein(java.lang.String dna, boolean cropStopCodon)` Converts string of nuceic acids into string of amino acids.
`static java.lang.String` | `replaceSubSequence(java.lang.String sourceSeq, Location sourceLoc, java.lang.String replacementSeq, Location replacementLoc)` Replace a sub sequence from sourceSeq with replacementSeq.
`static byte[]` | `reverseComplement(byte[] dna)`
`static java.lang.String` | `reverseComplement(java.lang.String dna)` Reverses the string and complements each base.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SequenceUtil

    public SequenceUtil()

Method Detail

### dna2protein

    public static final java.lang.String dna2protein(java.lang.String dna,
                                                     boolean cropStopCodon)
                                              throws java.lang.IllegalArgumentException

  Converts string of nuceic acids into string of amino acids. If the string is not of length modulus 3 then it's end is modified: if has 2 of the 3 final bases then an N is appended, however, if it only has 1 then that is removed.

  Parameters:
    `dna` - string of nucleic acids. Supports upper and lower case characters.
    `cropStopCodon` - do not create amino acids for and after stop codon id present in dna.
  Returns:
    string of amino acids.
  Throws:
    `java.lang.IllegalArgumentException`

### dna2protein

    public static final byte[] dna2protein(byte[] dna)
                                    throws java.lang.IllegalArgumentException

  Throws:
    `java.lang.IllegalArgumentException`

### codon2aminoAcid

    public static java.lang.String codon2aminoAcid(java.lang.String codon)
                                            throws java.lang.IllegalArgumentException

  Converts 3 nuceic acids into an amino acid. If codon is unrecognised, e.g. "ANN" then "X" is returned.

  Parameters:
    `codon` - 3 nucleic acids. Supports upper and lower case characters.
  Returns:
    amino acid.
  Throws:
    `java.lang.IllegalArgumentException` - codon string is wrong length.

### reverseComplement

    public static java.lang.String reverseComplement(java.lang.String dna)

  Reverses the string and complements each base.

  Parameters:
    `dna` -
  Returns:
    reverse complement of dna

### reverseComplement

    public static byte[] reverseComplement(byte[] dna)

### replaceSubSequence

    public static java.lang.String replaceSubSequence(java.lang.String sourceSeq,
                                                      Location sourceLoc,
                                                      java.lang.String replacementSeq,
                                                      Location replacementLoc)

  Replace a sub sequence from sourceSeq with replacementSeq. The replacementLoc defines the part of sourceSeq to replace. Handles the situation where sourceSeq and replacementSeq on different strands.

  Parameters:
    `sourceSeq` - original sequence string.
    `sourceLoc` - genomic location of source sequence.
    `replacementSeq` - sequence with which to replace the part of sourceSeq corresponding to replacementLoc.
    `replacementLoc` - genomic location for replacementSeq.
  Returns:
    string corresponding to the insertion of replacementSeq in sourceSeq.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD