jebl.evolution.io
Class FastaImporter

java.lang.Object
  extended by jebl.evolution.io.FastaImporter
All Implemented Interfaces:
ImmediateSequenceImporter, SequenceImporter

public class FastaImporter
extends java.lang.Object
implements SequenceImporter, ImmediateSequenceImporter

Class for importing Fasta sequential file format.

Version:
$Id: FastaImporter.java 857 2007-12-14 02:49:27Z twobeers $
Author:
Andrew Rambaut, Alexei Drummond, Joseph Heled

Nested Class Summary
 
Nested classes/interfaces inherited from interface jebl.evolution.io.ImmediateSequenceImporter
ImmediateSequenceImporter.Callback
 
Field Summary
static java.lang.String descriptionPropertyName
          Name of Jebl sequence property which stores sequence description (i.e.
 
Constructor Summary
FastaImporter(java.io.File file, SequenceType sequenceType)
          Use this constructor if you are reading from a file.
FastaImporter(java.io.Reader reader, SequenceType sequenceType)
          This constuctor takes a reader.
 
Method Summary
 java.util.List<Sequence> importSequences()
          importSequences.
 void importSequences(ImmediateSequenceImporter.Callback callback, ProgressListener progressListener)
           
 void setIllegalCharacterPolicy(IllegalCharacterPolicy newPolicy)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

descriptionPropertyName

public static final java.lang.String descriptionPropertyName
Name of Jebl sequence property which stores sequence description (i.e. anything after sequence name in fasta file), so this data is available and an export to fasta can preserves the original data. This is stored some attribute of the sequence and of the taxon for backwards compatibility. Generally, attributes on taxon should not be used, as they are unsafe when dealing with objects that share the same taxon.

See Also:
Constant Field Values
Constructor Detail

FastaImporter

public FastaImporter(java.io.File file,
                     SequenceType sequenceType)
              throws java.io.FileNotFoundException
Use this constructor if you are reading from a file. The advantage over the other constructor is that a) the input size is known, so read() can report meaningful progress, and b) the file is closed at the end. WARNING: You cannot reuse the FastaImporter thus constructed to import sequences from the same file again.

Parameters:
file -
sequenceType -
Throws:
java.io.FileNotFoundException

FastaImporter

public FastaImporter(java.io.Reader reader,
                     SequenceType sequenceType)
This constuctor takes a reader. AR notes - this constructor was depeciated with the explanation below. I disagree that we can predict that we want to import from a file, and a reader is more flexible (it may be from the network or the clipboard). -- This constructor should normally never be needed because usually we want to import from a file. Then, the constructor expecting a file should be used.

Parameters:
reader - holds sequences data
sequenceType - pre specified sequences type. We should try and guess them some day.
Method Detail

setIllegalCharacterPolicy

public void setIllegalCharacterPolicy(IllegalCharacterPolicy newPolicy)

importSequences

public final java.util.List<Sequence> importSequences()
                                               throws java.io.IOException,
                                                      ImportException
Description copied from interface: SequenceImporter
importSequences.

Specified by:
importSequences in interface SequenceImporter
Returns:
sequences from file.
Throws:
java.io.IOException
ImportException

importSequences

public void importSequences(ImmediateSequenceImporter.Callback callback,
                            ProgressListener progressListener)
                     throws java.io.IOException,
                            ImportException
Specified by:
importSequences in interface ImmediateSequenceImporter
Throws:
java.io.IOException
ImportException


http://code.google.com/p/jebl2/