e67106d5cf1204021cada70c1ca43a92bd3b346d chmalee Wed Aug 21 16:54:25 2019 -0700 Adding links to dbSnp hgc pages if the position is supported over at MuPIT, refs #24020 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 167fb73..ef89bc2 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -18499,30 +18499,54 @@ struct trackDb *gcTdb = hashFindVal(trackHash, gcTable); if (gcTdb != NULL) { printf(">%s SNP \n", gcTdb->shortLabel); } } } } +static void checkForMupit(struct sqlConnection *conn, struct trackDb *tdb, int start) +/* Print a link to MuPIT if the item is in the mupitRanges table */ +{ +if (sqlTableExists(conn, "mupitRanges")) + { + char *doLink = NULL; + char query[512]; + sqlSafef(query, sizeof(query), + "select * from mupitRanges where chrom='%s' and chromStart <= %d and chromEnd >= %d", + seqName, start, start); + doLink = sqlQuickString(conn, query); + if (doLink != NULL) + { + int mupitPosition = start + 1; // mupit uses 1-based coords + printf(""); + if (sameString(database, "hg19")) + printf("", seqName, mupitPosition); + else if (sameString(database, "hg38")) + printf("", seqName, mupitPosition); + printf("MuPIT Structure\n"); + } + } +} + void printOtherSnpMappings(char *table, char *name, int start, struct sqlConnection *conn, int rowOffset) /* If this SNP (from any bed4+ table) is not uniquely mapped, print the other mappings. */ { char query[512]; sqlSafef(query, sizeof(query), "select * from %s where name='%s'", table, name); struct sqlResult *sr = sqlGetResult(conn, query); int snpCount = 0; char **row; while ((row = sqlNextRow(sr)) != NULL) { struct bed *snp = bedLoad3(row + rowOffset); if (snp->chromStart != start || differentString(snp->chrom, seqName)) { @@ -18566,30 +18590,31 @@ printf("
\n"); printSnp125Info(tdb, snp, version); doSnpEntrezGeneLink(tdb, itemName); } else errAbort("SNP %s not found at %s base %d", itemName, seqName, start); sqlFreeResult(&sr); printOtherSnpMappings(table, itemName, start, conn, rowOffset); puts("
"); // Make table for collapsible sections: puts(""); checkForGwasCatalog(conn, tdb, itemName); checkForHgdpGeo(conn, tdb, itemName, start); checkForHapmap(conn, tdb, itemName); +checkForMupit(conn, tdb, start); printSnpAlignment(tdb, snpAlign, version); puts("
"); printTrackHtml(tdb); hFreeConn(&conn); } void doTigrGeneIndex(struct trackDb *tdb, char *item) /* Put up info on tigr gene index item. */ { char *animal = cloneString(item); char *id = strchr(animal, '_'); char buf[128]; if (id == NULL)