the Gene Ontology

Search
  • Open menus
  • Home
  • FAQ
  • Downloads
    • Ontologies
    • Annotations
    • Database
    • Mappings to GO
    • Teaching Resources
    • Other files
    • FTP and CVS downloads
  • Tools
    • Browsers
    • Microarray tools
    • Annotation tools
    • Other tools
    • Submit New Tools
  • Documentation
    • Introduction
    • Ontology...
      • Ontology structure
      • Ontology relations
      • Cellular Component
      • Molecular Function
      • Biological Process
      • GO Slim Guide
      • OBO v1.2 format
    • Annotation...
      • Annotation Guide
      • Evidence Codes
      • Conventions
      • SOPs
      • Species and Databases
      • File Format
      • Reference collection
    • Database...
      • GO Database Guide
      • Database schema
      • Database abbreviations
    • File Formats...
      • File Format Guide
      • Annotation
      • OBO v1.2
      • OBO v1.0
      • GO RDF-XML
    • Meeting minutes
  • About GO
    • GO Consortium
    • Publications
    • Citation Policy
    • Mailing lists
    • Interest Groups
    • GO People
    • Funding
    • Acknowledgements
    • Newsletter
  • Projects
    • Reference Genomes
    • Cardiovascular
    • Renal
  • Contact GO
    • News
    • RSS
    • Twitter
    • Facebook

Java Event Based Parser for OBO

Getting Started

The Java event-based parser is part of the OBO-Edit source code, in the org.geneontology.oboedit.dataadapter package.

OBO-Edit can load files in both OBO 1.0 and OBO 1.2 syntax.

We apologize in advance for the very sparse documentation in these source files.

The classes of interest are:

  • GOBOParser
  • DefaultGOBOParser
  • GOBOParseEngine

The basic idea is that GOBOParseEngine reads and parses a collection of OBO files to generate events (like readID and readDefinition). Each GOBOParseEngine is associated with an implementation of GOBOParser. Each time GOBOParseEngine generates an event, the corresponding GOBOParser method is called. Thus, if GOBOParseEngine sees the line "name: kinase" in an OBO file, it will call GOBOParseEngine.readName("kinase", null).

DefaultGOBOParser is an implementation of GOBOParser that populates the OBO-Edit data models from an OBO file. If you want to use OBO-Edit's data models, you can use DefaultGOBOParser like so:

public static OBOSession getSession(String path) {
	DefaultGOBOParser parser = new DefaultGOBOParser();
	GOBOParseEngine engine = new GOBOParseEngine(parser);
	// GOBOParseEngine can parse several files at once
	// and create one munged-together ontology,
	// so we need to provide a Collection to the setPaths() method
	Collection paths = new LinkedList();
	paths.add(path);
	engine.setPaths(paths);
	engine.parse();
	OBOSession session = parser.getSession();
	return session;
}

If you're populating a database, or doing something else where it would just be a waste of memory to use the OBO-Edit data models, you can create your own implementation of GOBOParser, and skip the data model generation step altogether.

If you feel inspired to add some developer documentation to the OBO-Edit code (particularly the data model and data adapter interfaces), please do! We're always happy to integrate code contributions!

If you have any additional questions, please contact gohelp@geneontology.org (the GO helpdesk).

Back to top


Open Biomedical Ontologies logo Last modified Tuesday, 07-Jul-2009 12:08:41 PDT
Help • Cite • Terms of use • Site Map
Copyright © 1999-Saturday, 20-Mar-2010 15:10:54 PDT the Gene Ontology