Alignments
Class PhylipAlignment

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

public class PhylipAlignment
extends Alignment

Represents a sequence alignment in Phylip 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
PhylipAlignment(java.io.File f)
          Creates a sequence alignment from a file.
PhylipAlignment(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 PhylipAlignment(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

PhylipAlignment

public PhylipAlignment(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. A taxa name of *class* is assumed not to be a taxa but rather gfives the class of each site (which can be any single character).

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

PhylipAlignment

public PhylipAlignment(java.io.File f,
                       Ambiguous ambig)
                throws InputException,
                       AlignmentException
Creates a sequence alignment from a file with ambiguouis data. File should be in the format described at PhylipAlignment(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 PhylipAlignment(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