public Ontology parseOBO ( BufferedReader oboFile , String ontoName , String ontoDescription ) throws ParseException , IOException { try { OntologyFactory factory = OntoTools . getDefaultFactory ( ) ; Ontology ontology = factory . createOntology ( ontoName , ontoDescription ) ; OboFileParser parser = new OboFileParser ( ) ; OboFileEventListener handler = new OboFileHandler ( ontology ) ; parser . addOboFileEventListener ( handler ) ; parser . parseOBO ( oboFile ) ; return ontology ; } catch ( AlreadyExistsException ex ) { throw new RuntimeException ( "Duplication in ontology" ) ; } catch ( OntologyException ex ) { throw new RuntimeException ( ex ) ; } }
Parse a OBO file and return its content as a BioJava Ontology object