public class PhredFormat extends Object implements SequenceFormat, ParseErrorSource, ParseErrorListener, Serializable
Copyright (c) 2001
Company: AgResearch
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT |
static String |
PROPERTY_DESCRIPTIONLINE
Constant string which is the property key used to notify
listeners of the description lines of Phred sequences.
|
Constructor and Description |
---|
PhredFormat() |
Modifier and Type | Method and Description |
---|---|
void |
addParseErrorListener(ParseErrorListener theListener)
Adds a parse error listener to the list of listeners if it isn't already
included.
|
void |
BadLineParsed(ParseErrorEvent theEvent)
This method determines the behaviour when a bad line is processed.
|
protected String |
describeSequence(Sequence seq)
Return a suitable description line for a Sequence.
|
String |
getDefaultFormat()
Deprecated.
|
int |
getLineWidth()
Retrive the current line width.
|
protected void |
notifyParseErrorEvent(ParseErrorEvent theEvent)
Passes the event on to all the listeners registered for ParseErrorEvents.
|
boolean |
readSequence(BufferedReader reader,
SymbolTokenization symParser,
SeqIOListener siol)
Read a sequence and pass data on to a SeqIOListener.
|
void |
removeParseErrorListener(ParseErrorListener theListener)
Removes a parse error listener from the list of listeners if it is
included.
|
void |
setLineWidth(int width)
Set the line width.
|
void |
writeSequence(Sequence seq,
PrintStream os)
This method will print symbols to the line width followed by a
new line etc.
|
void |
writeSequence(Sequence seq,
String format,
PrintStream os)
Deprecated.
use writeSequence(Sequence seq, PrintStream os)
|
public static final String DEFAULT
public static final String PROPERTY_DESCRIPTIONLINE
public PhredFormat()
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(BufferedReader reader, SymbolTokenization symParser, SeqIOListener siol) throws IllegalSymbolException, IOException, ParseException
SequenceFormat
readSequence
in interface SequenceFormat
reader
- The stream of data to parse.symParser
- A SymbolParser defining a mapping from
character data to Symbols.siol
- A listener to notify when data is extracted
from the stream.IllegalSymbolException
- if it is not possible to
translate character data from the stream into valid BioJava
symbols.IOException
- if an error occurs while reading from the
stream.ParseException
protected String describeSequence(Sequence seq)
public void writeSequence(Sequence seq, PrintStream os) throws IOException
writeSequence
in interface SequenceFormat
seq
- the sequence to write out.os
- the printstream to write to.IOException
public void writeSequence(Sequence seq, String format, PrintStream os) throws 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.IOException
- if an error occurs.public 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.Copyright © 2014 BioJava. All rights reserved.