94ab45bc69a304d7f68851812e96de7af8943f6d angie Wed Mar 9 13:12:36 2016 -0800 Libified hgVai's code to find the latest snpNNN table so that other spots in the code could use it instead of hardcoding version numbers. Thx Matt for pointing out the hardcoding. refs #16777 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 5764325..ab54b3a 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -10524,42 +10524,42 @@ dbSnpId = cloneString("-"); printf("<BR>\n"); sqlSafef(query, sizeof(query), "select dbSnpId from omimAvRepl where avId='%s'", avId); sr = sqlMustGetResult(conn, query); row = sqlNextRow(sr); if (row != NULL) { dbSnpId = cloneString(row[0]); } sqlFreeResult(&sr); if (!sameWord(dbSnpId, "-")) { - printf("<B>dbSNP:</B> \n"); - if (sameWord(database, "hg18")) - { - printf("<A HREF=\"%s%s\" >", - "../cgi-bin/hgc?g=snp130&i=", dbSnpId); - } + char *snpTable = hFindLatestSnpTable(database, NULL); + if (snpTable != NULL) + // NOTE: dbSnpId is not guaranteed to be found in snpTable and it might be + // a better idea to always link directly to dbSNP. + printf("<B>dbSNP:</B> \n" + "<A HREF=\"../cgi-bin/hgc?hgsid=%s&g=%s&i=%s\">%s</A>", + cartSessionId(cart), snpTable, dbSnpId, dbSnpId); else { - printf("<A HREF=\"%s%s\" >", - "../cgi-bin/hgc?g=snp144&i=", dbSnpId); + puts("<B>dbSNP:</B> "); + printDbSnpRsUrl(dbSnpId, "%s", dbSnpId); } - printf("%s</A></B>", dbSnpId); } } printf("<HR>"); printPosOnChrom(chrom, atoi(chromStart), atoi(chromEnd), NULL, FALSE, itemName); } void doOmimAvSnp(struct trackDb *tdb, char *item) /* Put up OmimGene track info. */ { genericHeader(tdb, item); printOmimAvSnpDetails(tdb, item, FALSE); printTrackHtml(tdb); }