jebl.evolution.sequences
Class Utils

java.lang.Object
  extended by jebl.evolution.sequences.Utils

public class Utils
extends Object

Author:
Andrew Rambaut, Alexei Drummond

Constructor Summary
Utils()
           
 
Method Summary
static NucleotideState[] complement(NucleotideState[] sequence)
           
static int getGaplessLocation(Sequence sequence, int gappedLocation)
          Gets the site location index for this sequence excluding any gaps.
static int getGappedLocation(Sequence sequence, int gaplessLocation)
          Gets the site location index for this sequence that corresponds to a location given excluding all gaps.
static byte[] getStateIndices(State[] sequence)
           
static SequenceType guessSequenceType(CharSequence seq)
          Guess type of sequence from contents
static State[] reverse(State[] sequence)
           
static NucleotideState[] reverseComplement(NucleotideState[] sequence)
           
static String reverseComplement(String nucleotideSequence)
           
static String reverseComplementWithGaps(String nucleotideSequence)
           
static State[] stripGaps(State[] sequence)
           
static AminoAcidState[] translate(State[] states, GeneticCode geneticCode)
           
static String translate(String nucleotideSequence, GeneticCode geneticCode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

translate

public static AminoAcidState[] translate(State[] states,
                                         GeneticCode geneticCode)

reverseComplement

public static String reverseComplement(String nucleotideSequence)

reverseComplementWithGaps

public static String reverseComplementWithGaps(String nucleotideSequence)

translate

public static String translate(String nucleotideSequence,
                               GeneticCode geneticCode)

stripGaps

public static State[] stripGaps(State[] sequence)

reverse

public static State[] reverse(State[] sequence)

complement

public static NucleotideState[] complement(NucleotideState[] sequence)

reverseComplement

public static NucleotideState[] reverseComplement(NucleotideState[] sequence)

getStateIndices

public static byte[] getStateIndices(State[] sequence)

getGaplessLocation

public static int getGaplessLocation(Sequence sequence,
                                     int gappedLocation)
Gets the site location index for this sequence excluding any gaps. The location is indexed from 0.

Parameters:
sequence - the sequence
gappedLocation - the location including gaps
Returns:
the location without gaps.

getGappedLocation

public static int getGappedLocation(Sequence sequence,
                                    int gaplessLocation)
Gets the site location index for this sequence that corresponds to a location given excluding all gaps. The first non-gapped site in the sequence has a gaplessLocation of 0.

Parameters:
sequence - the sequence
gaplessLocation -
Returns:
the site location including gaps

guessSequenceType

public static SequenceType guessSequenceType(CharSequence seq)
Guess type of sequence from contents

Parameters:
seq - the sequence
Returns:
type of sequence, null if sequence contains illegal characters.