[Genome] Gene Ontology
Fan Hsu
fanhsu at soe.ucsc.edu
Fri Jan 11 08:29:30 PST 2008
Hi John,
The GO annotation is dynamically retrieved and displayed on the UCSC Genes
details page. Attached please find an abbreviated version of the C code
doing this.
If you are not familiar with C, just look at the SQL query which should give
you pretty good idea how we did it using the goaPart table in our go
database.
Fan.
static void goPrint(struct section *section,
struct sqlConnection *conn, char *geneId)
/* Print out GO annotations. */
{
struct sqlConnection *goConn = sqlConnect("go");
char query[512];
struct sqlResult *sr;
char **row;
static char *aspects[3] = {"F", "P", "C"};
static char *aspectNames[3] = {
"Molecular Function",
"Biological Process",
"Cellular Component",
};
int aspectIx;
for (aspectIx = 0; aspectIx < ArraySize(aspects); ++aspectIx)
{
boolean hasFirst = FALSE;
safef(query, sizeof(query),
"select term.acc,term.name"
" from goaPart,term"
" where goaPart.dbObjectId = '%s'"
" and goaPart.goId = term.acc"
" and goaPart.aspect = '%s'"
, acc, aspects[aspectIx]);
sr = sqlGetResult(goConn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
char *goID = row[0];
char *goTermName = row[1];
if (!hasFirst)
{
hPrintf("<B>%s:</B><BR>", aspectNames[aspectIx]);
hasFirst = TRUE;
}
hPrintf("<A HREF = \"");
hPrintf("http://amigo.geneontology.org/cgi-bin/amigo/go.cgi?view=details&sea
rch_constraint=terms&depth=0&query=%s", goID);
hPrintf("\" TARGET=_blank>%s</A> %s<BR>\n", goID, goTermName);
}
if (hasFirst)
hPrintf("<BR>");
sqlFreeResult(&sr);
}
sqlDisconnect(&goConn);
}
-----Original Message-----
From: genome-bounces at soe.ucsc.edu [mailto:genome-bounces at soe.ucsc.edu] On
Behalf Of John Bowes
Sent: Friday, 11 January, 2008 6:36 AM
To: genome at soe.ucsc.edu
Subject: [Genome] Gene Ontology
Hello,
I have spent a number of hours trying (unsuccessfully) to extract GO data
from for particular gene ids. My aim is to supply a list of gene ids, e.g.
PTPN22, and extract the three GO aspects (biological_process,
cellular_component and molecular_function). I have tried a number of times,
but do not get useful data (either no data, or a large volume of multiple
entries). I am sure this due to me not fully understanding the table
relationships. I have looked at related questions in the archives but could
not implement them.
One example would be PTPN22, this has two molecular_function and three
biological_processes when GO is searched manually. But I can't reproduce
this through the UCSC browser. Any help would be greatly appreciated.
You are doing a great job with this browser.
Thank you.
John Bowes
_______________________________________________
Genome maillist - Genome at soe.ucsc.edu
http://www.soe.ucsc.edu/mailman/listinfo/genome
More information about the Genome
mailing list