1111import org .json .simple .JSONArray ;
1212import org .json .simple .JSONObject ;
1313
14+ import ontologizer .go .OBOParser ;
15+ import ontologizer .go .OBOParserException ;
1416import ontologizer .go .Ontology ;
1517import ontologizer .go .Term ;
18+ import ontologizer .go .TermContainer ;
1619import sonumina .math .graph .SlimDirectedGraphView ;
17- import util .OntologyUtil ;
1820
1921/**
2022 * @author Sebastian Köhler (dr.sebastian.koehler@gmail.com)
@@ -39,7 +41,7 @@ public static void main(String[] args) {
3941
4042 // init json document
4143 JSONArray jsonArrayTerms = new JSONArray ();
42- Ontology ontology = OntologyUtil . parseOntology (oboFile );
44+ Ontology ontology = parseOntology (oboFile );
4345 SlimDirectedGraphView <Term > ontologySlim = ontology .getSlimGraphView ();
4446 HashSet <Term > rootChildren = new HashSet <Term >(ontologySlim .getChildren (ontology .getRootTerm ()));
4547
@@ -111,6 +113,28 @@ public static void main(String[] args) {
111113
112114 }
113115
116+ /**
117+ * @param oboFile
118+ * @return
119+ */
120+ private static Ontology parseOntology (String oboFile ) {
121+ OBOParser oboParser = null ;
122+ oboParser = new OBOParser (oboFile , OBOParser .PARSE_DEFINITIONS | OBOParser .PARSE_XREFS );
123+
124+ try {
125+ String parseInfo = oboParser .doParse ();
126+ System .out .println (parseInfo );
127+
128+ } catch (IOException | OBOParserException e ) {
129+ // TODO Auto-generated catch block
130+ e .printStackTrace ();
131+ }
132+ // get the complete hpo
133+ TermContainer termContainer = new TermContainer (oboParser .getTermMap (), oboParser .getFormatVersion (),
134+ oboParser .getDataVersion ());
135+ return Ontology .create (termContainer );
136+ }
137+
114138 /**
115139 * @param allSyns
116140 * @return
0 commit comments