Alignments
Class FastaAlignment

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

public class FastaAlignment
extends Alignment

Represents a sequence alignment in FASTA format

Version:
1.2

Nested Class Summary
 
Nested classes/interfaces inherited from class Alignments.Alignment
Alignment.UniqueSite
 
Field Summary
 
Fields inherited from class Alignments.Alignment
data, hasClasses, taxa
 
Constructor Summary
FastaAlignment(java.io.File f)
          Creates a sequence alignment from a file.
FastaAlignment(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 FastaAlignment(java.io.File).
 
Methods inherited from class Alignments.Alignment
check, getCount, getLength, getNumber, getRawFreq, getSite, getTaxa, getUniqueSites, iterator, limitToTaxa, recode, recode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastaAlignment

public FastaAlignment(java.io.File f)
               throws InputException,
                      AlignmentException
Creates a sequence alignment from a file. File should be in Fasta format File should consist of a line beginningb with a ">" followed by the taxa name - anything after a "|" is ignored. The following lines to the next line beginning with ">" are tjhe sequence associated with that taxa. Blank lines are ignored. Comments, i.e. lines beginning with ";" are NOT supported. A taxa name of *class* is assumed not to be a taxa but rather gives the class of each site (which can be any single character).

Parameters:
f - The input file
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

FastaAlignment

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

Parameters:
f - The input file
ambig - Desription of 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 FastaAlignment(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