6da74d6034610d2ce3fe7ac708110c0e0e3d3a1c kate Tue Mar 2 17:02:43 2021 -0800 Define string literal for multi-region chrom name. refs #26385 diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 035b380..8557e06 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -2687,31 +2687,31 @@ *pChrom = cloneString(vPos); *pStart = atoi(colon+1) - 1; *pEnd = atoi(dash+1); } char *disguisePositionVirtSingleChrom(char *position) // DISGUISE VMODE /* Hide the virt position, convert to real single chrom span. * position should be virt chrom span. * Can handle anything in the virt single chrom. */ { /* parse Virt position */ char *chrom = NULL; long start = 0; long end = 0; parseVPosition(position, &chrom, &start, &end); -if (!sameString(chrom, "multi")) +if (!sameString(chrom, MULTI_REGION_VIRTUAL_CHROM_NAME)) return position; // return original struct window *windows = makeWindowListFromVirtChrom(start, end); char *nonVirtChromName = windows->chromName; if (!sameString(nonVirtChromName, chromName)) return position; // return original int nonVirtWinStart = windows->winStart; int nonVirtWinEnd = windows->winEnd; struct window *w; for (w=windows->next; w; w=w->next) { if (!sameString(w->chromName, nonVirtChromName)) return position; // return original if (w->winEnd < nonVirtWinEnd) return position; // return original nonVirtWinEnd = w->winEnd; @@ -3061,31 +3061,32 @@ nonVirtWinEnd = w->winEnd; } // TODO Also consider preserving the original bases in windows width (with clipping). char nvPos[256]; safef(nvPos, sizeof nvPos, "%s:%d-%d", nonVirtChromName, nonVirtWinStart+1, nonVirtWinEnd); return cloneString(nvPos); } char *nonVirtPositionFromHighlightPos() /* Must have created the virtual chrom first. * Currently just a hack to use windows, * use the (first) window(s) from that to get real chrom name start end */ { struct highlightVar *h = parseHighlightInfo(); -if (!(h && h->db && sameString(h->db, database) && sameString(h->chrom,"multi"))) +if (!(h && h->db && sameString(h->db, database) && + sameString(h->chrom, MULTI_REGION_VIRTUAL_CHROM_NAME))) return NULL; struct window *windows = makeWindowListFromVirtChrom(h->chromStart, h->chromEnd); char *nonVirtChromName = windows->chromName; int nonVirtWinStart = windows->winStart; int nonVirtWinEnd = windows->winEnd; // Extending this through more of the windows, // if it is on the same chrom and maybe not too far separated. struct window *w; for (w=windows->next; w; w=w->next) { if (sameString(w->chromName, nonVirtChromName) && w->winEnd > nonVirtWinEnd) nonVirtWinEnd = w->winEnd; } @@ -9462,31 +9463,32 @@ } void remapHighlightPos() // Remap non-virt highlight position if any to new virtMode chrom. { if (virtualSingleChrom()) return; struct highlightVar *h = parseHighlightInfo(); if (h && h->db && sameString(h->db, database)) { long virtStart = 0, virtEnd = 0; if (findNearestVirtMatch(h->chrom, h->chromStart, h->chromEnd, FALSE, &virtStart, &virtEnd)) // try to find the nearest match { // save new highlight position to cart var char cartVar[1024]; - safef(cartVar, sizeof cartVar, "%s.%s:%ld-%ld#%s", h->db, "multi", virtStart, virtEnd, h->hexColor); + safef(cartVar, sizeof cartVar, "%s.%s:%ld-%ld#%s", h->db, MULTI_REGION_VIRTUAL_CHROM_NAME, + virtStart, virtEnd, h->hexColor); cartSetString(cart, "highlight", cartVar); } else { // erase the highlight cartvar if it has no overlap with the new virt chrom cartRemove(cart, "highlight"); } } } void tracksDisplay() /* Put up main tracks display. This routine handles zooming and * scrolling. */ {