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/hgTables/hgTables.c src/hg/hgTables/hgTables.c index 2a63ad98887..6d06af47db7 100644 --- src/hg/hgTables/hgTables.c +++ src/hg/hgTables/hgTables.c @@ -670,39 +670,39 @@ else if (isBigBed(database, table, curTrack, ctLookupName)) hti = bigBedToHti(table, conn); else if (isBigWigTable(table)) hti = bigWigToHti(table); else if (isLongTabixTable(table)) hti = longTabixToHti(table); else if (isBamTable(table)) hti = bamToHti(table); else if (isVcfTable(table, &isTabix)) { boolean isTabix = trackIsType(database, table, curTrack, "vcfTabix", ctLookupName); hti = vcfToHti(table, isTabix); } else if (isHicTable(table)) hti = hicToHti(table); -else if (isCustomTrack(table) || startsWith("myVariants_", table) || +else if (isCustomTrack(table) || isMyVariantsTrack(table) || (strchr(table, '.') != NULL && - startsWith("myVariants_", strchr(table, '.') + 1))) + isMyVariantsTrack(strchr(table, '.') + 1))) { /* Accept the qualified myVariants storage form * ("customDataNN.myVariants_<user>") as well as the bare track name; * the ct list is keyed on the bare track name. */ char *dot = strchr(table, '.'); - char *trackName = (dot != NULL && startsWith("myVariants_", dot + 1)) ? dot + 1 : table; + char *trackName = (dot != NULL && isMyVariantsTrack(dot + 1)) ? dot + 1 : table; struct customTrack *ct = ctLookupName(trackName); hti = ctToHti(ct); } else if (sameWord(table, WIKI_TRACK_TABLE)) { hti = wikiHti(); } else if (trackHubDatabase(db)) { /* Hub assemblies have no SQL database; can't look up table via hFindTableInfo. */ hti = NULL; } else { char *track; @@ -1228,82 +1228,82 @@ void doTabOutTable( char *db, char *table, FILE *f, struct sqlConnection *conn, char *fields, char outSep) /* Do tab-separated output on fields of a single table. */ { boolean isTabix = FALSE; if (isBigBed(database, table, curTrack, ctLookupName)) bigBedTabOut(db, table, conn, fields, f, outSep); else if (isLongTabixTable(table)) longTabixTabOut(db, table, conn, fields, f, outSep); else if (isBamTable(table)) bamTabOut(db, table, conn, fields, f, outSep); else if (isVcfTable(table, &isTabix)) vcfTabOut(db, table, conn, fields, f, isTabix); else if (isHicTable(table)) hicTabOut(db, table, conn, fields, f, outSep); -else if (isCustomTrack(table) || startsWith("myVariants_", table)) +else if (isCustomTrack(table) || isMyVariantsTrack(table)) { doTabOutCustomTracks(db, table, conn, fields, f, outSep); } else doTabOutDb(db, db, table, table, f, conn, fields, outSep); } struct slName *fullTableFields(char *db, char *table) /* Return list of fields in db.table.field format. */ { char dtBuf[256]; struct sqlConnection *conn=NULL; struct slName *fieldList = NULL, *dtfList = NULL, *field, *dtf; if (isBigBed(database, table, curTrack, ctLookupName)) { if (!trackHubDatabase(database)) conn = hAllocConn(db); fieldList = bigBedGetFields(table, conn); hFreeConn(&conn); } else if (isLongTabixTable(table)) fieldList = getLongTabixFields(6); else if (isHalTable(table)) fieldList = getBedFields(6); else if (isBamTable(table)) fieldList = bamGetFields(table); else if (isVcfTable(table, NULL)) fieldList = vcfGetFields(table); else if (isHicTable(table)) fieldList = hicGetFields(table); -else if (isCustomTrack(table) || startsWith("myVariants_", table)) +else if (isCustomTrack(table) || isMyVariantsTrack(table)) { struct customTrack *ct = ctLookupName(table); char *type = ct->dbTrackType; if (type != NULL) { conn = hAllocConn(CUSTOM_TRASH); if (startsWithWord("maf", type) || - startsWithWord("myVariants", type) || + isMyVariantsType(type) || sameWord("bedDetail", type) || sameWord("barChart", type) || sameWord("interact", type) || sameWord("bedMethyl", type) || sameWord("pgSnp", type)) { - if (sameWord("myVariants", type)) + if (isMyVariantsType(type)) { ct->dbTableName = myVariantsResolveDbTableForCustomTrack(ct->tdb->table, cart); } fieldList = sqlListFields(conn, ct->dbTableName); - if (startsWith("myVariants_shared_", table)) + if (isMyVariantsSharedTrack(table)) myVariantsStripHiddenFields(&fieldList); } hFreeConn(&conn); } if (fieldList == NULL) fieldList = getBedFields(ct->fieldCount); } else { char *splitTable; dbOverrideFromTable(dtBuf, &db, &table); conn = hAllocConn(db); splitTable = chromTable(conn, table); fieldList = sqlListFields(conn, splitTable); freez(&splitTable);