84052670e60a22211510df04f8ac91045e2f9a00
fanhsu
Mon May 23 09:30:35 2011 -0700
Revamped omimGene2 processing logic and minor edits of links to OMIM page at omim.org.
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 6b1b65c..5bec707 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -9361,53 +9361,49 @@
printf("", "../cgi-bin/hgGene?hgg_gene=", row[0]);
printf("%s", row[0]);
printedCnt++;
}
if (printedCnt >= 1) printf("
\n");
}
sqlFreeResult(&sr);
}
}
printf("
");
printPosOnChrom(chrom, atoi(chromStart), atoi(chromEnd), NULL, FALSE, itemName);
}
void printOmimGene2Details(struct trackDb *tdb, char *itemName, boolean encode)
-/* Print details of an OMIM Class 3 Gene entry. */
+/* Print details of an omimGene2 entry. */
{
struct sqlConnection *conn = hAllocConn(database);
-struct sqlConnection *conn2 = hAllocConn(database);
char query[256];
struct sqlResult *sr;
char **row;
char *url = tdb->url;
-char *kgId= NULL;
char *title1 = NULL;
char *title2 = NULL;
char *geneSymbol = NULL;
char *chrom, *chromStart, *chromEnd;
-char *kgDescription = NULL;
-char *refSeq;
chrom = cartOptionalString(cart, "c");
chromStart = cartOptionalString(cart, "o");
chromEnd = cartOptionalString(cart, "t");
if (url != NULL && url[0] != 0)
{
- printf("OMIM Gene: ");fflush(stdout);
+ printf("OMIM page at omim.org: ");fflush(stdout);
printf("", url, itemName);
printf("%s", itemName);
safef(query, sizeof(query),
"select title1, title2 from omimGeneMap where omimId=%s;", itemName);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
{
if (row[0] != NULL)
{
title1 = cloneString(row[0]);
printf(" %s", title1);
}
if (row[1] != NULL)
{
@@ -9420,168 +9416,115 @@
printf("
\n");
printf("OMIM page at NCBI: ");
printf("", ncbiOmimUrl, itemName);
printf("%s
", itemName);
safef(query, sizeof(query),
"select geneSymbol from omimGeneMap where omimId=%s;", itemName);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
{
geneSymbol = cloneString(row[0]);
}
sqlFreeResult(&sr);
- /* get corresponding KG ID */
- safef(query, sizeof(query),
- "select k.transcript from knownCanonical k where k.chrom='%s' and k.chromStart=%s and k.chromEnd=%s",
- chrom, chromStart, chromEnd);
- sr = sqlMustGetResult(conn, query);
- row = sqlNextRow(sr);
- if (row != NULL)
- {
- kgId = cloneString(row[0]);
- }
- sqlFreeResult(&sr);
-
- /* use geneSymbol from omimMorbidMap if available */
if (geneSymbol!= NULL)
{
boolean disorderShown;
char *phenotypeClass, *phenotypeId, *disorder;
printf("Gene symbol(s): %s", geneSymbol);
printf("
\n");
- /* display disorder for genes in morbidmap */
+ /* display disorder(s) */
safef(query, sizeof(query),
"select description, phenotypeClass, phenotypeId from omimPhenotype where omimId=%s order by description",
itemName);
sr = sqlMustGetResult(conn, query);
disorderShown = FALSE;
while ((row = sqlNextRow(sr)) != NULL)
{
if (!disorderShown)
{
printf("Disorder(s):\n");
disorderShown = TRUE;
}
disorder = row[0];
phenotypeClass = row[1];
phenotypeId = row[2];
printf("- %s", disorder);
if (phenotypeId != NULL)
{
if (!sameWord(phenotypeId, "-1"))
{
printf(" (phenotype ", url, phenotypeId);
printf("%s
)", phenotypeId);
}
}
printf("
\n");
}
if (disorderShown) printf("\n");
sqlFreeResult(&sr);
}
- else
- {
- /* display gene symbol(s) from omimGenemap */
- safef(query, sizeof(query), "select geneSymbol from omimGeneMap where omimId=%s;", itemName);
- sr = sqlMustGetResult(conn, query);
- row = sqlNextRow(sr);
- if (row != NULL)
- {
- printf("OMIM Gene Symbol: %s", row[0]);
- printf("
\n");
- sqlFreeResult(&sr);
- }
- else
- {
- /* get gene symbol from kgXref if the entry is not in morbidmap and omim genemap */
- safef(query, sizeof(query), "select geneSymbol from kgXref where kgId='%s';", kgId);
+ // show RefSeq Gene link(s)
+ safef(query, sizeof(query),
+ "select distinct r.name from refLink l, mim2gene g, refGene r where l.omimId=%s and g.geneId=l.locusLinkId and g.entryType='gene' and chrom='%s' and txStart = %s and txEnd= %s",
+ itemName, chrom, chromStart, chromEnd);
sr = sqlMustGetResult(conn, query);
- row = sqlNextRow(sr);
- if (row != NULL)
- {
- printf("UCSC Gene Symbol: %s", row[0]);
- printf("
\n");
- }
- sqlFreeResult(&sr);
- }
- }
-
- if (kgId != NULL)
+ if (sr != NULL)
{
- printf("UCSC Canonical Gene: ");
- printf("",
- "../cgi-bin/hgGene?hgg_gene=", kgId);
- printf("%s ", kgId);
-
- safef(query, sizeof(query), "select refseq from kgXref where kgId='%s';", kgId);
- sr = sqlMustGetResult(conn, query);
- row = sqlNextRow(sr);
- if (row != NULL)
+ int printedCnt;
+ printedCnt = 0;
+ while ((row = sqlNextRow(sr)) != NULL)
{
- refSeq = strdup(row[0]);
- kgDescription = gbCdnaGetDescription(conn2, refSeq);
+ if (printedCnt < 1)
+ printf("RefSeq Gene(s): ");
+ else
+ printf(", ");
+ printf("", "../cgi-bin/hgc?g=refGene&i=", row[0], chromStart, chromEnd);
+ printf("%s", row[0]);
+ printedCnt++;
}
- sqlFreeResult(&sr);
- hFreeConn(&conn2);
-
- if (kgDescription == NULL)
- {
- safef(query, sizeof(query), "select description from kgXref where kgId='%s';", kgId);
- sr = sqlMustGetResult(conn, query);
- row = sqlNextRow(sr);
- if (row != NULL)
- {
- printf("%s", row[0]);
+ if (printedCnt >= 1) printf("
\n");
}
-
sqlFreeResult(&sr);
- }
- else
- {
- printf("%s", kgDescription);
- }
- printf("
\n");
+ // show Related UCSC Gene links
safef(query, sizeof(query),
- "select i.transcript from knownIsoforms i, knownCanonical c where c.transcript='%s' and i.clusterId=c.clusterId and i.transcript <>'%s'",
- kgId, kgId);
+ "select distinct kgId from kgXref x, refLink l, mim2gene g where x.refseq = mrnaAcc and l.omimId=%s and g.omimId=l.omimId and g.entryType='gene'",
+ itemName);
sr = sqlMustGetResult(conn, query);
if (sr != NULL)
{
int printedCnt;
printedCnt = 0;
while ((row = sqlNextRow(sr)) != NULL)
{
if (printedCnt < 1)
- printf("Other UCSC Gene(s) in the same cluster: ");
+ printf("Related UCSC Gene(s): ");
else
printf(", ");
printf("", "../cgi-bin/hgGene?hgg_gene=", row[0]);
printf("%s", row[0]);
printedCnt++;
}
if (printedCnt >= 1) printf("
\n");
}
sqlFreeResult(&sr);
}
- }
printf("
");
printPosOnChrom(chrom, atoi(chromStart), atoi(chromEnd), NULL, FALSE, itemName);
}
void printOmimLocationDetails(struct trackDb *tdb, char *itemName, boolean encode)
/* Print details of an OMIM Class 3 Gene entry. */
{
struct sqlConnection *conn = hAllocConn(database);
struct sqlConnection *conn2 = hAllocConn(database);
char query[256];
struct sqlResult *sr;
char **row;
char *url = tdb->url;
char *kgId= NULL;
@@ -9589,31 +9532,31 @@
char *title2 = NULL;
char *geneSymbol = NULL;
char *chrom, *chromStart, *chromEnd;
char *kgDescription = NULL;
char *refSeq;
char *omimId;
chrom = cartOptionalString(cart, "c");
chromStart = cartOptionalString(cart, "o");
chromEnd = cartOptionalString(cart, "t");
omimId = itemName;
if (url != NULL && url[0] != 0)
{
- printf("OMIM Entry ");fflush(stdout);
+ printf("OMIM page at omim.org: ");fflush(stdout);
printf("", url, itemName);
printf("%s", itemName);
safef(query, sizeof(query),
"select title1, title2 from omimGeneMap where omimId=%s;", itemName);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
{
if (row[0] != NULL)
{
title1 = cloneString(row[0]);
printf(": %s", title1);
}
if (row[1] != NULL)
{
@@ -9837,31 +9780,31 @@
title1 = cloneString(row[0]);
}
if (row[1] != NULL)
{
title2 = cloneString(row[1]);
}
avDesc = cloneString(row[3]);
}
sqlFreeResult(&sr);
printf("OMIM Allelic Variant: ");
printf("", url, avString);
printf("%s", avId);
printf(" %s", avDesc);
- printf("
OMIM Entry ");
+ printf("
OMIM page at omim.org: ");
printf("", url, itemName);
printf("%s", itemName);
if (title1 != NULL) printf(": %s", title1);
if (title2 != NULL) printf(" %s ", title2);
printf("
\n");
printf("OMIM page at NCBI: ");
printf("", ncbiOmimUrl, itemName);
printf("%s
", itemName);
safef(query, sizeof(query),
"select replStr from omimAvRepl where avId=%s;", avId);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)