public class FastaFormat extends java.lang.Object implements SequenceFormat, java.io.Serializable, ParseErrorListener, ParseErrorSource
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT
Deprecated.
|
protected int |
lineWidth
Deprecated.
The line width for output.
|
protected java.util.Vector |
mListeners
Deprecated.
|
static java.lang.String |
PROPERTY_DESCRIPTIONLINE
Deprecated.
Constant string which is the property key used to notify
listeners of the description lines of FASTA sequences.
|
Constructor and Description |
---|
FastaFormat()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
addParseErrorListener(ParseErrorListener theListener)
Deprecated.
Adds a parse error listener to the list of listeners if it isn't already
included.
|
void |
BadLineParsed(ParseErrorEvent theEvent)
Deprecated.
This method determines the behaviour when a bad line is processed.
|
protected java.lang.String |
describeSequence(Sequence seq)
Deprecated.
Return a suitable description line for a Sequence.
|
java.lang.String |
getDefaultFormat()
Deprecated.
|
int |
getLineWidth()
Deprecated.
Retrive the current line width.
|
protected void |
notifyParseErrorEvent(ParseErrorEvent theEvent)
Deprecated.
Passes the event on to all the listeners registered for ParseErrorEvents.
|
boolean |
readSequence(java.io.BufferedReader reader,
SymbolTokenization symParser,
SeqIOListener siol)
Deprecated.
Reads information from a flatfile to a
SeqIOListener
using a SymbolTokenizer to convert sequence strings
to Symbol objects. |
void |
removeParseErrorListener(ParseErrorListener theListener)
Deprecated.
Removes a parse error listener from the list of listeners if it is
included.
|
void |
setLineWidth(int width)
Deprecated.
Set the line width.
|
void |
writeSequence(Sequence seq,
java.io.PrintStream os)
Deprecated.
Writes a
Sequence or RichSequence to a
PrintStream in FASTA format. |
void |
writeSequence(Sequence seq,
java.lang.String format,
java.io.PrintStream os)
Deprecated.
use writeSequence(Sequence seq, PrintStream os)
|
public static final java.lang.String DEFAULT
public static final java.lang.String PROPERTY_DESCRIPTIONLINE
protected java.util.Vector mListeners
protected int lineWidth
public int getLineWidth()
public void setLineWidth(int width)
When writing, the lines of sequence will never be longer than the line width.
width
- the new line widthpublic boolean readSequence(java.io.BufferedReader reader, SymbolTokenization symParser, SeqIOListener siol) throws IllegalSymbolException, java.io.IOException, ParseException
SeqIOListener
using a SymbolTokenizer
to convert sequence strings
to Symbol
objects.readSequence
in interface SequenceFormat
reader
- The reader that is the source of the informationsymParser
- converts text seqeunce to biojava objectssiol
- The listener that listens for event callbacks from this class.
The listener can be a RichSeqIOListener
.IllegalSymbolException
- if symParser
doesn't know how to convert the text sequence into biojava Symbol
sjava.io.IOException
- if there is a problem reading.ParseException
- if the source cannot be parsed.protected java.lang.String describeSequence(Sequence seq)
public void writeSequence(Sequence seq, java.io.PrintStream os) throws java.io.IOException
Sequence
or RichSequence
to a
PrintStream
in FASTA format. If the sequence is a
RichSequence
the format of the header will be in line with
the NCBI standard.writeSequence
in interface SequenceFormat
seq
- the sequence to formatos
- the stream to write the sequence to. To print to screen use
System.out
java.io.IOException
- if data cannot be written to os
public void writeSequence(Sequence seq, java.lang.String format, java.io.PrintStream os) throws java.io.IOException
writeSequence
writes a sequence to the specified
PrintStream
, using the specified format.writeSequence
in interface SequenceFormat
seq
- a Sequence
to write out.format
- a String
indicating which sub-format
of those available from a particular
SequenceFormat
implemention to use when
writing.os
- a PrintStream
object.java.io.IOException
- if an error occurs.public java.lang.String getDefaultFormat()
getDefaultFormat
returns the String identifier for
the default format.getDefaultFormat
in interface SequenceFormat
String
.public void addParseErrorListener(ParseErrorListener theListener)
addParseErrorListener
in interface ParseErrorSource
theListener
- Listener to be added.public void removeParseErrorListener(ParseErrorListener theListener)
removeParseErrorListener
in interface ParseErrorSource
theListener
- Listener to be removed.public void BadLineParsed(ParseErrorEvent theEvent)
This method should be overwritten when different behavior is desired.
BadLineParsed
in interface ParseErrorListener
theEvent
- The event that contains the bad line and token.protected void notifyParseErrorEvent(ParseErrorEvent theEvent)
theEvent
- The event to be handed to the listeners.