eb572b9de60c49871e84bf8b6bd548210b69d44f hiram Thu Nov 17 15:21:02 2016 -0800 attempting to make the hal links prettier refs #13553 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 51dfe47..7388b46 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -242,30 +242,31 @@ #include "virusClick.h" #include "gwasCatalog.h" #include "parClick.h" #include "mdb.h" #include "yaleGencodeAssoc.h" #include "itemDetailsHtml.h" #include "trackVersion.h" #include "numtsClick.h" #include "geneReviewsClick.h" #include "bigBed.h" #include "bigPsl.h" #include "bedTabix.h" #include "longRange.h" #include "hmmstats.h" #include "aveStats.h" +#include "trix.h" static char *rootDir = "hgcData"; #define LINESIZE 70 /* size of lines in comp seq feature */ struct cart *cart; /* User's settings. */ char *seqName; /* Name of sequence we're working on. */ int winStart, winEnd; /* Bounds of sequence. */ char *database; /* Name of mySQL database. */ char *organism; /* Colloquial name of organism. */ char *genome; /* common name, e.g. Mouse, Human */ char *scientificName; /* Scientific name of organism. */ struct hash *trackHash; /* A hash of all tracks - trackDb valued */ @@ -24938,56 +24939,81 @@ if (tdb == NULL) errAbort("no trackDb entry for %s", table); return tdb; } void doQPCRPrimers(struct trackDb *tdb, char *itemName) /* Put up page for QPCRPrimers. */ { genericHeader(tdb, itemName); doBedDetail(tdb, NULL, itemName); } /* end of doQPCRPrimers */ void doSnakeClick(struct trackDb *tdb, char *itemName) /* Put up page for snakes. */ { -genericHeader(tdb, itemName); +struct trackDb *parentTdb = trackDbTopLevelSelfOrParent(tdb); char *otherSpecies = trackHubSkipHubName(tdb->table) + strlen("snake"); char *hubName = cloneString(database); char otherDb[4096]; char *qName = cartOptionalString(cart, "qName"); int qs = atoi(cartOptionalString(cart, "qs")); int qe = atoi(cartOptionalString(cart, "qe")); int qWidth = atoi(cartOptionalString(cart, "qWidth")); +char *qTrack = cartString(cart, "g"); +if(isHubTrack(qTrack) && ! trackHubDatabase(database)) + hubName = cloneString(qTrack); -if(trackHubDatabase(database)) +struct hash *dbAliasHash = NULL; // create later when needed +char * dbAliasList = trackDbSetting(tdb, "dbAliasList"); +if (dbAliasList) + dbAliasHash = hashFromString(dbAliasList); + +/* current mouse strain hal file has incorrect chrom names */ +char *aliasQName = qName; +// aliasQName = "chr1"; // temporarily make this work for the mouse hal + +if(trackHubDatabase(database) || isHubTrack(qTrack)) { char *ptr = strchr(hubName + 4, '_'); *ptr = 0; safef(otherDb, sizeof otherDb, "%s_%s", hubName, otherSpecies); } else { safef(otherDb, sizeof otherDb, "%s", otherSpecies); } -printf("<A HREF=\"hgTracks?db=%s&position=%s:%d-%d&%s_snake%s=full\" TARGET=_BLANK><B>Link to block in other assembly</A><BR>\n", otherDb, qName, qs, qe,hubName,trackHubSkipHubName(database)); +if (dbAliasHash) + { + char *otherDbName = trackHubSkipHubName(otherDb); + struct hashEl* alias = hashLookup(dbAliasHash, otherDbName); + if (alias) + safef(otherDb, sizeof otherDb, "%s", (char *)alias->val); + } + +char headerText[256]; +safef(headerText, sizeof headerText, "reference: %s, query: %s\n", trackHubSkipHubName(database), trackHubSkipHubName(otherDb) ); +genericHeader(parentTdb, headerText); + +printf("<A HREF=\"hgTracks?db=%s&position=%s:%d-%d&%s_snake%s=full\" TARGET=_BLANK>%s:%d-%d</A> link to block in query assembly: <B>%s</B></A><BR>\n", otherDb, aliasQName, qs, qe, hubName, trackHubSkipHubName(database), aliasQName, qs, qe, trackHubSkipHubName(otherDb)); int qCenter = (qs + qe) / 2; int newQs = qCenter - qWidth/2; int newQe = qCenter + qWidth/2; -printf("<A HREF=\"hgTracks?db=%s&position=%s:%d-%d&%s_snake%s=full\" TARGET=\"_blank\"><B>Link to same window size in other assembly</A><BR>\n", otherDb, qName, newQs, newQe,hubName,trackHubSkipHubName(database)); +printf("<A HREF=\"hgTracks?db=%s&position=%s:%d-%d&%s_snake%s=full\" TARGET=\"_blank\">%s:%d-%d</A> link to same window size in query assembly: <B>%s</B></A><BR>\n", otherDb, aliasQName, newQs, newQe,hubName, trackHubSkipHubName(database), aliasQName, newQs, newQe, trackHubSkipHubName(otherDb) ); +printTrackHtml(tdb); } bool vsameWords(char *a, va_list args) /* returns true if a is sameWord as any arg, all args must be char* */ { bool found = FALSE; char *b; while ((b = va_arg(args, char *)) != NULL) { if (sameWord(a, b)) { found = TRUE; break; } }