e3fb0aba1be876cee6d93465cc0e585dac75529a galt Thu Jun 30 17:40:34 2016 -0700 fixes #17617. Just changed customUrl mode to act like em and gm. instead of trying to have the user switch to a full-virt-chrom view, it simply tries to find the nearest position, which is just what em and gm modes do. diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 9c42a73..b47d0c4 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -4001,50 +4001,30 @@ v->start = bed->chromStart + bed->chromStarts[e]; v->end = v->start + bed->blockSizes[e]; slAddHead(&virtRegionList, v); } } } lineFileClose(&lf); bedFreeList(&bedList); slReverse(&virtRegionList); if (bedPadding > 0) padVirtRegions(bedPadding); return TRUE; } -// TODO OBSOLETED by lastDbPosCart -boolean restoreCartSetting(char *cartSetting) -/* Restore cart setting from var=val setting. */ -{ -if (!cartSetting) - return FALSE; -char *eq = strchr(cartSetting,'='); -if (!eq) // nothing to do - return FALSE; -*eq = 0; -char *cartVar = cartSetting; -char *cartVal = eq+1; -if (sameString(cartVal, "(null)")) - cartRemove(cart, cartVar); -else - cartSetString(cart, cartVar, cartVal); -*eq = '='; -return TRUE; -} - void restoreSavedVirtPosition() /* Set state from lastDbPosCart. * This involves parsing the extra state that was saved.*/ { struct hashEl *el, *elList = hashElListHash(lastDbPosCart->hash); for (el = elList; el != NULL; el = el->next) { char *cartVar = el->name; char *cartVal = cartOptionalString(lastDbPosCart, cartVar); if (cartVal) { /* do we need this feature? if (sameString(cartVal,"(null)")) cartRemove(cart, cartVar); @@ -4066,34 +4046,30 @@ void dySaveCartSetting(struct dyString *dy, char *cartVar, boolean saveBoth) /* Grab var and value from cart, save as var=val to dy string. */ { if (dy->stringSize > 0) dyStringAppend(dy, " "); dyStringPrintf(dy, "%s=%s", cartVar, cartUsualString(cart, cartVar, NULL)); if (saveBoth) lastDbPosSaveCartSetting(cartVar); } boolean initRegionList() /* initialize window list */ { -// TODO GALT -// update, well by 2015-04-28 it seems like we are not going to support windows from other assemblies -// due to difficulties with tracklist. - struct virtRegion *v; virtRegionList = NULL; virtModeExtraState = ""; // This is state that determines if the virtChrom has changed lastDbPosCart = cartOfNothing(); // USED to store and restore cart settings related to position and virtMode struct dyString *dy = dyStringNew(256); // used to build virtModeExtraState if (sameString(virtModeType, "default")) { // Single window same as normal window // mostly good to test nothing was broken with single window AllocVar(v); v->chrom = chromName; v->start = 0; v->end = hChromSize(database, chromName); @@ -4224,33 +4200,30 @@ { // demo two windows on two chroms (default posn chr21, and same loc on chr22 //chr21:33,031,597-33,041,570 AllocVar(v); //chr21:33,031,597-33,041,570 v->chrom = "chr21"; v->start = 33031597 - 1; v->end = 33041570; slAddHead(&virtRegionList, v); struct virtRegion *v2; AllocVar(v2); //chr22:33,031,597-33,041,570 - //window2->organism = "Mouse"; - //window2->database = "mm10"; - //window2->database = "hg38"; v2->chrom = "chr22"; v2->start = 33031597 - 1; v2->end = 33041570; slAddHead(&virtRegionList, v2); slReverse(&virtRegionList); } else if (sameString(virtModeType, "demo2")) { // demo multiple (70) windows on one chrom chr21 def posn, window size and step exon-like initExonStep(); } else if (sameString(virtModeType, "demo4")) { // demo multiple (20) windows showing exons from TITIN gene uc031rqd.1. @@ -8785,55 +8758,58 @@ virtMode = FALSE; } else { // ENTERING VIRTMODE // First time initialization findNearest = TRUE; // For now, do this manually here: // sets window to full genome size, which for these demos should be small except for allChroms - if (sameString(virtModeType, "exonMostly") || sameString(virtModeType, "geneMostly") || sameString(virtModeType, "kcGenes")) // create 1k window near middle of vchrom + if (sameString(virtModeType, "exonMostly") || sameString(virtModeType, "geneMostly") + || sameString(virtModeType, "customUrl") || sameString(virtModeType, "kcGenes")) { // trying to find best vchrom location corresponding to chromName, winStart, winEnd); // try to find the nearest match if (!(chromName && findNearestVirtMatch(chromName, winStart, winEnd, findNearest, &virtWinStart, &virtWinEnd))) - { + { // create 1k window near middle of vchrom warn("Unable to find any region near the position on the chromosome in the multi-regions. Now using middle of view."); virtWinStart = virtSeqBaseCount / 2; virtWinEnd = virtWinStart + 1000; if (virtWinEnd > virtSeqBaseCount) virtWinEnd = virtSeqBaseCount; } virtMode = TRUE; } else if (sameString(virtModeType, "singleAltHaplo")) { virtWinStart = defaultVirtWinStart; virtWinEnd = defaultVirtWinEnd; virtMode = TRUE; } else if (!sameString(virtModeType, "default")) - { + { // try to set view to entire vchrom virtWinStart = 0; virtWinEnd = virtSeqBaseCount; virtMode = TRUE; + // TODO what if the full-vchrom view has "too many windows" + // check if virtRegionCount > 4000? } remapHighlightPos(); } } if (virtMode) virtChromName = "virt"; else virtChromName = chromName; virtWinBaseCount = virtWinEnd - virtWinStart;