The OBO file is just a text file. Look at its structure to get an idea on how to parse it. Basically, you locate your GO term and find the name_space field associated with it. The alternative would be to query the GO term MySQL database which you can also download and set up on a local MySQL instance.
I have a list of gene ontology IDs (As GO:0016021, GO:0005515), and I would like to group them based on their root annotation to Biological process, Cellular component or Molecular function.
The desired result is GO:0016021 Cellular Component or CC
GO:0005515 Molecular Function or MF
Is there any easy way?
5 answers
I think this is what you might be looking for this It seems that this mapper can actually take the GO terms and map it to the corresponding categories based on the GOslim categories. You can take a look at this or this (only restricted use for yeast though)
Added : I would like to add another thread to this answer from Pierre, he always amazes me with his works. Take a look at here how to use a bash script to do the work
Would you please guide me how can I extract from there? Just some hints... many thanks
Thanks... I used the MySQL and did the work.
Yes but since the OP has lots of terms manually doing it will not be a good choice here, instead as I have edited my answer about a thread which @Pierre Lindenbaum wrote with QuckGo from ebi should also be doing the trick.
Ok, you never said you have lots of terms. :) .... anyway, the OLS also offers an API, so you can get the information also via programming. However, if you already solved your problem, I guess you are fine.
You can use clusterProfiler:
> require(clusterProfiler)
Loading required package: clusterProfiler
Loading required package: DOSE
Loading required package: DBI
> go=c('GO:0016021', 'GO:0005515')
> go2term(go)
go_id Term
1 GO:0005515 protein binding
2 GO:0016021 integral component of membrane
> go2ont(go)
go_id Ontology
1 GO:0005515 MF
2 GO:0016021 CC
> go2ont(go) -> x
> with(x, split(go_id, Ontology))
$CC
[1] "GO:0016021"
$MF
[1] "GO:0005515"
Log in to answer this question.