Package org.biojava.bio.program.gff
Class GFFParser
java.lang.Object
org.biojava.bio.program.gff.GFFParser
Parse a stream of GFF text into a stream of records and comments.
- Author:
- Matthew Pocock, Thomas Down, Keith James (docs)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected GFFRecord
createRecord
(GFFDocumentHandler handler, List aList, String rest, String comment) Actually turns a list of tokens, some value string and a comment into a GFFRecord and informs handler.Find the error handler used by this parser.void
parse
(BufferedReader bReader, GFFDocumentHandler handler) Informs handler of each line of gff read from bReader.void
parse
(BufferedReader bReader, GFFDocumentHandler handler, String locator) Informs handler of each line of GFF read from bReaderprotected Map
parseAttribute
(String attValList) Parse attValList into a Map of attributes and value lists.void
setErrorHandler
(GFFErrorHandler errors) Set the error handler used by this parser.
-
Constructor Details
-
GFFParser
public GFFParser()
-
-
Method Details
-
setErrorHandler
Set the error handler used by this parser. -
getErrorHandler
Find the error handler used by this parser. -
parse
public void parse(BufferedReader bReader, GFFDocumentHandler handler) throws IOException, BioException, ParserException Informs handler of each line of gff read from bReader. This form of the method should only be used if no locator string is available for the resource being parsed.- Parameters:
bReader
- the BufferedReader to parsehandler
- the GFFDocumentHandler that will listen for 'stuff'- Throws:
IOException
BioException
ParserException
-
parse
public void parse(BufferedReader bReader, GFFDocumentHandler handler, String locator) throws IOException, BioException, ParserException Informs handler of each line of GFF read from bReader- Parameters:
bReader
- the BufferedReader to parsehandler
- the GFFDocumentHandler that will listen for 'stuff'- Throws:
IOException
BioException
ParserException
-
createRecord
protected GFFRecord createRecord(GFFDocumentHandler handler, List aList, String rest, String comment) throws BioException, ParserException, IgnoreRecordException Actually turns a list of tokens, some value string and a comment into a GFFRecord and informs handler.- Parameters:
handler
- a GFFDocumentHandler to inform of any parse errors, and the completed GFFRecordaList
- a List containing the 8 mandatory GFF columnsrest
- a String representing the unparsed attribute-value text, or null if there is nonecomment
- a String containing the comment (without the leading '#
' character.- Throws:
BioException
ParserException
IgnoreRecordException
-
parseAttribute
Parse attValList into a Map of attributes and value lists.The resulting Map will have String keys, with List values. If there are no values associated with a key, then it will have an empty List, not null as its value.
- Parameters:
attValList
- the String to parse- Returns:
- a Map of parsed attributes and value lists
-