ba33f2c600399d5b4b97dd5fd987ed2db3c891ba
chmalee
  Tue May 19 13:40:42 2026 -0700
myVariants related fixes from code review. Standardize how the code determines we are about to do something myVariants related by #defining some strings and using sameOk to check for them, remove a dead code block, and have hgc use autoSql to load the myVariants item rather than check the raw sql result, refs #37528

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index f0fe2ab4f21..3a4f2acbfe0 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -94,30 +94,31 @@
 #include "delHinds2.h"
 #include "delConrad2.h"
 #include "dgv.h"
 #include "dgvPlus.h"
 #include "tokenizer.h"
 #include "softberryHom.h"
 #include "borkPseudoHom.h"
 #include "sanger22extra.h"
 #include "ncbiRefLink.h"
 #include "ncbiRefSeqLink.h"
 #include "refLink.h"
 #include "hgConfig.h"
 #include "estPair.h"
 #include "softPromoter.h"
 #include "customTrack.h"
+#include "myVariants.h"
 #include "trackHub.h"
 #include "hubConnect.h"
 #include "sage.h"
 #include "sageExp.h"
 #include "pslWScore.h"
 #include "lfs.h"
 #include "mcnBreakpoints.h"
 #include "fishClones.h"
 #include "featureBits.h"
 #include "web.h"
 #include "dbDb.h"
 #include "jaxOrtholog.h"
 #include "dnaProbe.h"
 #include "ancientRref.h"
 #include "jointalign.h"
@@ -3695,32 +3696,31 @@
     if (sameString(trackHubSkipHubName(tdb->track), "quickLiftChain"))
         tdb->html = hFileContentsOrWarning(hHelpFile(trackHubSkipHubName(tdb->track)));
     if (liftDb && (tdb->html == NULL))
         tdb->html = getTrackHtml(liftDb, tdb->table);
     if (tdb->html != NULL && tdb->html[0] != 0)
         return tdb->html;
     }
 return NULL;
 }
 
 void printTrackHtml(struct trackDb *tdb)
 /* If there's some html associated with track print it out. Also print
  * last update time for data table and make a link
  * to the TB table schema page for this table. */
 {
-if (!isCustomTrack(tdb->track) &&
-    !(tdb->type && sameString(tdb->type, "myVariants")))
+if (!isCustomTrack(tdb->track) && !isMyVariantsType(tdb->type))
     {
     printRelatedTracks(database, trackHash, tdb, cart);
     extraUiLinks(database, tdb, cart);
     printTrackUiLink(tdb);
     printOrigAssembly(tdb);
     printDataVersion(database, tdb);
     printUpdateTime(database, tdb, NULL);
     printDataRestrictionDate(tdb);
     }
 char *liftDb = cloneString(trackDbSetting(tdb, "quickLiftDb"));
 char *html = getHtmlFromSelfOrParent(tdb, liftDb);
 if (html != NULL && html[0] != 0)
     {
     htmlHorizontalLine();
 
@@ -22975,31 +22975,31 @@
     doBigDbSnp(ct->tdb, item);
 else if (sameWord(type, "bigBed") || sameWord(type, "bigGenePred") || sameWord(type, "bigLolly") || sameWord(type, "bigMethyl"))
     bigBedCustomClick(ct->tdb);
 else if (startsWith("bigRmsk", type))
     doBigRmskRepeat(ct->tdb, item);
 else if (sameWord(type, "bigBarChart") || sameWord(type, "barChart"))
     doBarChartDetails(ct->tdb, item);
 else if (sameWord(type, "bigInteract") || sameWord(type, "interact"))
     doInteractDetails(ct->tdb, item);
 else if (sameWord(type, "bam") || sameWord(type, "cram"))
     doBamDetails(ct->tdb, itemName);
 else if (sameWord(type, "vcfTabix") || sameWord(type, "vcfPhasedTrio"))
     doVcfTabixDetails(ct->tdb, itemName);
 else if (sameWord(type, "vcf"))
     doVcfDetails(ct->tdb, itemName);
-else if (cfgOptionBooleanDefault("doMyVariants", FALSE) && startsWith("myVariants_", trackId))
+else if (cfgOptionBooleanDefault("doMyVariants", FALSE) && isMyVariantsTrack(trackId))
     doMyVariantsDetails(ct, item);
 else if (ct->wiggle)
     {
     if (ct->dbTrack)
 	{
 	struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH);
 	genericWiggleClick(conn, ct->tdb, fileItem, start);
 	hFreeConn(&conn);
 	}
     else
 	genericWiggleClick(NULL, ct->tdb, fileItem, start);
     /*	the NULL is for conn, don't need that for custom tracks */
     }
 else if (ct->dbTrack && startsWith("bedGraph", ct->dbTrackType))
     {
@@ -27211,39 +27211,39 @@
 winEnd = cartUsualInt(cart, "r", 0);
 
 /* Allow faked-out c=0 l=0 r=0 (e.g. for unaligned mRNAs) but not just any
  * old bogus position: */
 if (seqName == NULL)
     {
     if (winStart != 0 || winEnd != 0)
 	webAbortNoHttpHeader("CGI variable error", 
 		 "hgc: bad input variables c=%s l=%d r=%d",
 		 cartString(cart, "c"), winStart, winEnd);
     else
 	seqName = hDefaultChrom(database);
     }
 
 struct customTrack *ct = NULL;
-if (isCustomTrack(track) || startsWith("myVariants_", track))
+if (isCustomTrack(track) || isMyVariantsTrack(track))
     {
     struct customTrack *ctList = getCtList();
     for (ct = ctList; ct != NULL; ct = ct->next)
         if (sameString(track, ct->tdb->track))
             break;
     }
 
-if ((!isCustomTrack(track) && !startsWith("myVariants_", track) && dbIsFound)
+if ((!isCustomTrack(track) && !isMyVariantsTrack(track) && dbIsFound)
 ||  ((ct!= NULL) && (((ct->dbTrackType != NULL) &&  sameString(ct->dbTrackType, "maf"))|| sameString(ct->tdb->type, "bigMaf"))))
     {
     trackHash = makeTrackHashWithComposites(database, seqName, TRUE);
     if (sameString("htcBigPslAli", track) || sameString("htcBigPslAliInWindow", track) )
 	{
 	char *aliTable = cartString(cart, "aliTable");
 	if (isHubTrack(aliTable))	
 	    tdb = hubConnectAddHubForTrackAndFindTdb( database, aliTable, NULL, trackHash);
 	}
     else if (isHubTrack(track))
 	{
 	tdb = hubConnectAddHubForTrackAndFindTdb( database, track, NULL, trackHash);
 	}
     if (parentWigMaf)
         {
@@ -27869,31 +27869,31 @@
     {
     doMouseOrtho(tdb, item);
     }
 else if (sameWord(table, USER_PSL_TRACK_NAME))
     {
     doUserPsl(table, item);
     }
 else if (sameWord(table, PCR_RESULT_TRACK_NAME))
     {
     doPcrResult(table, item);
     }
 else if (sameWord(table, "softPromoter"))
     {
     hgSoftPromoter(table, item);
     }
-else if (isCustomTrack(table) || startsWith("myVariants_", table))
+else if (isCustomTrack(table) || isMyVariantsTrack(table))
     {
     if (tdb != NULL)
         {
         char *origTrackName = trackDbSetting(tdb, "origTrackName");
         if (origTrackName)
             table = origTrackName;
         }
     hgCustom(table, item);
     }
 else if (sameWord(table, "snpTsc") || sameWord(table, "snpNih") || sameWord(table, "snpMap"))
     {
     doSnpOld(tdb, item);
     }
 else if (sameWord(table, "snp"))
     {