Created
May 22, 2013 16:15
-
-
Save charlycoste/5628858 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import _mysql | |
import sys | |
con = "" | |
try: | |
con = _mysql.connect( host='mysql.ebi.ac.uk', | |
port=4085, | |
user='go_select', | |
passwd='amigo', | |
db='go_latest') | |
con.query("""SELECT DISTINCT descendant.acc, descendant.name, descendant.term_type | |
FROM | |
term | |
INNER JOIN graph_path ON (term.id=graph_path.term1_id) | |
INNER JOIN term AS descendant ON (descendant.id=graph_path.term2_id) | |
WHERE term.name='nucleus' AND distance <> 0 ;""") | |
result = con.use_result() | |
print "MySQL version: %s" % \ | |
result.fetch_row() | |
except _mysql.Error, e: | |
print "Error %d: %s" % (e.args[0], e.args[1]) | |
sys.exit(1) | |
finally: | |
if con: | |
con.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment