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/lib/customFactory.c src/hg/lib/customFactory.c
index d8582385429..43298a48155 100644
--- src/hg/lib/customFactory.c
+++ src/hg/lib/customFactory.c
@@ -3372,31 +3372,31 @@
 static struct customFactory vcfTabixFactory =
 /* Factory for vcfTabix tracks */
     {
     NULL,
     "vcfTabix",
     vcfTabixRecognizer,
     vcfTabixLoader,
     };
 
 /*** myVariants Factory - for track where user interactively creates items. ***/
 
 static boolean myVariantsRecognizer(struct customFactory *fac,	struct customPp *cpp, char *type,
 			     struct customTrack *track)
 /* Return TRUE if looks like we're handling a myVariants track */
 {
-return (sameType(type, "myVariants"));
+return isMyVariantsType(type);
 }
 
 struct myVariants *myVariantsFromRow(char **row, int rowSize)
 /* Create a myVariants from a row of uncertain length. */
 {
 if (rowSize < 3)
     errAbort("err: need at least %d fields in a myVariants row, got %d", 3, rowSize);
 struct myVariants *item;
 AllocVar(item);
 item->chrom = cloneString(row[0]);
 item->chromStart = sqlUnsigned(row[1]);
 item->chromEnd = sqlUnsigned(row[2]);
 item->bin = binFromRange(item->chromStart, item->chromEnd);
 if (rowSize > 3)
     item->name = cloneString(row[3]);
@@ -3440,58 +3440,58 @@
     char *row[8];
     int wordCount = chopLine(line, row);
     struct lineFile *lf = cpp->fileStack;
     lineFileExpectAtLeast(lf, 3, wordCount);
     if (fieldCount == 0)
         fieldCount = wordCount;
     else if (fieldCount != wordCount)
         {
 	errAbort("error: some lines in myVariants type custom track have %d fields, others have %d",
 		fieldCount, wordCount);
 	}
     struct myVariants *item = myVariantsFromRow(row, wordCount);
     customFactoryCheckChromNameDb(ctDb, item->chrom, lf);
     slAddHead(&list, item);
     }
-track->dbTrackType = cloneString("myVariants");
-track->tdb->type = cloneString("myVariants");
+track->dbTrackType = cloneString(MYVARIANTS_TYPE);
+track->tdb->type = cloneString(MYVARIANTS_TYPE);
 if (isEmpty(track->tdb->html))
     {
     char descPath[PATH_LEN];
     safef(descPath, sizeof descPath, "%s/inc/myVariantsDesc.html", hDocumentRoot());
     if (fileExists(descPath))
         readInGulp(descPath, &track->tdb->html, NULL);
     }
 /* tdb->shortLabel holds the name= value from the track line at this point.
  * Use it for track/table identity, then override the display labels
  * from the shortLabel/longLabel settings if present. */
 track->tdb->table = track->tdb->shortLabel;
 track->tdb->track = track->tdb->shortLabel;
 char *sl = trackDbSetting(track->tdb, "shortLabel");
 if (isNotEmpty(sl))
     track->tdb->shortLabel = cloneString(sl);
 char *ll = trackDbSetting(track->tdb, "longLabel");
 if (isNotEmpty(ll))
     track->tdb->longLabel = cloneString(ll);
 return track;
 }
 
 static struct customFactory myVariantsFactory =
 /* Factory for myVariants tracks */
     {
     NULL,
-    "myVariants",
+    MYVARIANTS_TYPE,
     myVariantsRecognizer,
     myVariantsLoader,
     };
 
 
 /*** VCF Factory - for Variant Call Format tracks ***/
 
 static boolean vcfRecognizer(struct customFactory *fac,
 	struct customPp *cpp, char *type,
     	struct customTrack *track)
 /* Return TRUE if looks like we're handling a vcf track */
 {
 if (type != NULL && !sameType(type, fac->name))
     return FALSE;
 boolean isVcf = headerStartsWith(cpp, "##fileformat=VCFv");