1b074613b1c6b7f84953c3f490631b91d844c9a9 galt Thu Sep 8 22:40:20 2022 -0700 Adapting Angie's existing variant effects to the new dbSnp that uses SPDI and provided via json formatted data. So users can see variant effects with version 153 or later. refs #29989 diff --git src/hg/hgc/bigDbSnpClick.c src/hg/hgc/bigDbSnpClick.c index 25ca778..4800424 100644 --- src/hg/hgc/bigDbSnpClick.c +++ src/hg/hgc/bigDbSnpClick.c @@ -322,30 +322,58 @@ if (differentString(bds->chrom, otherBds->chrom) || bds->chromStart != otherBds->chromStart || bds->chromEnd != otherBds->chromEnd) { bedPrintPos((struct bed *)otherBds, 3, tdb); if (bb->next != NULL) puts("<br>"); } } puts("</p>"); } bptFileDetach(&bpt); lmCleanup(&lm); } +struct snp125 *bdsTosnp125(struct bigDbSnp *bds) +/* Copy over the bed6 plus observed fields. */ +{ +struct snp125 *snp125; +AllocVar(snp125); +snp125->chrom = cloneString(bds->chrom); +snp125->chromStart = bds->chromStart; +snp125->chromEnd = bds->chromEnd; +snp125->name = cloneString(bds->name); +snp125->refUCSC = cloneString(bds->ref); + +snp125->strand = cloneString("+"); + +struct dyString *dy = dyStringNew(0); +int i; +for (i = 0; i < bds->altCount; i++) + { + char *alt = bds->alts[i]; + if (i > 0) + dyStringPrintf(dy, "/"); + dyStringPrintf(dy, "%s", alt); + } +snp125->observed = cloneString(dyStringCannibalize(&dy)); + +return snp125; +} + + void doBigDbSnp(struct trackDb *tdb, char *rsId) /* Show details for bigDbSnp item. */ { int start = cartInt(cart, "o"); int end = cartInt(cart, "t"); char *fileOrUrl = hReplaceGbdb(trackDbSetting(tdb, "bigDataUrl")); if (isEmpty(fileOrUrl)) errAbort("bigDbSnpClick: trackDb is missing bigDataUrl setting"); struct bbiFile *bbi = bigBedFileOpenAlias(fileOrUrl, chromAliasFindAliases); boolean found = FALSE; char *chrom = cartString(cart, "c"); int ivStart = start, ivEnd = end; if (start == end) { // item is an insertion; expand the search range from 0 bases to 2 so we catch it: @@ -400,24 +428,29 @@ printf(" [%s]", minRepLeft); else printf(" [%s (left-shifted), %s (right-shifted)]", minRepLeft, minRepRight); } printf("</span>"); } puts("</td></tr>"); } if (bds->shiftBases > 0) printf("<td><b>Uncertainty in indel placement:</b></td><td>%d base%s</td></tr>\n", bds->shiftBases, (bds->shiftBases > 1 ? "s" : "")); if (details) printDbSnpDetails(bds, details, tdb); printf("<tr><td><b>Variation class/type:</b></td><td>%s</td></tr>\n", bigDbSnpClassToString(bds->class)); + puts("</table>"); printUcscNotes(bds->ucscNotes); + + struct snp125 *snp125 = bdsTosnp125(bds); + printSnp153Function(tdb, snp125); + printOtherMappings(bbi, bds, tdb); } if (!found) printf("No item %s starting at %s:%d\n", rsId, chrom, start+1); lmCleanup(&lm); bbiFileClose(&bbi); }