fccc494337013c07d32c506fec1ae07a5b93ff88
braney
  Sun Oct 23 17:00:03 2022 -0700
deal with curated assemblies in hgSearch

diff --git src/hg/hgSearch/hgSearch.c src/hg/hgSearch/hgSearch.c
index 36ed9b4..85e28d1 100644
--- src/hg/hgSearch/hgSearch.c
+++ src/hg/hgSearch/hgSearch.c
@@ -31,58 +31,61 @@
 /* Standard CGI Global Variables */
 struct cart *cart;             /* CGI and other variables */
 struct hash *oldVars = NULL;
 boolean measureTiming = FALSE;
 
 /* These globals are for creating the category tree interface */
 struct trackDb *hgFindTdbList = NULL;
 struct grp *hgFindGrpList = NULL;
 
 struct dbDbHelper
 /* A struct dbDb with an extra field for whether the assembly is the default */
 {
 struct dbDbHelper *next;
 struct dbDb *dbDb;
 boolean isDefault;
+boolean isCurated;;
 };
 
 /* Helper functions for cart handlers */
 static struct dbDbHelper *getDbDbWithDefault()
 /* Grab rows from dbDb along with whether assembly is the default or not */
 {
 struct dbDbHelper *ret = NULL;
 struct sqlConnection *conn = hConnectCentral();
 struct sqlResult *sr;
 char **row;
 struct dbDb *db;
 struct hash *hash = sqlHashOfDatabases();
 
 char query[1024];
 sqlSafef(query, sizeof query,  "select dbDb.*,defaultDb.name from %s "
         "join %s on %s.genome=%s.genome where active=1 order by orderKey,dbDb.name desc",
         dbDbTable(), defaultDbTable(), dbDbTable(), defaultDbTable());
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     struct dbDbHelper *this;
     db = dbDbLoad(row);
     boolean isGenarkHub = sameOk(db->nibPath, "genark");
-    if (isGenarkHub || hashLookup(hash, db->name))
+    boolean isCuratedHub = startsWith("hub:", db->nibPath);
+    if (isGenarkHub || isCuratedHub ||  hashLookup(hash, db->name))
         {
         AllocVar(this);
         this->dbDb = db;
         this->isDefault = sameString(row[14],row[0]);
+        this->isCurated = isCuratedHub;
         slAddTail(&ret, this);
         }
     else
         dbDbFree(&db);
     }
 sqlFreeResult(&sr);
 hashFree(&hash);
 hDisconnectCentral(&conn);
 slReverse(&ret);
 return ret;
 }
 
 static struct trackDb *addSupers(struct trackDb *trackList)
 /* Insert supertracks into the hierarchy. */
 {
@@ -423,59 +426,68 @@
 /* We haven't seen this database before, return list of all searchable stuff */
 {
 char *db = cartJsonRequiredParam(paramHash, "db", cj->jw, "getUiState");
 cartSetString(cj->cart, "db", db);
 initGenbankTableNames(db);
 hashTracksAndGroups(cj->cart, db);
 writeDefaultForDb(cj->jw, db);
 }
 
 static struct jsonElement *getGenomes()
 /* Return a string that the javascript can use to put up a species and db select. */
 {
 struct jsonElement *genomesObj = newJsonObject(hashNew(0));
 struct dbDbHelper *localDbs = getDbDbWithDefault();
 struct dbDbHelper *temp;
+struct hash *curatedHubs = hashNew(0);
 for (temp = localDbs; temp != NULL; temp = temp->next)
     {
     // fill out the dbDb fields into a struct
     struct jsonElement *genomeObj = newJsonObject(hashNew(0));
     jsonObjectAdd(genomeObj, "organism", newJsonString(temp->dbDb->organism));
     jsonObjectAdd(genomeObj, "name", newJsonString(temp->dbDb->name));
     jsonObjectAdd(genomeObj, "genome", newJsonString(temp->dbDb->genome));
     jsonObjectAdd(genomeObj, "description", newJsonString(temp->dbDb->description));
     jsonObjectAdd(genomeObj, "orderKey", newJsonNumber(temp->dbDb->orderKey));
     jsonObjectAdd(genomeObj, "isDefault", newJsonBoolean(temp->isDefault));
+    jsonObjectAdd(genomeObj, "isCurated", newJsonBoolean(temp->isCurated));
+
+    if (temp->isCurated)
+        hashStore(curatedHubs, temp->dbDb->name);
 
     // finally add the dbDb object to the hash on species, either create a new
     // list if this is the first time seeing this species or append to the end
     // of the list to keep things in the right order
     struct jsonElement *genomeList = NULL;
     if ( (genomeList = jsonFindNamedField(genomesObj, temp->dbDb->genome, temp->dbDb->genome)) != NULL)
         jsonListAdd(genomeList, genomeObj);
     else
         {
         genomeList = newJsonList(NULL);
         jsonListAdd(genomeList, genomeObj);
         jsonObjectAdd(genomesObj, temp->dbDb->genome, genomeList);
         }
     }
 
 struct dbDb *trackHubDbs = trackHubGetDbDbs(NULL);
 struct dbDb *dbDb;
 for (dbDb = trackHubDbs; dbDb != NULL; dbDb = dbDb->next)
     {
+    // if this is a curated hub, don't treat it like other track hubs
+    if (hashLookup(curatedHubs, trackHubSkipHubName(dbDb->name)) != NULL)
+        continue;
+
     // fill out the dbDb fields into a struct
     struct jsonElement *genomeObj = newJsonObject(hashNew(0));
     jsonObjectAdd(genomeObj, "organism", newJsonString(dbDb->organism));
     jsonObjectAdd(genomeObj, "name", newJsonString(dbDb->name));
     jsonObjectAdd(genomeObj, "genome", newJsonString(dbDb->genome));
     jsonObjectAdd(genomeObj, "description", newJsonString(dbDb->description));
 
     // finally add the dbDb object to the hash on species, either create a new
     // list if this is the first time seeing this species or append to the end
     // of the list to keep things in the right order
     struct jsonElement *genomeList = NULL;
     if ( (genomeList = jsonFindNamedField(genomesObj, dbDb->genome, dbDb->genome)) != NULL)
         jsonListAdd(genomeList, genomeObj);
     else
         {