f42aedac7eaf850e2df8200dfbded43936b9dc76 braney Thu Apr 8 14:34:25 2021 -0700 fix chain click-throughs from assembly hubs to native assemblies and vice-versa diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 380876f..8ac5344 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -3370,32 +3370,32 @@ { printf("", title, hgTracksName(), otherDb, chrom, start+1, end); } void chainToOtherBrowser(struct chain *chain, char *otherDb, char *otherOrg) /* Put up link that lets us use chain to browser on * corresponding window of other species. */ { struct chain *subChain = NULL, *toFree = NULL; int qs,qe; chainSubsetOnT(chain, winStart, winEnd, &subChain, &toFree); if (subChain != NULL && otherOrg != NULL) { qChainRangePlusStrand(subChain, &qs, &qe); - linkToOtherBrowser(otherDb, subChain->qName, qs-1, qe); - printf("Open %s browser at position corresponding to the part of chain that is in this window.
\n", otherOrg); + linkToOtherBrowserExtra(otherDb, subChain->qName, qs-1, qe, cartSidUrlString(cart)); + printf("Open %s browser at position corresponding to the part of chain that is in this window.
\n", trackHubSkipHubName(otherOrg)); } chainFree(&toFree); } void genericChainClick(struct sqlConnection *conn, struct trackDb *tdb, char *item, int start, char *otherDb) /* Handle click in chain track, at least the basics. */ { char *thisOrg = hOrganism(database); char *otherOrg = NULL; struct chain *chain = NULL, *subChain = NULL, *toFree = NULL; int chainWinSize; double subSetScore = 0.0; int qs, qe; boolean nullSubset = FALSE; @@ -3403,30 +3403,37 @@ if (! sameWord(otherDb, "seq")) { otherOrg = hOrganism(otherDb); } if (otherOrg == NULL) { /* use first word of chain label (count on org name as first word) */ otherOrg = firstWordInLine(cloneString(tdb->shortLabel)); } if (startsWith("big", tdb->type)) { char *fileName = bbiNameFromSettingOrTable(tdb, conn, tdb->table); char *linkFileName = trackDbSetting(tdb, "linkDataUrl"); chain = chainLoadIdRangeHub(fileName, linkFileName, seqName, winStart, winEnd, atoi(item)); + + if (!hDbIsActive(otherDb)) // if this isn't a native database, check to see if it's a hub + { + struct trackHubGenome *genome = trackHubGetGenomeUndecorated(otherDb); + if (genome) + otherDb = genome->name; + } } else { chain = chainLoadIdRange(database, tdb->table, seqName, winStart, winEnd, atoi(item)); } chainSubsetOnT(chain, winStart, winEnd, &subChain, &toFree); if (subChain == NULL) nullSubset = TRUE; else if (hDbIsActive(otherDb) && subChain != chain) { char *linearGap = trackDbSettingOrDefault(tdb, "chainLinearGap", "loose"); struct gapCalc *gapCalc = gapCalcFromFile(linearGap); struct axtScoreScheme *scoreScheme = axtScoreSchemeDefault(); @@ -3455,31 +3462,31 @@ } if (subChain->qStrand == '-') reverseIntRange(&qStart, &qEnd, subChain->qSize); qSeq = hChromSeq(otherDb, subChain->qName, qStart, qEnd); if (subChain->qStrand == '-') reverseComplement(qSeq->dna, qSeq->size); subChain->score = chainCalcScoreSubChain(subChain, scoreScheme, gapCalc, qSeq, tSeq); subSetScore = subChain->score; } chainFree(&toFree); printf("%s position: %s:%d-%d" " size: %d
\n", - thisOrg, hgTracksName(), cartSidUrlString(cart), database, + trackHubSkipHubName(thisOrg), hgTracksName(), cartSidUrlString(cart), database, chain->tName, chain->tStart+1, chain->tEnd, chain->tName, chain->tStart+1, chain->tEnd, chain->tEnd-chain->tStart); printf("Strand: %c
\n", chain->qStrand); qChainRangePlusStrand(chain, &qs, &qe); if (sameWord(otherDb, "seq")) { printf("%s position: %s:%d-%d size: %d
\n", otherOrg, chain->qName, qs, qe, chain->qEnd - chain->qStart); } else { /* prints link to other db browser only if db exists and is active */ /* else just print position with no link for the other db */ printf("%s position: ", otherOrg); if (hDbIsActive(otherDb)) @@ -3536,35 +3543,35 @@ /* the otherDb. */ if (!startsWith("big", tdb->type) && sqlDatabaseExists(otherDb) && chromSeqFileExists(otherDb, chain->qName)) { if (chainWinSize < 1000000) { printf("View "); hgcAnchorSomewhere("htcChainAli", item, tdb->track, chain->tName); printf("DNA sequence alignment details of parts of chain within browser " "window.
\n"); } else { printf("Zoom so that browser window covers 1,000,000 bases or less " "and return here to see alignment details.
\n"); } + } if (!sameWord(otherDb, "seq") && (hDbIsActive(otherDb))) { chainToOtherBrowser(chain, otherDb, otherOrg); } - } /* if (!sameWord(otherDb, "seq") && (hDbIsActive(otherDb))) { chainToOtherBrowser(chain, otherDb, otherOrg); } */ chainFree(&chain); } char *trackTypeInfo(char *track) /* Return type info on track. You can freeMem result when done. */ { struct slName *trackDbs = hTrackDbList(), *oneTrackDb; struct sqlConnection *conn = hAllocConn(database); char buf[512];