Package org.biojava.nbio.ontology.obo
Class OboFileParser
- java.lang.Object
-
- org.biojava.nbio.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
Nested Classes Modifier and Type Class Description static class
OboFileParser.SOPair
-
Field Summary
Fields Modifier and Type Field Description 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
Constructors Constructor Description OboFileParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.nbio.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 fileprotected 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)
-
-
-
Field Detail
-
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
parse an ontology file- Parameters:
oboFile
-- Throws:
IOException
IOException
-
getDbxrefList
protected Map<String,Object>[] getDbxrefList(String line, int startoffset, int endoffset) throws IOException
- Throws:
IOException
-
parseXref
protected Map<String,Object> parseXref(String line, int startoffset, int endoffset) throws IOException
- Throws:
IOException
-
unescape
public String unescape(String str) throws IOException
- Throws:
IOException
-
unescape
public OboFileParser.SOPair unescape(String str, char toChar, int startindex, boolean mustFindChar) throws IOException
- Throws:
IOException
-
unescape
public OboFileParser.SOPair unescape(String str, char toChar, int startindex, int endindex, boolean mustFindChar) throws IOException
- Throws:
IOException
-
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 IOException
- Throws:
IOException
-
getNestedValue
protected int getNestedValue(org.biojava.nbio.ontology.obo.NestedValue nv, String str, int startIndex) throws IOException
- Throws:
IOException
-
-