This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Parsing Obo File

Want to parse OBO and do the following: 1. get nodes in each level. 2. get nodes all the nodes that exist in levels below 3 till leaf. Where root is always a node in level 3 for all the nodes below it.

Can some one please help me to write code in Java.

I tried using GO4J but not able to figure out how to use the API's. Please let me know if there is any other library that can help me to do the above and other OBO graph navigation.

Thanking you,

parsing

3 answers

If you are Perl fan, you can also do parsing of obo files using ONTO-PERL

1. get nodes in each level

Use this script to extract child terms for given term / ID

2. get nodes all the nodes that exist in levels below 3 till leaf. Where root is always a node in level 3 for all the nodes below it.

Not sure what you are trying to do in this step. You can do most of the .obo parsing using this module. It is one of the extensively documented Perl module that I have used. See Documentations sections and various examples.

Manuscript here

Here is a simple-and-stupid OBO parser , it could be used to do what you want:

https://gist.github.com/2762967


test:

$ curl -s "http://www.geneontology.org/ontology/obo_format_1_2/gene_ontology_ext.obo" | java Biostar45366 | tail -20

11  GO:0048910  afferent axon development in anterior lateral line nerve    [GO:0048893]
11  GO:0070979  protein K11-linked ubiquitination   [GO:0000209]
11  GO:0070936  protein K48-linked ubiquitination   [GO:0000209]
11  GO:0017116  single-stranded DNA-dependent ATP-dependent DNA helicase activity   [GO:0043142, GO:0004003]
11  GO:0000167  activation of MAPKKK activity involved in osmosensory signaling pathway [GO:0000185]
11  GO:0000197  activation of MAPKKK activity involved in cell wall biogenesis  [GO:0000185]
11  GO:0031449  regulation of slow-twitch skeletal muscle fiber contraction [GO:0014724]
11  GO:0031446  regulation of fast-twitch skeletal muscle fiber contraction [GO:0014724]
11  GO:0035752  lysosomal lumen pH elevation    [GO:0035751, GO:0051454]
12  GO:0008635  activation of cysteine-type endopeptidase activity involved in apoptotic process by cytochrome c    [GO:0006919]
12  GO:0001310  extrachromosomal rDNA circle accumulation involved in replicative cell aging    [GO:0001307]
12  GO:0070244  negative regulation of thymocyte apoptotic process  [GO:0070233, GO:0070243]
12  GO:0070245  positive regulation of thymocyte apoptotic process  [GO:0070243, GO:0070234]
12  GO:0090390  phagosome acidification involved in apoptotic cell clearance    [GO:0090383]

GO:0071948  activation-induced B cell apoptotic process [GO:0001783]
GO:0001783  B cell apoptotic process    [GO:0070227]
GO:0002516  B cell deletion [GO:0001783]
GO:0002901  mature B cell apoptotic process [GO:0001783]
GO:0002454  peripheral B cell deletion  [GO:0002516]
GO:0002342  central B cell deletion [GO:0002516]

Thank you so much. This should indeed help.

Will get back to you.

Pradeep: This should be a comment, not an answer. Please repost this as a comment and delete this "answer".

Log in to answer this question.