What is the easiest way to lookup a GO term in Python, given the GO ID?
What is the easiest way to lookup a GO term in Python, given the GO ID?
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'
.
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 ?
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
currently biopython doesn't have support for GO. What do you want to do, exactly? what do you mean by 'lookup'?
It's not for Python 3.5 :(