cb4c07053e54b499a0a6270e2e435295ebf27253 angie Mon Mar 14 11:51:21 2011 -0700 Track #1684 (SNPs 132 (dbSNP)): oops, overwriting snp125->name whenchimp allele is added (in dbb7cbfd) caused the name+allele string to be passed to hgc as the item name, which causes an errAbort because the item can't be found. So now we need a mapItemName that strips off the allele string if any is added. diff --git src/hg/hgTracks/variation.c src/hg/hgTracks/variation.c index 695a9d5..d265d7a 100644 --- src/hg/hgTracks/variation.c +++ src/hg/hgTracks/variation.c @@ -514,30 +514,43 @@ continue; } /* update the snp->name with the ortho data */ dyStringPrintf(extra, "%s %s>%s", snpItem->name, orthoItem->chimp, snpItem->observed); snpItem->name = cloneString(extra->string); dyStringClear(extra); /* increment the list pointers */ snpItem = snpItem->next; orthoItem = orthoItem->next; } freeDyString(&extra); sqlFreeResult(&sr); hFreeConn(&conn); } +static char *snp125MapItemName(struct track *tg, void *item) +/* Now that snp125->name is overwritten when adding chimp allele suffix, we need + * to strip it back off for links to hgc. */ +{ +static char mapName[256]; +struct snp125 *snp = item; +safecpy(mapName, sizeof(mapName), snp->name); +char *ptr = strchr(mapName, ' '); +if (ptr != NULL) + *ptr = '\0'; +return mapName; +} + static Color snp132ColorByAlleleFreq(struct snp132Ext *snp, struct hvGfx *hvg) /* If snp has allele freq data, return a shade from red (rare) to blue (common); * otherwise return black. */ { static boolean colorsInited = FALSE; static Color redToBlue[EXPR_DATA_SHADES]; static struct rgbColor red = {255, 0, 0}; static struct rgbColor blue = {0, 0, 255}; if (!colorsInited) hvGfxMakeColorGradient(hvg, &red, &blue, EXPR_DATA_SHADES, redToBlue); if (snp->alleleFreqCount > 0) { float majorAlF = snp132MajorAlleleFreq(snp); // >2 common alleles (e.g. at VNTR sites) can cause low major allele freq; // cap at 0.5 to avoid overflow in the shade calculation. @@ -1325,30 +1338,31 @@ { tg->drawItems = snpDrawItems; tg->drawItemAt = snpDrawItemAt; tg->loadItems = loadSnp; tg->freeItems = freeSnp; tg->itemColor = snpColor; tg->itemNameColor = snpColor; } void snp125Methods(struct track *tg) { tg->drawItems = snpDrawItems; tg->drawItemAt = snp125DrawItemAt; tg->freeItems = freeSnp125; tg->loadItems = loadSnp125; +tg->mapItemName = snp125MapItemName; tg->itemNameColor = snp125Color; tg->itemColor = snp125Color; } char *perlegenName(struct track *tg, void *item) /* return the actual perlegen name, in form xx/yyyy: cut off xx/ and return yyyy */ { char *name; struct linkedFeatures *lf = item; name = strstr(lf->name, "/"); if (name != NULL) name ++; if (name != NULL) return name;