Class GFF3Parser


  • public class GFF3Parser
    extends java.lang.Object
    Parse a stream of GFF text into a stream of records and comments.

    Developed from GFFParser.

    Author:
    Matthew Pocock
    • Constructor Detail

      • GFF3Parser

        public GFF3Parser()
    • Method Detail

      • setErrorHandler

        public void setErrorHandler​(GFFErrorHandler errors)
        Set the error handler used by this parser.
      • getErrorHandler

        public GFFErrorHandler getErrorHandler()
        Find the error handler used by this parser.
      • parse

        public void parse​(java.io.BufferedReader bReader,
                          GFF3DocumentHandler handler,
                          Ontology ontology)
                   throws java.io.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 parse
        handler - the GFF3DocumentHandler that will listen for 'stuff'
        ontology - an Ontology that all terms should come from
        Throws:
        java.io.IOException
        BioException
        ParserException
      • parse

        public void parse​(java.io.BufferedReader bReader,
                          GFF3DocumentHandler handler,
                          Ontology ontology,
                          java.lang.String locator)
                   throws java.io.IOException,
                          BioException,
                          ParserException
        Informs handler of each line of GFF read from bReader
        Parameters:
        bReader - the BufferedReader to parse
        handler - the GFF3DocumentHandler that will listen for 'stuff'
        ontology - an Ontology that all terms should come from
        Throws:
        java.io.IOException
        BioException
        ParserException
      • createRecord

        protected GFF3Record createRecord​(GFF3DocumentHandler handler,
                                          java.util.List aList,
                                          java.lang.String rest,
                                          java.lang.String comment,
                                          Ontology ontology,
                                          Ontology fallBack)
                                   throws BioException,
                                          ParserException,
                                          IgnoreRecordException
        Actually turns a list of tokens, some value string and a comment into a GFF3Record and informs handler.
        Parameters:
        handler - a GFF3DocumentHandler to inform of any parse errors, and the completed GFF3Record
        aList - a List containing the 8 mandatory GFF columns
        rest - a String representing the unparsed attribute-value text, or null if there is none
        comment - a String containing the comment (without the leading '#' character.
        ontology - the Ontology to resolve Terms in
        Throws:
        BioException
        ParserException
        IgnoreRecordException
      • parseAttribute

        protected void parseAttribute​(java.lang.String attValList,
                                      Annotation anno,
                                      Ontology onto,
                                      Ontology fallBack)
                               throws ChangeVetoException
        Parse attValList into a Map of attributes and value lists.

        Populates an Annotation instance with Ontology Term keys and string/list values.

        Parameters:
        attValList - the String to parse
        Throws:
        ChangeVetoException