Package org.biojava.bio.seq.io
Class FastaFormat
- java.lang.Object
-
- org.biojava.bio.seq.io.FastaFormat
-
- All Implemented Interfaces:
Serializable,EventListener,SequenceFormat,ParseErrorListener,ParseErrorSource
public class FastaFormat extends Object implements SequenceFormat, Serializable, ParseErrorListener, ParseErrorSource
Deprecated.Use org.biojavax.bio.seq.io.FastaFormatFormat object representing FASTA files. These files are almost pure sequence data. The only `sequence property' reported by this parser is PROPERTY_DESCRIPTIONLINE, which is the contents of the sequence's description line (the line starting with a '>' character). Normally, the first word of this is a sequence ID. If you wish it to be interpreted as such, you should use FastaDescriptionLineParser as a SeqIO filter. If you pass it a RichSeqIOListener, you'll get RichSequence objects in return. Likewise, if you write RichSequence objects, you'll get absolutely correct FASTA formatted output.- Author:
- Thomas Down, Matthew Pocock, Greg Cox, Lukas Kall, Richard Holland, Mark Schreiber
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULTDeprecated.protected intlineWidthDeprecated.The line width for output.protected VectormListenersDeprecated.static StringPROPERTY_DESCRIPTIONLINEDeprecated.Constant string which is the property key used to notify listeners of the description lines of FASTA sequences.
-
Constructor Summary
Constructors Constructor Description FastaFormat()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddParseErrorListener(ParseErrorListener theListener)Deprecated.Adds a parse error listener to the list of listeners if it isn't already included.voidBadLineParsed(ParseErrorEvent theEvent)Deprecated.This method determines the behaviour when a bad line is processed.protected StringdescribeSequence(Sequence seq)Deprecated.Return a suitable description line for a Sequence.StringgetDefaultFormat()Deprecated.intgetLineWidth()Deprecated.Retrive the current line width.protected voidnotifyParseErrorEvent(ParseErrorEvent theEvent)Deprecated.Passes the event on to all the listeners registered for ParseErrorEvents.booleanreadSequence(BufferedReader reader, SymbolTokenization symParser, SeqIOListener siol)Deprecated.Reads information from a flatfile to aSeqIOListenerusing aSymbolTokenizerto convert sequence strings toSymbolobjects.voidremoveParseErrorListener(ParseErrorListener theListener)Deprecated.Removes a parse error listener from the list of listeners if it is included.voidsetLineWidth(int width)Deprecated.Set the line width.voidwriteSequence(Sequence seq, PrintStream os)Deprecated.Writes aSequenceorRichSequenceto aPrintStreamin FASTA format.voidwriteSequence(Sequence seq, String format, PrintStream os)Deprecated.use writeSequence(Sequence seq, PrintStream os)
-
-
-
Field Detail
-
DEFAULT
public static final String DEFAULT
Deprecated.- See Also:
- Constant Field Values
-
PROPERTY_DESCRIPTIONLINE
public static final String PROPERTY_DESCRIPTIONLINE
Deprecated.Constant string which is the property key used to notify listeners of the description lines of FASTA sequences.- See Also:
- Constant Field Values
-
mListeners
protected Vector mListeners
Deprecated.
-
lineWidth
protected int lineWidth
Deprecated.The line width for output.
-
-
Constructor Detail
-
FastaFormat
public FastaFormat()
Deprecated.
-
-
Method Detail
-
getLineWidth
public int getLineWidth()
Deprecated.Retrive the current line width.- Returns:
- the line width
-
setLineWidth
public void setLineWidth(int width)
Deprecated.Set the line width.When writing, the lines of sequence will never be longer than the line width.
- Parameters:
width- the new line width
-
readSequence
public boolean readSequence(BufferedReader reader, SymbolTokenization symParser, SeqIOListener siol) throws IllegalSymbolException, IOException, ParseException
Deprecated.Reads information from a flatfile to aSeqIOListenerusing aSymbolTokenizerto convert sequence strings toSymbolobjects.- Specified by:
readSequencein interfaceSequenceFormat- Parameters:
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 aRichSeqIOListener.- Returns:
- true if there is another unread sequence in the source.
- Throws:
IllegalSymbolException- ifsymParserdoesn't know how to convert the text sequence into biojavaSymbolsIOException- if there is a problem reading.ParseException- if the source cannot be parsed.
-
describeSequence
protected String describeSequence(Sequence seq)
Deprecated.Return a suitable description line for a Sequence. If the sequence's annotation bundle contains PROPERTY_DESCRIPTIONLINE, this is used verbatim. Otherwise, the sequence's name is used.
-
writeSequence
public void writeSequence(Sequence seq, PrintStream os) throws IOException
Deprecated.Writes aSequenceorRichSequenceto aPrintStreamin FASTA format. If the sequence is aRichSequencethe format of the header will be in line with the NCBI standard.- Specified by:
writeSequencein interfaceSequenceFormat- Parameters:
seq- the sequence to formatos- the stream to write the sequence to. To print to screen useSystem.out- Throws:
IOException- if data cannot be written toos
-
writeSequence
public void writeSequence(Sequence seq, String format, PrintStream os) throws IOException
Deprecated.use writeSequence(Sequence seq, PrintStream os)writeSequencewrites a sequence to the specifiedPrintStream, using the specified format.- Specified by:
writeSequencein interfaceSequenceFormat- Parameters:
seq- aSequenceto write out.format- aStringindicating which sub-format of those available from a particularSequenceFormatimplemention to use when writing.os- aPrintStreamobject.- Throws:
IOException- if an error occurs.
-
getDefaultFormat
public String getDefaultFormat()
Deprecated.getDefaultFormatreturns the String identifier for the default format.- Specified by:
getDefaultFormatin interfaceSequenceFormat- Returns:
- a
String.
-
addParseErrorListener
public void addParseErrorListener(ParseErrorListener theListener)
Deprecated.Adds a parse error listener to the list of listeners if it isn't already included.- Specified by:
addParseErrorListenerin interfaceParseErrorSource- Parameters:
theListener- Listener to be added.
-
removeParseErrorListener
public void removeParseErrorListener(ParseErrorListener theListener)
Deprecated.Removes a parse error listener from the list of listeners if it is included.- Specified by:
removeParseErrorListenerin interfaceParseErrorSource- Parameters:
theListener- Listener to be removed.
-
BadLineParsed
public void BadLineParsed(ParseErrorEvent theEvent)
Deprecated.This method determines the behaviour when a bad line is processed. Some options are to log the error, throw an exception, ignore it completely, or pass the event through.This method should be overwritten when different behavior is desired.
- Specified by:
BadLineParsedin interfaceParseErrorListener- Parameters:
theEvent- The event that contains the bad line and token.
-
notifyParseErrorEvent
protected void notifyParseErrorEvent(ParseErrorEvent theEvent)
Deprecated.Passes the event on to all the listeners registered for ParseErrorEvents.- Parameters:
theEvent- The event to be handed to the listeners.
-
-