org.biojava.ontology.obo
Class OboFileParser

java.lang.Object
  extended by org.biojava.ontology.obo.OboFileParser

public class OboFileParser
extends Object

A class to parse the content of an OBO file. It delegates handling of the content to the OBOFileEventListener implementation. This file contains parts of the OBO-Edit file OBOParseEngine, (particularly the encoding and decoding part) http://geneontology.cvs.sourceforge.net/geneontology/go-dev/java/oboedit/sources/org/geneontology/oboedit/dataadapter/OBOParseEngine.java?revision=1.10&view=markup Thanks to the OboEdit developers for giving permission to release this in BioJava.

Since:
1.6
Author:
Andreas Prlic, John Day Richter

Nested Class Summary
static class OboFileParser.SOPair
           
 
Field Summary
protected  int bytesRead
           
protected  SimpleDateFormat dateFormat
           
protected static Map<Character,Character> escapeChars
           
protected  String line
           
protected  int linenum
           
protected  StringBuffer tempBuffer
           
protected  int totalSize
           
protected static Map<Character,Character> unescapeChars
           
 
Constructor Summary
OboFileParser()
           
 
Method Summary
 void addOboFileEventListener(OboFileEventListener listener)
           
static String escape(String str, boolean escapespaces)
           
static int findUnescaped(String str, char toChar)
           
static int findUnescaped(String str, char toChar, int startIndex, int endIndex)
           
static int findUnescaped(String str, char toChar, int startindex, int endindex, boolean honorQuotes)
           
protected  Map<String,Object>[] getDbxrefList(String line, int startoffset, int endoffset)
           
protected  int getNestedValue(org.biojava.ontology.obo.NestedValue nv, String str, int startIndex)
           
 List<OboFileEventListener> getOboFileEventListener()
           
protected  StringBuffer getTempBuffer()
           
static boolean isEscapeStarter(char c)
           
static boolean isQuote(char c)
           
 void parseOBO(BufferedReader oboFile)
          parse an ontology file
protected  Map<String,Object> parseXref(String line, int startoffset, int endoffset)
           
protected  OboFileParser.SOPair readQuotedString(String value, int startIndex, int stopIndex, char terminatingChar, boolean requireQuotes, boolean legalEndOfLine)
           
 String unescape(String str)
           
 OboFileParser.SOPair unescape(String str, char toChar, int startindex, boolean mustFindChar)
           
 OboFileParser.SOPair unescape(String str, char toChar, int startindex, int endindex, boolean mustFindChar)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

line

protected String line

linenum

protected int linenum

totalSize

protected int totalSize

bytesRead

protected int bytesRead

tempBuffer

protected StringBuffer tempBuffer

dateFormat

protected SimpleDateFormat dateFormat

escapeChars

protected static final Map<Character,Character> escapeChars

unescapeChars

protected static final Map<Character,Character> unescapeChars
Constructor Detail

OboFileParser

public OboFileParser()
Method Detail

addOboFileEventListener

public void addOboFileEventListener(OboFileEventListener listener)

getOboFileEventListener

public List<OboFileEventListener> getOboFileEventListener()

parseOBO

public void parseOBO(BufferedReader oboFile)
              throws IOException,
                     ParseException
parse an ontology file

Parameters:
oboFile -
Throws:
IOException
ParseException

getDbxrefList

protected Map<String,Object>[] getDbxrefList(String line,
                                             int startoffset,
                                             int endoffset)
                                      throws ParseException
Throws:
ParseException

parseXref

protected Map<String,Object> parseXref(String line,
                                       int startoffset,
                                       int endoffset)
                                throws ParseException
Throws:
ParseException

escape

public static String escape(String str,
                            boolean escapespaces)

unescape

public String unescape(String str)
                throws ParseException
Throws:
ParseException

unescape

public OboFileParser.SOPair unescape(String str,
                                     char toChar,
                                     int startindex,
                                     boolean mustFindChar)
                              throws ParseException
Throws:
ParseException

unescape

public OboFileParser.SOPair unescape(String str,
                                     char toChar,
                                     int startindex,
                                     int endindex,
                                     boolean mustFindChar)
                              throws ParseException
Throws:
ParseException

findUnescaped

public static int findUnescaped(String str,
                                char toChar)

findUnescaped

public static int findUnescaped(String str,
                                char toChar,
                                int startIndex,
                                int endIndex)

findUnescaped

public static int findUnescaped(String str,
                                char toChar,
                                int startindex,
                                int endindex,
                                boolean honorQuotes)

isEscapeStarter

public static boolean isEscapeStarter(char c)

isQuote

public static boolean isQuote(char c)

getTempBuffer

protected StringBuffer getTempBuffer()

readQuotedString

protected OboFileParser.SOPair readQuotedString(String value,
                                                int startIndex,
                                                int stopIndex,
                                                char terminatingChar,
                                                boolean requireQuotes,
                                                boolean legalEndOfLine)
                                         throws ParseException
Throws:
ParseException

getNestedValue

protected int getNestedValue(org.biojava.ontology.obo.NestedValue nv,
                             String str,
                             int startIndex)
                      throws ParseException
Throws:
ParseException


Copyright © 2012 BioJava. All Rights Reserved.