This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Retrieve GO terms ontology

Hi, I have a list of 141 GO terms. I downloaded them from biomart ensembl (GOAslim). I want to know if there is an easy way to have their top ontology(cellular component, molecular function, biological process). For each term I would like to have:

GO:XXXXXX1 is a cellular component

GO:XXXXXX2 is a molecular function

GO:XXXXXX3 is a biological process

I have made some research but I havn't found easy way to do it. Before going to "complicate job" I wonder if there is a simple way, or a tools to doing this.

go

2 answers

Using bash and quickgo:

function fun1
    {
    TERM=`curl -s "https://www.ebi.ac.uk/QuickGO/GTerm?id=${1}&format=oboxml" | xmllint --xpath 'normalize-space(//is_a[1]/text())' - `
    if [[ ${TERM} == "" ]] ; then echo "$1" ; else   fun1 "${TERM}" ; fi
    }

while read A
do
    echo -n "${A} "
    fun1 "${A}"
done

example:

echo -e "GO:0003674\nGO:0097159" | bash go.sh
GO:0003674 GO:0003674
GO:0097159 GO:0003674

Keep getting amazed of your xml manipulation fluency.

Thanks that exactly what I was looking for! you get me out of trouble .

Check out GOParGenPy tool or download the annotation file for your species and extract information with gawk or your favorite language: http://geneontology.org/page/download-annotations

The data is in Geneontology Annotation Format: http://geneontology.org/page/go-annotation-file-format-20 And the columns you want to extract are column 5 and 9.

thanks for your answers but I already have GO annotation for a subset of gene. My trouble was to know in which ontology they are (cellular component, molecular function, biological process).

Hi, please use following steps in R:

ids <- c("GO:2000096", "GO:2000145", "GO:2001020")  #### your GO ids
    library(GO.db)
    head(select(GO.db, ids, "ONTOLOGY"))
    output will be:
            GOID ONTOLOGY
    1 GO:2000096       BP
    2 GO:2000145       BP
    3 GO:2001020       BP

where
BP= biological process
MF= molecular function

etc... Hope this will help you..

thanks for you answer I already have my result with Pierre Lindenbaum answer but it is always nice to discover new library!

Just to clarify: GOParGenPy: Despite the name, the tools is actually more useful to extract annotation and combine various annotation information. Both using GOParGenPy and the manual method can save running time and make you less dependent on the queries over internet.

It is a very interresting tool thanks again !

Log in to answer this question.