Lookup A Gene Ontology Definition With Biopython
3
15
Entering edit mode
11.4 years ago
anothergeek ▴ 180

What is the easiest way to lookup a GO term in Python, given the GO ID?

python biopython gene • 9.9k views
ADD COMMENT
0
Entering edit mode

currently biopython doesn't have support for GO. What do you want to do, exactly? what do you mean by 'lookup'?

ADD REPLY
0
Entering edit mode

It's not for Python 3.5 :(

ADD REPLY
17
Entering edit mode
11.4 years ago
brentp 23k

you can also use goatools in python:

it would look like:

>>> from goatools import obo_parser
>>> p = obo_parser.GODag('data/gene_ontology.1_2.obo')
>>> p['GO:0006915'].name
'apoptosis'

you'll just have to download the obo from here.

ADD COMMENT
0
Entering edit mode

Very interesting to know :)

ADD REPLY
0
Entering edit mode

Very interesting to know :) Is there a way in goatools to do statistical testing on a set and a subset of genes to know if the subset contains over-representated functions?

ADD REPLY
0
Entering edit mode

Didn't know about goatools, will have to investigate further. Thanks :)

ADD REPLY
16
Entering edit mode
11.4 years ago

You could use the QuickGO web services. These tools allow you to quickly download relevant information, given a GO ID.

For instance, take the ID GO:0006915.

import urllib
from xml.etree import cElementTree as ElementTree

def get_go_name(go_id):
    #get the GO entry as XML
    xml = urllib.urlopen("http://www.ebi.ac.uk/QuickGO/GTerm?id=GO:"+go_id+"&format=oboxml")
    #open in cElementTree, for fast XML parsing
    for event, element in ElementTree.iterparse(xml):
        #need to make sure we are getting the name contained within the 'term' entry
        if element.tag == 'term':
            for child in element.getchildren():
                #this is the name of the GO ID in the URL above.
                if child.tag == 'name':
                    return child.text

print get_go_name('0006915')

This script should print 'apoptosis'.

ADD COMMENT
2
Entering edit mode
8.8 years ago
ric ▴ 100

Is goatools still the most up to date python package?

Any idea how the files in goatools / data / on Github were created?

How would it be possible to use plotgoterm.py (from goatools) to create input files for Cytoscape or VisANT ?

ADD COMMENT

Login before adding your answer.

Traffic: 2592 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6