Alignments
Class SequenceAlignment

java.lang.Object
  extended by Alignments.Alignment
      extended by Alignments.SequenceAlignment
All Implemented Interfaces:
java.lang.Iterable<Site>

public class SequenceAlignment
extends Alignment

Represents a sequence alignment

Version:
1.0

Field Summary
 
Fields inherited from class Alignments.Alignment
data, taxa
 
Constructor Summary
SequenceAlignment(java.io.File f)
          Creates a sequence alignment from a file.
SequenceAlignment(java.io.File f, Ambiguous ambig)
          Creates a sequence alignment from a file with ambiguouis data.
 
Method Summary
static void writeFile(Alignment a, java.io.File f)
          Writes a alignment to a file in the format described in SequenceAlignment(java.io.File).
 
Methods inherited from class Alignments.Alignment
getCount, getLength, getNumber, getSite, getTaxa, getUniqueSites, iterator, recode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceAlignment

public SequenceAlignment(java.io.File f)
                  throws InputException,
                         AlignmentException
Creates a sequence alignment from a file. File should be in a format similar to Phylip. The first non-blank line, which normally gives the number and length of the sequence, is ignored. Further non-blank lines represent each sequence, one per line. Anything from the start of the line to the first white space is considered the taxa's name. Anything after the first whitespace is the sequence. Whitespace in the sequence is ignored.

Parameters:
f - The input file
Throws:
InputException - Thrown if there is a problem reading the file
AlignmentException - Thrown if there issomething wrong with the alignment, e.g. different length sequences

SequenceAlignment

public SequenceAlignment(java.io.File f,
                         Ambiguous ambig)
                  throws InputException,
                         AlignmentException
Creates a sequence alignment from a file with ambiguouis data. File should be in SequenceAlignment(java.io.File)

Parameters:
f - The input file
ambig - Desription o the ambiguous data
Throws:
InputException - Thrown if there is a problem with the input file
AlignmentException - Thrown if there issomething wrong with the alignment, e.g. different length sequences
Method Detail

writeFile

public static void writeFile(Alignment a,
                             java.io.File f)
                      throws OutputException
Writes a alignment to a file in the format described in SequenceAlignment(java.io.File).

Parameters:
a - The alignment to write to the file. Need not be a sequence alignment
f - The file to write to
Throws:
OutputException - Thrown if there is a problem creating the file