A while ago I was asked the same question with solution preferably in python and I came up with this:
Get Orange-Bioinformatics python library:
pip install --user Orange-Bioinformatics
Get database of go terms:
wget http://purl.obolibrary.org/obo/go.obo
Produce a table with two columns, child_term, parent_term:
python
import Orange.bio.obiOntology
obi= Orange.bio.obiOntology.OBOOntology('go.obo')
all_terms= obi.terms()
fout= open('go.obo.paired.txt', 'w')
fout.write('child_term\tparent_term\n')
for t in all_terms:
parents= obi.super_terms(t)
if len(parents) == 0:
fout.writet.id + '\t' + 'NA' + '\n')
else:
for p in parents:
fout.writet.id + '\t' + p.id + '\n')
fout.close()
len(all_terms)
quit()
Output table file looks like this. It should be fairly easy from here to get all children of a parent or vice-versa using e.g. grep
:
child_term parent_term
GO:0000001 GO:1902589
GO:0000001 GO:0071840
GO:0000001 GO:0007005
GO:0000001 GO:0051641
GO:0000001 GO:0016043
GO:0000001 GO:0044763
GO:0000001 GO:1902580
GO:0000001 GO:1902578
Hope this helps.
Hello animesh_10kuet!
It appears that your post has been cross-posted to another site: http://stackoverflow.com/questions/38178531
This is typically not recommended as it runs the risk of annoying people in both communities.