uk.ac.man.bioinf.sequence
Class Sequences

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.Sequences

public class Sequences
extends Object

Sequences.java Created: Tue Mar 14 13:43:59 2000

Version:
$Id: Sequences.java,v 1.15 2001/04/11 17:04:43 lord Exp $
Author:
Phillip Lord

Method Summary
static int chompLeadingGaps(GappedSequence seq)
          This removes all of the leading gaps from a gapped sequence, and then returns the number of gaps removed.
static int chompTrailingGaps(GappedSequence seq)
          Removes and returns the number of trailing gaps off a gapped sequence.
static String getComplexSequenceAsString(ComplexSequence seq)
           
static GappedSequence getElementsAsGappedSequence(Element[] elements, SequenceType type)
          Returns a GappedSequence with the Elements in the array, which can included gaps.
static GappedSequence getElementsAsGappedSequence(Element[] elements, SequenceType type, Identifier ident)
          Returns a GappedSequence with the Elements in the array, which can included gaps.
static Sequence getElementsAsSequence(Element[] elements, SequenceType type)
           
static Sequence getElementsAsSequence(Element[] elements, SequenceType type, Identifier ident)
           
static String getElementsAsString(Element[] elem)
           
static String getGappedSequenceAsString(GappedSequence seq)
           
static String getGappedSubSequenceAsString(GappedSequence seq, int start, int length)
           
static int getNumberGapsDownstreamFrom(int index, GappedSequence seq)
          Returns the number of gaps downstream from a given index in the given sequence.
static int getNumberGapsUpstreamFrom(int index, GappedSequence seq)
          Returns the number of gaps upstream from a given index in the given sequence.
static ComplexElement[] getResiduesAsComplexElements(Residue[] elements)
           
static String getSequenceAsString(Sequence seq)
           
static String getSubSequenceAsString(Sequence seq, int start, int length)
           
static void printAlignment(SequenceAlignment align)
           
static void printElements(Element[] elem)
           
static void printSequence(ComplexSequence seq)
           
static void printSequence(GappedComplexSequence seq)
           
static void printSequence(GappedSequence seq)
           
static void printSequence(Sequence seq)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getElementsAsGappedSequence

public static GappedSequence getElementsAsGappedSequence(Element[] elements,
                                                         SequenceType type)
Returns a GappedSequence with the Elements in the array, which can included gaps. All other elements must be contained in the SequenceType however.

Parameters:
elements - the elements
type - the sequence type
Returns:
the sequence

getElementsAsGappedSequence

public static GappedSequence getElementsAsGappedSequence(Element[] elements,
                                                         SequenceType type,
                                                         Identifier ident)
Returns a GappedSequence with the Elements in the array, which can included gaps. All other elements must be contained in the SequenceType however.

Parameters:
elements - the elements
type - the sequence type
Returns:
the sequence

getElementsAsSequence

public static Sequence getElementsAsSequence(Element[] elements,
                                             SequenceType type)

getElementsAsSequence

public static Sequence getElementsAsSequence(Element[] elements,
                                             SequenceType type,
                                             Identifier ident)

chompLeadingGaps

public static int chompLeadingGaps(GappedSequence seq)
                            throws SequenceVetoException
This removes all of the leading gaps from a gapped sequence, and then returns the number of gaps removed.

Parameters:
seq - the sequence to chomp
Returns:
the number of gaps
SequenceVetoException

chompTrailingGaps

public static int chompTrailingGaps(GappedSequence seq)
                             throws SequenceVetoException
Removes and returns the number of trailing gaps off a gapped sequence.

Parameters:
seq - the sequence
Returns:
the number of gaps
SequenceVetoException

getNumberGapsUpstreamFrom

public static int getNumberGapsUpstreamFrom(int index,
                                            GappedSequence seq)
Returns the number of gaps upstream from a given index in the given sequence. If the index is out of bounds, it returns zero.

Parameters:
index - the location in the sequence to start counting upstream from
seq - the sequence
Returns:
the number of gaps upstream for the given location

getNumberGapsDownstreamFrom

public static int getNumberGapsDownstreamFrom(int index,
                                              GappedSequence seq)
Returns the number of gaps downstream from a given index in the given sequence. If the index is out of bounds, it returns zero.

Parameters:
index - the location in the sequence to start counting downstream from
seq - the sequence
Returns:
the number of gaps downstream for the given location

getSequenceAsString

public static String getSequenceAsString(Sequence seq)

getSubSequenceAsString

public static String getSubSequenceAsString(Sequence seq,
                                            int start,
                                            int length)

getGappedSequenceAsString

public static String getGappedSequenceAsString(GappedSequence seq)

getGappedSubSequenceAsString

public static String getGappedSubSequenceAsString(GappedSequence seq,
                                                  int start,
                                                  int length)

getElementsAsString

public static String getElementsAsString(Element[] elem)

getComplexSequenceAsString

public static String getComplexSequenceAsString(ComplexSequence seq)

getResiduesAsComplexElements

public static ComplexElement[] getResiduesAsComplexElements(Residue[] elements)

printAlignment

public static void printAlignment(SequenceAlignment align)

printSequence

public static void printSequence(GappedSequence seq)

printSequence

public static void printSequence(ComplexSequence seq)

printSequence

public static void printSequence(GappedComplexSequence seq)

printSequence

public static void printSequence(Sequence seq)

printElements

public static void printElements(Element[] elem)